Just Gary
/
peach_blink
This program does *not* run correctly if declarations are left in.
Revision 0:e4945b97d9aa, committed 2017-02-02
- Comitter:
- justgary
- Date:
- Thu Feb 02 23:36:37 2017 +0000
- Commit message:
- This program does *not* run properly if declarations are left in.
Changed in this revision
diff -r 000000000000 -r e4945b97d9aa main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 02 23:36:37 2017 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#include "rtos.h" + +Serial pc(USBTX, USBRX); + +DigitalOut redled(LED_RED); +DigitalOut greled(LED_GREEN); +DigitalOut bluled(LED_BLUE); +DigitalOut useled(LED_USER); + +InterruptIn irq_data(P2_14); // <--- Leave this line, blink_thread() won't run + +SPI spi_data(P10_14, P10_15, P10_12, P10_13); // SPI0 // <--- Leave these two lines, nothing runs +RawSerial uart_data(P8_14, P8_15); // UART4 // <-' + + +Thread h_task1_thread (osPriorityRealtime, 20480L, NULL); +Thread h_task2_thread (osPriorityHigh, 20480L, NULL); +Thread h_task3_thread (osPriorityNormal, 20480L, NULL); +Thread h_task4_thread (osPriorityLow, 20480L, NULL); +Thread h_blink_thread (osPriorityNormal, 20480L, NULL); + +void blink_thread () { + useled = 1; + while (true) { + Thread::signal_wait(0x1); + useled = !useled; + } +} + +int main() { + h_blink_thread.start(blink_thread); + + while(1) { + bluled = 1; + wait(0.2); + bluled = 0; + wait(0.2); + h_blink_thread.signal_set(0x1); + } +}
diff -r 000000000000 -r e4945b97d9aa mbed-rtos.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Thu Feb 02 23:36:37 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
diff -r 000000000000 -r e4945b97d9aa mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Feb 02 23:36:37 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5 \ No newline at end of file