Thread UART
Dependencies: fsl_phy_mcr20a fsl_smac mbed-rtos mbed
Fork of mcr20_wireless_uart by
main.cpp@0:01fb291427ce, 2015-03-03 (annotated)
- Committer:
- sam_grove
- Date:
- Tue Mar 03 20:08:35 2015 +0000
- Revision:
- 0:01fb291427ce
- Child:
- 1:6055c6873f85
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sam_grove | 0:01fb291427ce | 1 | // Hello world example of MCR20 |
sam_grove | 0:01fb291427ce | 2 | #include "mbed.h" |
sam_grove | 0:01fb291427ce | 3 | |
sam_grove | 0:01fb291427ce | 4 | SPI mcr20(D11, D12, D13); |
sam_grove | 0:01fb291427ce | 5 | DigitalOut cs(D10, 1); |
sam_grove | 0:01fb291427ce | 6 | DigitalOut led(LED1, 1); |
sam_grove | 0:01fb291427ce | 7 | Serial pc(USBTX, USBRX); |
sam_grove | 0:01fb291427ce | 8 | |
sam_grove | 0:01fb291427ce | 9 | int main(void) |
sam_grove | 0:01fb291427ce | 10 | { |
sam_grove | 0:01fb291427ce | 11 | char control; |
sam_grove | 0:01fb291427ce | 12 | char buf[128]; |
sam_grove | 0:01fb291427ce | 13 | |
sam_grove | 0:01fb291427ce | 14 | while(1) { |
sam_grove | 0:01fb291427ce | 15 | if (pc.readable()) { |
sam_grove | 0:01fb291427ce | 16 | led = !led; |
sam_grove | 0:01fb291427ce | 17 | pc.getc(); |
sam_grove | 0:01fb291427ce | 18 | } |
sam_grove | 0:01fb291427ce | 19 | //pc.scanf("%c%s\n", &control, &buf); |
sam_grove | 0:01fb291427ce | 20 | } |
sam_grove | 0:01fb291427ce | 21 | } |