MSCAN Updated
Fork of MSCAN by
Revision 6:c857749f9c0c, committed 2013-03-06
- Comitter:
- veskokaradzhov
- Date:
- Wed Mar 06 17:33:14 2013 +0000
- Parent:
- 5:55a074984183
- Commit message:
- c
Changed in this revision
CANComms.cpp | Show annotated file Show diff for this revision Revisions of this file |
CANComms.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/CANComms.cpp Fri Mar 01 12:41:08 2013 +0000 +++ b/CANComms.cpp Wed Mar 06 17:33:14 2013 +0000 @@ -4,21 +4,23 @@ #include "MSCANHeader.h" -CANComms::CANComms(State* _values, bool poll, float poll_interval) : Comms(_values) +CANComms::CANComms(State* _values, bool transmit_poll, bool receive_poll, float poll_interval) : Comms(_values) { + + can = new CAN(p30, p29); can->frequency(500000); pollTicker = new Ticker(); readTicker = new Ticker(); - if(poll) { + if(transmit_poll) { pollTicker->attach(this, &CANComms::poll, 0.05); } - - can->attach(this, &CANComms::receive); + if (receive_poll) { + can->attach(this, &CANComms::receive); + } } - void CANComms::poll() { char i;
--- a/CANComms.h Fri Mar 01 12:41:08 2013 +0000 +++ b/CANComms.h Wed Mar 06 17:33:14 2013 +0000 @@ -8,15 +8,15 @@ class CANComms : public Comms { public: - CANComms(State* _values, bool poll, float poll_interval); - virtual void send(char message); + CANComms(State* _values, bool transmit_poll, bool receive_poll, float poll_interval); + virtual void send(char message); + void receive(); + CAN* can; private: Ticker* pollTicker; Ticker* readTicker; - CAN* can; - - void receive(); + void poll(); };