tested
Dependencies: Queue mbed-rtos mbed
main.cpp@0:265e6a986bf1, 2017-07-27 (annotated)
- Committer:
- andreixc
- Date:
- Thu Jul 27 12:53:20 2017 +0000
- Revision:
- 0:265e6a986bf1
init
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andreixc | 0:265e6a986bf1 | 1 | #include "mbed.h" |
andreixc | 0:265e6a986bf1 | 2 | #include "rtos.h" |
andreixc | 0:265e6a986bf1 | 3 | #include "ringbuf.h" |
andreixc | 0:265e6a986bf1 | 4 | #include "serial_bus.h" |
andreixc | 0:265e6a986bf1 | 5 | #include "can_bus.h" |
andreixc | 0:265e6a986bf1 | 6 | |
andreixc | 0:265e6a986bf1 | 7 | Serial pc(USBTX, USBRX); |
andreixc | 0:265e6a986bf1 | 8 | |
andreixc | 0:265e6a986bf1 | 9 | DigitalOut reset(p21); |
andreixc | 0:265e6a986bf1 | 10 | DigitalOut enable(p22); |
andreixc | 0:265e6a986bf1 | 11 | DigitalOut reflash(p23); |
andreixc | 0:265e6a986bf1 | 12 | |
andreixc | 0:265e6a986bf1 | 13 | void main() { |
andreixc | 0:265e6a986bf1 | 14 | |
andreixc | 0:265e6a986bf1 | 15 | pc.baud(115200); |
andreixc | 0:265e6a986bf1 | 16 | |
andreixc | 0:265e6a986bf1 | 17 | /* setup the system before using it */ |
andreixc | 0:265e6a986bf1 | 18 | reset = 0; |
andreixc | 0:265e6a986bf1 | 19 | enable = 1; |
andreixc | 0:265e6a986bf1 | 20 | reflash = 1; |
andreixc | 0:265e6a986bf1 | 21 | |
andreixc | 0:265e6a986bf1 | 22 | wait(0.1); |
andreixc | 0:265e6a986bf1 | 23 | reset = 1; |
andreixc | 0:265e6a986bf1 | 24 | wait(2.0); |
andreixc | 0:265e6a986bf1 | 25 | pc.printf("mbed boot up... \r\n"); |
andreixc | 0:265e6a986bf1 | 26 | |
andreixc | 0:265e6a986bf1 | 27 | start_serial_bus(); |
andreixc | 0:265e6a986bf1 | 28 | |
andreixc | 0:265e6a986bf1 | 29 | while(1) |
andreixc | 0:265e6a986bf1 | 30 | { |
andreixc | 0:265e6a986bf1 | 31 | Thread::wait(100); |
andreixc | 0:265e6a986bf1 | 32 | } |
andreixc | 0:265e6a986bf1 | 33 | } |