Basic can interface class.
CANInterface.h@1:abf508583871, 2014-04-30 (annotated)
- Committer:
- ashleymills
- Date:
- Wed Apr 30 15:30:46 2014 +0000
- Revision:
- 1:abf508583871
- Parent:
- 0:1ce2190bc4d2
Fixed return value in makeRequest
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ashleymills | 0:1ce2190bc4d2 | 1 | #pragma once |
ashleymills | 0:1ce2190bc4d2 | 2 | #include "mbed.h" |
ashleymills | 0:1ce2190bc4d2 | 3 | |
ashleymills | 0:1ce2190bc4d2 | 4 | class CANInterface { |
ashleymills | 0:1ce2190bc4d2 | 5 | public: |
ashleymills | 0:1ce2190bc4d2 | 6 | enum BusSpeed { |
ashleymills | 0:1ce2190bc4d2 | 7 | CAN_SPEED_125=125000, |
ashleymills | 0:1ce2190bc4d2 | 8 | CAN_SPEED_250=250000, |
ashleymills | 0:1ce2190bc4d2 | 9 | CAN_SPEED_500=500000 |
ashleymills | 0:1ce2190bc4d2 | 10 | }; |
ashleymills | 0:1ce2190bc4d2 | 11 | |
ashleymills | 0:1ce2190bc4d2 | 12 | enum MessageType { |
ashleymills | 0:1ce2190bc4d2 | 13 | CAN_PID_REQUEST=0x7DF, |
ashleymills | 0:1ce2190bc4d2 | 14 | CAN_PID_REPLY=0x7E8 |
ashleymills | 0:1ce2190bc4d2 | 15 | }; |
ashleymills | 0:1ce2190bc4d2 | 16 | |
ashleymills | 0:1ce2190bc4d2 | 17 | CANInterface(PinName rd, PinName td); |
ashleymills | 0:1ce2190bc4d2 | 18 | ~CANInterface(); |
ashleymills | 0:1ce2190bc4d2 | 19 | int makeRequest(uint8_t pid, uint8_t *outBuf, int *outLen); |
ashleymills | 0:1ce2190bc4d2 | 20 | |
ashleymills | 0:1ce2190bc4d2 | 21 | private: |
ashleymills | 0:1ce2190bc4d2 | 22 | CAN *_can; |
ashleymills | 0:1ce2190bc4d2 | 23 | Timer *_timer; |
ashleymills | 0:1ce2190bc4d2 | 24 | int _timeout; |
ashleymills | 0:1ce2190bc4d2 | 25 | }; |