![](/media/cache/profiles/ndu.jpg.50x50_q85.jpg)
keyboard input, serial com test
Dependencies: mbed DISCO_L475VG_IOT01A_wifi TextLCD USBHost
main.cpp@6:9d975a9d2728, 2019-08-15 (annotated)
- Committer:
- duchonic
- Date:
- Thu Aug 15 19:33:04 2019 +0000
- Revision:
- 6:9d975a9d2728
- Parent:
- 5:0466445897b8
first
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
duchonic | 0:6eeb987cb865 | 1 | #include "mbed.h" |
duchonic | 6:9d975a9d2728 | 2 | #include "rtos.h" |
duchonic | 6:9d975a9d2728 | 3 | #include "inc/server.h" |
duchonic | 6:9d975a9d2728 | 4 | #include "inc/massStorage.h" |
duchonic | 6:9d975a9d2728 | 5 | #include "inc/config.h" |
duchonic | 6:9d975a9d2728 | 6 | |
duchonic | 6:9d975a9d2728 | 7 | #include <string> |
duchonic | 0:6eeb987cb865 | 8 | |
duchonic | 0:6eeb987cb865 | 9 | DigitalOut led1(LED1); |
duchonic | 2:c1f316e932bc | 10 | Serial pc(SERIAL_TX, SERIAL_RX); |
duchonic | 5:0466445897b8 | 11 | |
duchonic | 6:9d975a9d2728 | 12 | const int TASK_PROGRAMM_DELAY_MS = 4000; |
duchonic | 6:9d975a9d2728 | 13 | const int TASK_LED_DELAY_MS = 100; |
duchonic | 5:0466445897b8 | 14 | |
duchonic | 6:9d975a9d2728 | 15 | void program_task(void const *){ |
duchonic | 6:9d975a9d2728 | 16 | while(1){ |
duchonic | 6:9d975a9d2728 | 17 | Thread::wait(TASK_PROGRAMM_DELAY_MS); |
duchonic | 6:9d975a9d2728 | 18 | printf("prgramm running\r\n"); |
duchonic | 6:9d975a9d2728 | 19 | } |
duchonic | 6:9d975a9d2728 | 20 | } |
duchonic | 6:9d975a9d2728 | 21 | |
duchonic | 6:9d975a9d2728 | 22 | void led_task(void const *) { |
duchonic | 6:9d975a9d2728 | 23 | while(1){ |
duchonic | 6:9d975a9d2728 | 24 | led1 = !led1; |
duchonic | 6:9d975a9d2728 | 25 | Thread::wait(TASK_LED_DELAY_MS); |
duchonic | 6:9d975a9d2728 | 26 | } |
duchonic | 6:9d975a9d2728 | 27 | } |
duchonic | 0:6eeb987cb865 | 28 | |
duchonic | 0:6eeb987cb865 | 29 | int main() |
duchonic | 6:9d975a9d2728 | 30 | { |
duchonic | 6:9d975a9d2728 | 31 | pc.baud(115200); |
duchonic | 5:0466445897b8 | 32 | pc.printf("start main()\n\r"); |
duchonic | 6:9d975a9d2728 | 33 | |
duchonic | 6:9d975a9d2728 | 34 | Thread msdTask(massStorage_task, NULL, osPriorityNormal, 1024 * 4); |
duchonic | 6:9d975a9d2728 | 35 | Thread ledTask(led_task, NULL, osPriorityNormal, 1024 * 4); |
duchonic | 6:9d975a9d2728 | 36 | Thread programTask(program_task, NULL, osPriorityNormal, 1024 * 4); |
duchonic | 6:9d975a9d2728 | 37 | Thread serverTask(server_task, NULL, osPriorityNormal, 1024 * 4); |
duchonic | 6:9d975a9d2728 | 38 | |
duchonic | 0:6eeb987cb865 | 39 | while(1) { |
duchonic | 6:9d975a9d2728 | 40 | wait(0.5); |
duchonic | 0:6eeb987cb865 | 41 | } |
duchonic | 0:6eeb987cb865 | 42 | } |