Chris Snow
/
serialinterrupttest
broken!
Revision 0:713e07f71d54, committed 2016-06-10
- Comitter:
- chrissnow
- Date:
- Fri Jun 10 15:35:32 2016 +0000
- Commit message:
- RTOS and serial interrupts don't get along...
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 10 15:35:32 2016 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); + +Serial pc(USBTX, USBRX); + +void callback() { + // Note: you need to actually read from the serial to clear the RX interrupt + printf("%c\n", pc.getc()); + led2 = !led2; +} + +int main() { + pc.attach(&callback); + + while (1) { + led1 = !led1; + wait(0.5); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Fri Jun 10 15:35:32 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#4c105b8d7cae
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 10 15:35:32 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file