游戏王对战板,目前code还是空的

Committer:
WFKnight
Date:
Thu Jun 21 13:51:43 2018 +0000
Revision:
0:9b3d4731edbb
UART, RTOS, LED

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WFKnight 0:9b3d4731edbb 1 #include "mbed.h"
WFKnight 0:9b3d4731edbb 2
WFKnight 0:9b3d4731edbb 3 Thread SHOW_THREAD;//声明一个线程
WFKnight 0:9b3d4731edbb 4 Serial ST_LINK_UART(SERIAL_TX, SERIAL_RX);//声明一个调试串口
WFKnight 0:9b3d4731edbb 5 //------------------------------------
WFKnight 0:9b3d4731edbb 6 // Hyperterminal configuration
WFKnight 0:9b3d4731edbb 7 // 9600 bauds, 8-bit data, no parity
WFKnight 0:9b3d4731edbb 8 //------------------------------------
WFKnight 0:9b3d4731edbb 9
WFKnight 0:9b3d4731edbb 10 void show_thread_func(void)
WFKnight 0:9b3d4731edbb 11 {
WFKnight 0:9b3d4731edbb 12 ST_LINK_UART.printf("One_Min_Time_Up\n");
WFKnight 0:9b3d4731edbb 13 fflush(stdout);
WFKnight 0:9b3d4731edbb 14 }
WFKnight 0:9b3d4731edbb 15
WFKnight 0:9b3d4731edbb 16 DigitalOut USER_LED(PA_5);
WFKnight 0:9b3d4731edbb 17
WFKnight 0:9b3d4731edbb 18 void print_thread()//线程函数
WFKnight 0:9b3d4731edbb 19 {
WFKnight 0:9b3d4731edbb 20 while (true)
WFKnight 0:9b3d4731edbb 21 {
WFKnight 0:9b3d4731edbb 22 wait(60);//线程等待调用时长
WFKnight 0:9b3d4731edbb 23 show_thread_func();//执行操作如打印字符,后进入标准线程
WFKnight 0:9b3d4731edbb 24 }
WFKnight 0:9b3d4731edbb 25 }
WFKnight 0:9b3d4731edbb 26
WFKnight 0:9b3d4731edbb 27 int main()
WFKnight 0:9b3d4731edbb 28 {
WFKnight 0:9b3d4731edbb 29 ST_LINK_UART.baud(115200);//重定义波特率为115200
WFKnight 0:9b3d4731edbb 30 ST_LINK_UART.printf("RTOS_basic_example\n");
WFKnight 0:9b3d4731edbb 31 SHOW_THREAD.start(print_thread);//启动一个演示线程,此处演示线程操作是打印字符*
WFKnight 0:9b3d4731edbb 32 while (true)
WFKnight 0:9b3d4731edbb 33 {
WFKnight 0:9b3d4731edbb 34 USER_LED = !USER_LED;
WFKnight 0:9b3d4731edbb 35 wait(0.5);
WFKnight 0:9b3d4731edbb 36 }
WFKnight 0:9b3d4731edbb 37 }