Demonstration of CPP error in CAN attach - fixed

CAN_stack.cpp

Committer:
chrispearce1972
Date:
2011-08-02
Revision:
1:acbf76e0e272
Parent:
0:cd47a82f15aa

File content as of revision 1:acbf76e0e272:

#include "CAN_stack.h"

extern DigitalOut* myled;

CAN_stack::CAN_stack(CAN* can_int)
{
    adapter=can_int;
    adapter->attach(this, &CAN_stack::can_callback);
}

void CAN_stack::poll (void)
{
    /*
        pop fifo and do stuff        
    */ 
}

void CAN_stack::can_callback ( void )
{
    if (myled->read())
    {
         myled->write(0);
    } 
    
    else
    {
         myled->write(1);
    } 
    
    CANMessage msg;
    adapter->read(msg);
    
    /*
        push msg to fifo etc
    */
}