Last active
April 12, 2017 06:26
-
-
Save FreddieChopin/cdb3429236504d4ab788c99ed5ac5fb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "distortos/board/leds.hpp" | |
#include "distortos/chip/ChipOutputPin.hpp" | |
#include "distortos/StaticThread.hpp" | |
#include "distortos/ThisThread.hpp" | |
void blinkFunction(distortos::devices::OutputPin& led, std::chrono::milliseconds on, | |
std::chrono::milliseconds off) | |
{ | |
while (1) | |
{ | |
led.set(true); | |
distortos::ThisThread::sleepFor(on); | |
led.set(false); | |
distortos::ThisThread::sleepFor(off); | |
} | |
} | |
int main() | |
{ | |
// 1024 bytes of stack, very low priority (1) | |
auto thread = distortos::makeAndStartStaticThread<1024>(1, blinkFunction, | |
std::ref(distortos::board::leds[0]), std::chrono::milliseconds{100}, | |
std::chrono::milliseconds{900}); | |
thread.join(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment