Using RTOS with STM32F407VET6 boards. For more details see https://os.mbed.com/users/hudakz/code/STM32F407VET6_Hello/
main.cpp@0:17c533bc12a3, 2018-04-02 (annotated)
- Committer:
- hudakz
- Date:
- Mon Apr 02 19:23:19 2018 +0000
- Revision:
- 0:17c533bc12a3
Initial issue.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 0:17c533bc12a3 | 1 | // Blinky demo using threads for the STM32F407VET6 boards. |
hudakz | 0:17c533bc12a3 | 2 | // See http://wiki.stm32duino.com/index.php?title=STM32F407 for more info. |
hudakz | 0:17c533bc12a3 | 3 | // |
hudakz | 0:17c533bc12a3 | 4 | // "Seed Arch Max" is set as target platform for the online compiler. |
hudakz | 0:17c533bc12a3 | 5 | |
hudakz | 0:17c533bc12a3 | 6 | #include "mbed.h" |
hudakz | 0:17c533bc12a3 | 7 | #include "rtos.h" |
hudakz | 0:17c533bc12a3 | 8 | |
hudakz | 0:17c533bc12a3 | 9 | DigitalOut led1(PA_6); |
hudakz | 0:17c533bc12a3 | 10 | DigitalOut led2(PA_7); |
hudakz | 0:17c533bc12a3 | 11 | Thread thread; |
hudakz | 0:17c533bc12a3 | 12 | |
hudakz | 0:17c533bc12a3 | 13 | void led2_thread() { |
hudakz | 0:17c533bc12a3 | 14 | while (true) { |
hudakz | 0:17c533bc12a3 | 15 | led2 = !led2; |
hudakz | 0:17c533bc12a3 | 16 | Thread::wait(1000); |
hudakz | 0:17c533bc12a3 | 17 | } |
hudakz | 0:17c533bc12a3 | 18 | } |
hudakz | 0:17c533bc12a3 | 19 | |
hudakz | 0:17c533bc12a3 | 20 | int main() { |
hudakz | 0:17c533bc12a3 | 21 | thread.start(led2_thread); |
hudakz | 0:17c533bc12a3 | 22 | |
hudakz | 0:17c533bc12a3 | 23 | while (true) { |
hudakz | 0:17c533bc12a3 | 24 | led1 = !led1; |
hudakz | 0:17c533bc12a3 | 25 | Thread::wait(500); |
hudakz | 0:17c533bc12a3 | 26 | } |
hudakz | 0:17c533bc12a3 | 27 | } |