Each LPC1768 is capable of controlling 2 CAN bus lines. Linking multiple chips together via SPI allows for more bus lines to be monitored simultaneously. Slave unit.
main.cpp@0:a46303f3277c, 2014-10-31 (annotated)
- Committer:
- ggudgel
- Date:
- Fri Oct 31 22:14:03 2014 +0000
- Revision:
- 0:a46303f3277c
First working revision. Test functionality of one mbed system controlling another through SPI, while utilizing CAN bus lines.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ggudgel | 0:a46303f3277c | 1 | #include "mbed.h" |
ggudgel | 0:a46303f3277c | 2 | #include "rtos.h" |
ggudgel | 0:a46303f3277c | 3 | #include "spiSlaveProtocol.h" |
ggudgel | 0:a46303f3277c | 4 | #include "CAN_thread.h" |
ggudgel | 0:a46303f3277c | 5 | |
ggudgel | 0:a46303f3277c | 6 | int main() { |
ggudgel | 0:a46303f3277c | 7 | Thread thread(CAN_thread); |
ggudgel | 0:a46303f3277c | 8 | |
ggudgel | 0:a46303f3277c | 9 | |
ggudgel | 0:a46303f3277c | 10 | Serial* pc = new Serial(USBTX, USBRX); // tx, rx |
ggudgel | 0:a46303f3277c | 11 | |
ggudgel | 0:a46303f3277c | 12 | spiSlaveProtocol* device = new spiSlaveProtocol(pc); |
ggudgel | 0:a46303f3277c | 13 | while (1) { |
ggudgel | 0:a46303f3277c | 14 | device->run(); |
ggudgel | 0:a46303f3277c | 15 | } |
ggudgel | 0:a46303f3277c | 16 | } |