Hey all, just wanted to share a library that makes it easy to use threads with MSP430 chips:
https://github.com/toasterllc/Scheduler
It's a single header so it's easy to integrate.
Below is a two-thread example: the first thread toggles an LED every second, the second thread waits for a button to be pressed and then rapidly toggles a second LED.
Cheers,
David
void TaskLED::Run() { for (;;) { P1OUT ^= BIT0; Scheduler::Sleep(Scheduler::Ms<1000>); } } void TaskButton::Run() { for (;;) { Scheduler::Wait([] { return _Pressed; }); for (int i=0; i<100; i++) { P1OUT ^= BIT1; Scheduler::Sleep(Scheduler::Ms<20>); } _Pressed = false; } }