GIU\ZF
Dependencies: MCP23017 WattBob_TextLCD mbed-rtos mbed
Fork of rtos_basic by
main.cpp
- Committer:
- ihexx
- Date:
- 2018-03-27
- Revision:
- 13:ab52f46c98ab
- Parent:
- 12:90b5d8eae5ec
- Child:
- 14:8a6c20435523
File content as of revision 13:ab52f46c98ab:
#include "core.h" DigitalOut led1(LED3); DigitalOut led2(LED2); Thread thread,thread_group_2HZ,thread_group_1HZ; //Merge tasks with same frequency namespace runTimeParams{ Mutex liveAccess; float brakeForce = 0.0f; float accelForce = 0.0f; float avgSpeed = 0.0f; float odometer = 0.0f; #if DEBUG_MODE string debugLog = "task,execution_time_ms,lastSleep,drift\n"; #endif } int init(){ //Start task hotloops task_group_1::thread.start(task_group_1::runTask); enqueueMail::thread.start(enqueueMail::runTask); dequeueMail::thread.start(dequeueMail::runTask); // getControls::thread.start(getControls::runTask); return 0; } void led2_thread() { while (true) { led2 = !led2; Thread::wait(1000); } } int main() { init(); thread.start(led2_thread); while (true) { led1 = !led1; Thread::wait(500); } }