Chris Pearce / can_test
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CAN_stack.cpp Source File

CAN_stack.cpp

00001 #include "CAN_stack.h"
00002 
00003 extern DigitalOut* myled;
00004 
00005 CAN_stack::CAN_stack(CAN* can_int)
00006 {
00007     adapter=can_int;
00008     adapter->attach(this, &CAN_stack::can_callback);
00009 }
00010 
00011 void CAN_stack::poll (void)
00012 {
00013     /*
00014         pop fifo and do stuff        
00015     */ 
00016 }
00017 
00018 void CAN_stack::can_callback ( void )
00019 {
00020     if (myled->read())
00021     {
00022          myled->write(0);
00023     } 
00024     
00025     else
00026     {
00027          myled->write(1);
00028     } 
00029     
00030     CANMessage msg;
00031     adapter->read(msg);
00032     
00033     /*
00034         push msg to fifo etc
00035     */
00036 }