diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..d1b1651 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "taskName": "mbed compile (debug)", + "type": "shell", + "command": "mbed compile --profile mbed-os/tools/profiles/debug.json", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/main.cpp b/main.cpp index ff671ad..6f1e0f9 100644 --- a/main.cpp +++ b/main.cpp @@ -9,7 +9,19 @@ static DigitalOut led2(LED2); static DigitalOut led3(LED6); static DigitalOut led4(LED5); +static Serial s_debug_serial_port(SERIAL_TX, SERIAL_RX); + static Thread s_thread_blink; +static Thread s_thread_recurrent_1; + +static EventQueue s_eq_recurrent_1; + +static Timer s_timer_1; + +void event_proc_recurrent_1(char c) +{ + printf("[event_proc_recurrent_1] Elapsed %d ms\n",s_timer_1.read_ms()); +} void thread_proc_blink(std::vector *pleds) { @@ -26,10 +38,17 @@ void thread_proc_blink(std::vector *pleds) int main() { + s_debug_serial_port.baud(115200); + s_leds.push_back(led1); s_leds.push_back(led2); s_leds.push_back(led3); s_leds.push_back(led4); + s_eq_recurrent_1.call_every(1000,event_proc_recurrent_1,'.'); + s_thread_blink.start(callback(thread_proc_blink, &s_leds)); + + s_timer_1.start(); + s_thread_recurrent_1.start(callback(&s_eq_recurrent_1,&EventQueue::dispatch_forever)); } \ No newline at end of file