Use STM32 platform, install FreeRTOS, implement UART CLI for next functionality: - light on LED for specified period in seconds, other commands are available while LED is ON. When after specified period led is off - notify user with text message on same console - set/get brightness for LED - return state of user button - enable/disable button monitoring, asynchronously monitor state of button and if it's state changed(pressed/unpressed) notify user with text message on same console - help CLI must be user friendly as much as possible. Result: you can connect device to PC and work with CLI
Diff: main.cpp
- Revision:
- 2:35f13b7f3659
- Parent:
- 0:5701b41769fd
- Child:
- 3:dd96529b7ae9
--- a/main.cpp Wed Jun 07 13:55:59 2017 +0000 +++ b/main.cpp Thu Nov 23 13:09:25 2017 +0000 @@ -1,5 +1,4 @@ #include "mbed.h" -#include "rtos.h" void print_char(char c = '*') { @@ -7,12 +6,14 @@ fflush(stdout); } +Thread thread; + DigitalOut led1(LED1); -void print_thread(void const *argument) +void print_thread() { while (true) { - Thread::wait(1000); + wait(1); print_char(); } } @@ -20,9 +21,11 @@ int main() { printf("\n\n*** RTOS basic example ***\n"); - Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); + + thread.start(print_thread); + while (true) { led1 = !led1; - Thread::wait(500); + wait(0.5); } }