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. Master unit.

Dependencies:   mbed

main.cpp

Committer:
ggudgel
Date:
2014-10-31
Revision:
0:855b6e84e744

File content as of revision 0:855b6e84e744:

#include "mbed.h"
#include "spiMasterProtocol.h"

// https://developer.mbed.org/forum/helloworld/topic/2541/

Serial pc(USBTX, USBRX); // tx, rx

int main() {
    spiMasterProtocol* canDevice = new spiMasterProtocol();
 
    pc.printf("======================================================\r\n");
    pc.printf("Press any key to start...\r\n");
    pc.getc(); // wait for keyboard
 
    while (1) {
 
        canDevice->get42();
        
        wait(0.5); // Wait for 5 seconds for readability only
        
        canDevice->get84();
        
        wait(0.5);
        
    }
}