Andrew Kruglov / Mbed 2 deprecated rtos_basic_dc

Dependencies:   mbed-rtos mbed

Fork of rtos_basic by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "rtos.h"
00003  
00004 DigitalOut led1(P0_1);
00005 Serial pc(p19, p20);
00006  
00007 void led1_thread(void const *args) {
00008     while (true) {
00009         led1 = !led1;
00010         Thread::wait(1000);
00011     }
00012 }
00013  
00014  
00015 int main() {
00016 
00017 
00018     pc.baud(115200);
00019     
00020     NVIC_SetPriority(SSP1_IRQn, 0x0);
00021     NVIC_SetPriority(PIN_INT0_IRQn, 0x1);
00022     // SysTick set to lower priority than Wi-Fi SPI bus interrupt
00023     NVIC_SetPriority(SysTick_IRQn, 0x2);
00024     
00025     Thread thread(led1_thread);
00026     
00027     while (true) {
00028         
00029         pc.printf("main Thread\r\n");
00030         Thread::wait(500);
00031     }
00032 }