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:
- 5:5195884584d6
- Parent:
- 4:d4aeacb47955
--- a/main.cpp Sun Dec 10 13:50:11 2017 +0000 +++ b/main.cpp Sun Dec 10 16:11:32 2017 +0000 @@ -1,11 +1,8 @@ #include "mbed.h" -void timer(); -void led_off(); void print_help() //help message -{ -printf("\r\n"); +{ printf("***********************************************************\r\n"); printf("* LEDON:x - set time for LED to be ON *\r\n"); printf("* - x - time in seconds (range 1-1000) *\r\n"); @@ -17,7 +14,7 @@ printf("* BUTTONGET - get user button monitorring state *\r\n"); printf("* BUTTONSTATE - get user button state *\r\n"); printf("* BUTTONENABLE - enable button monitorring *\r\n"); -printf("* BUTTONDISABLE - enable button monitorring *\r\n"); +printf("* BUTTONDISABLE - disable button monitorring *\r\n"); printf("* HELP - print available list of commands *\r\n"); printf("***********************************************************\r\n"); } @@ -38,7 +35,7 @@ void print_fc_off() //fault code message when LED is off { -printf("\r\nWRONG INPUT\r\n"); +printf("WRONG INPUT\r\n"); printf(" To turn LED on type: \r\n"); printf(" LEDON:x where [x] is specified period of seconds \r\n"); printf(" x range 1-1000 \r\n"); @@ -46,7 +43,7 @@ void print_fc_on() //fault code message when LED is on { -printf("\r\nWRONG INPUT\r\n"); +printf("WRONG INPUT\r\n"); printf(" To see available list of commands type HELP\r\n"); } @@ -274,7 +271,6 @@ } } - int main() { print_welcome();