PicoLowLevel
mcp2515.h
Go to the documentation of this file.
1 #ifndef _MCP2515_H_
2 #define _MCP2515_H_
3 
4 #include <SPI.h>
5 #include "can.h"
6 
7 /*
8  * Speed 8M
9  */
10 #define MCP_8MHz_1000kBPS_CFG1 (0x00)
11 #define MCP_8MHz_1000kBPS_CFG2 (0x80)
12 #define MCP_8MHz_1000kBPS_CFG3 (0x80)
13 
14 #define MCP_8MHz_500kBPS_CFG1 (0x00)
15 #define MCP_8MHz_500kBPS_CFG2 (0x90)
16 #define MCP_8MHz_500kBPS_CFG3 (0x82)
17 
18 #define MCP_8MHz_250kBPS_CFG1 (0x00)
19 #define MCP_8MHz_250kBPS_CFG2 (0xB1)
20 #define MCP_8MHz_250kBPS_CFG3 (0x85)
21 
22 #define MCP_8MHz_200kBPS_CFG1 (0x00)
23 #define MCP_8MHz_200kBPS_CFG2 (0xB4)
24 #define MCP_8MHz_200kBPS_CFG3 (0x86)
25 
26 #define MCP_8MHz_125kBPS_CFG1 (0x01)
27 #define MCP_8MHz_125kBPS_CFG2 (0xB1)
28 #define MCP_8MHz_125kBPS_CFG3 (0x85)
29 
30 #define MCP_8MHz_100kBPS_CFG1 (0x01)
31 #define MCP_8MHz_100kBPS_CFG2 (0xB4)
32 #define MCP_8MHz_100kBPS_CFG3 (0x86)
33 
34 #define MCP_8MHz_80kBPS_CFG1 (0x01)
35 #define MCP_8MHz_80kBPS_CFG2 (0xBF)
36 #define MCP_8MHz_80kBPS_CFG3 (0x87)
37 
38 #define MCP_8MHz_50kBPS_CFG1 (0x03)
39 #define MCP_8MHz_50kBPS_CFG2 (0xB4)
40 #define MCP_8MHz_50kBPS_CFG3 (0x86)
41 
42 #define MCP_8MHz_40kBPS_CFG1 (0x03)
43 #define MCP_8MHz_40kBPS_CFG2 (0xBF)
44 #define MCP_8MHz_40kBPS_CFG3 (0x87)
45 
46 #define MCP_8MHz_33k3BPS_CFG1 (0x47)
47 #define MCP_8MHz_33k3BPS_CFG2 (0xE2)
48 #define MCP_8MHz_33k3BPS_CFG3 (0x85)
49 
50 #define MCP_8MHz_31k25BPS_CFG1 (0x07)
51 #define MCP_8MHz_31k25BPS_CFG2 (0xA4)
52 #define MCP_8MHz_31k25BPS_CFG3 (0x84)
53 
54 #define MCP_8MHz_20kBPS_CFG1 (0x07)
55 #define MCP_8MHz_20kBPS_CFG2 (0xBF)
56 #define MCP_8MHz_20kBPS_CFG3 (0x87)
57 
58 #define MCP_8MHz_10kBPS_CFG1 (0x0F)
59 #define MCP_8MHz_10kBPS_CFG2 (0xBF)
60 #define MCP_8MHz_10kBPS_CFG3 (0x87)
61 
62 #define MCP_8MHz_5kBPS_CFG1 (0x1F)
63 #define MCP_8MHz_5kBPS_CFG2 (0xBF)
64 #define MCP_8MHz_5kBPS_CFG3 (0x87)
65 
66 /*
67  * speed 16M
68  */
69 #define MCP_16MHz_1000kBPS_CFG1 (0x00)
70 #define MCP_16MHz_1000kBPS_CFG2 (0xD0)
71 #define MCP_16MHz_1000kBPS_CFG3 (0x82)
72 
73 #define MCP_16MHz_500kBPS_CFG1 (0x00)
74 #define MCP_16MHz_500kBPS_CFG2 (0xF0)
75 #define MCP_16MHz_500kBPS_CFG3 (0x86)
76 
77 #define MCP_16MHz_250kBPS_CFG1 (0x41)
78 #define MCP_16MHz_250kBPS_CFG2 (0xF1)
79 #define MCP_16MHz_250kBPS_CFG3 (0x85)
80 
81 #define MCP_16MHz_200kBPS_CFG1 (0x01)
82 #define MCP_16MHz_200kBPS_CFG2 (0xFA)
83 #define MCP_16MHz_200kBPS_CFG3 (0x87)
84 
85 #define MCP_16MHz_125kBPS_CFG1 (0x03)
86 #define MCP_16MHz_125kBPS_CFG2 (0xF0)
87 #define MCP_16MHz_125kBPS_CFG3 (0x86)
88 
89 #define MCP_16MHz_100kBPS_CFG1 (0x03)
90 #define MCP_16MHz_100kBPS_CFG2 (0xFA)
91 #define MCP_16MHz_100kBPS_CFG3 (0x87)
92 
93 #define MCP_16MHz_95kBPS_CFG1 (0x03)
94 #define MCP_16MHz_95kBPS_CFG2 (0xAD)
95 #define MCP_16MHz_95kBPS_CFG3 (0x07)
96 
97 #define MCP_16MHz_83k3BPS_CFG1 (0x03)
98 #define MCP_16MHz_83k3BPS_CFG2 (0xBE)
99 #define MCP_16MHz_83k3BPS_CFG3 (0x07)
100 
101 #define MCP_16MHz_80kBPS_CFG1 (0x03)
102 #define MCP_16MHz_80kBPS_CFG2 (0xFF)
103 #define MCP_16MHz_80kBPS_CFG3 (0x87)
104 
105 #define MCP_16MHz_50kBPS_CFG1 (0x07)
106 #define MCP_16MHz_50kBPS_CFG2 (0xFA)
107 #define MCP_16MHz_50kBPS_CFG3 (0x87)
108 
109 #define MCP_16MHz_40kBPS_CFG1 (0x07)
110 #define MCP_16MHz_40kBPS_CFG2 (0xFF)
111 #define MCP_16MHz_40kBPS_CFG3 (0x87)
112 
113 #define MCP_16MHz_33k3BPS_CFG1 (0x4E)
114 #define MCP_16MHz_33k3BPS_CFG2 (0xF1)
115 #define MCP_16MHz_33k3BPS_CFG3 (0x85)
116 
117 #define MCP_16MHz_20kBPS_CFG1 (0x0F)
118 #define MCP_16MHz_20kBPS_CFG2 (0xFF)
119 #define MCP_16MHz_20kBPS_CFG3 (0x87)
120 
121 #define MCP_16MHz_10kBPS_CFG1 (0x1F)
122 #define MCP_16MHz_10kBPS_CFG2 (0xFF)
123 #define MCP_16MHz_10kBPS_CFG3 (0x87)
124 
125 #define MCP_16MHz_5kBPS_CFG1 (0x3F)
126 #define MCP_16MHz_5kBPS_CFG2 (0xFF)
127 #define MCP_16MHz_5kBPS_CFG3 (0x87)
128 
129 /*
130  * speed 20M
131  */
132 #define MCP_20MHz_1000kBPS_CFG1 (0x00)
133 #define MCP_20MHz_1000kBPS_CFG2 (0xD9)
134 #define MCP_20MHz_1000kBPS_CFG3 (0x82)
135 
136 #define MCP_20MHz_500kBPS_CFG1 (0x00)
137 #define MCP_20MHz_500kBPS_CFG2 (0xFA)
138 #define MCP_20MHz_500kBPS_CFG3 (0x87)
139 
140 #define MCP_20MHz_250kBPS_CFG1 (0x41)
141 #define MCP_20MHz_250kBPS_CFG2 (0xFB)
142 #define MCP_20MHz_250kBPS_CFG3 (0x86)
143 
144 #define MCP_20MHz_200kBPS_CFG1 (0x01)
145 #define MCP_20MHz_200kBPS_CFG2 (0xFF)
146 #define MCP_20MHz_200kBPS_CFG3 (0x87)
147 
148 #define MCP_20MHz_125kBPS_CFG1 (0x03)
149 #define MCP_20MHz_125kBPS_CFG2 (0xFA)
150 #define MCP_20MHz_125kBPS_CFG3 (0x87)
151 
152 #define MCP_20MHz_100kBPS_CFG1 (0x04)
153 #define MCP_20MHz_100kBPS_CFG2 (0xFA)
154 #define MCP_20MHz_100kBPS_CFG3 (0x87)
155 
156 #define MCP_20MHz_83k3BPS_CFG1 (0x04)
157 #define MCP_20MHz_83k3BPS_CFG2 (0xFE)
158 #define MCP_20MHz_83k3BPS_CFG3 (0x87)
159 
160 #define MCP_20MHz_80kBPS_CFG1 (0x04)
161 #define MCP_20MHz_80kBPS_CFG2 (0xFF)
162 #define MCP_20MHz_80kBPS_CFG3 (0x87)
163 
164 #define MCP_20MHz_50kBPS_CFG1 (0x09)
165 #define MCP_20MHz_50kBPS_CFG2 (0xFA)
166 #define MCP_20MHz_50kBPS_CFG3 (0x87)
167 
168 #define MCP_20MHz_40kBPS_CFG1 (0x09)
169 #define MCP_20MHz_40kBPS_CFG2 (0xFF)
170 #define MCP_20MHz_40kBPS_CFG3 (0x87)
171 
172 #define MCP_20MHz_33k3BPS_CFG1 (0x0B)
173 #define MCP_20MHz_33k3BPS_CFG2 (0xFF)
174 #define MCP_20MHz_33k3BPS_CFG3 (0x87)
175 
176 enum CAN_CLOCK {
179  MCP_8MHZ
180 };
181 
182 enum CAN_SPEED {
199 };
200 
203  CLKOUT_DIV1 = 0x0,
204  CLKOUT_DIV2 = 0x1,
205  CLKOUT_DIV4 = 0x2,
206  CLKOUT_DIV8 = 0x3,
207 };
208 
209 class MCP2515
210 {
211  public:
212  enum ERROR {
213  ERROR_OK = 0,
218  ERROR_NOMSG = 5
219  };
220 
221  enum MASK {
223  MASK1
224  };
225 
226  enum RXF {
227  RXF0 = 0,
228  RXF1 = 1,
229  RXF2 = 2,
230  RXF3 = 3,
231  RXF4 = 4,
232  RXF5 = 5
233  };
234 
235  enum RXBn {
236  RXB0 = 0,
237  RXB1 = 1
238  };
239 
240  enum TXBn {
241  TXB0 = 0,
242  TXB1 = 1,
243  TXB2 = 2
244  };
245 
246  enum /*class*/ CANINTF : uint8_t {
254  CANINTF_MERRF = 0x80
255  };
256 
257  enum /*class*/ EFLG : uint8_t {
258  EFLG_RX1OVR = (1<<7),
259  EFLG_RX0OVR = (1<<6),
260  EFLG_TXBO = (1<<5),
261  EFLG_TXEP = (1<<4),
262  EFLG_RXEP = (1<<3),
263  EFLG_TXWAR = (1<<2),
264  EFLG_RXWAR = (1<<1),
265  EFLG_EWARN = (1<<0)
266  };
267 
268  private:
269  static const uint8_t CANCTRL_REQOP = 0xE0;
270  static const uint8_t CANCTRL_ABAT = 0x10;
271  static const uint8_t CANCTRL_OSM = 0x08;
272  static const uint8_t CANCTRL_CLKEN = 0x04;
273  static const uint8_t CANCTRL_CLKPRE = 0x03;
274 
275  enum /*class*/ CANCTRL_REQOP_MODE : uint8_t {
276  CANCTRL_REQOP_NORMAL = 0x00,
277  CANCTRL_REQOP_SLEEP = 0x20,
278  CANCTRL_REQOP_LOOPBACK = 0x40,
279  CANCTRL_REQOP_LISTENONLY = 0x60,
280  CANCTRL_REQOP_CONFIG = 0x80,
281  CANCTRL_REQOP_POWERUP = 0xE0
282  };
283 
284  static const uint8_t CANSTAT_OPMOD = 0xE0;
285  static const uint8_t CANSTAT_ICOD = 0x0E;
286 
287  static const uint8_t CNF3_SOF = 0x80;
288 
289  static const uint8_t TXB_EXIDE_MASK = 0x08;
290  static const uint8_t DLC_MASK = 0x0F;
291  static const uint8_t RTR_MASK = 0x40;
292 
293  static const uint8_t RXBnCTRL_RXM_STD = 0x20;
294  static const uint8_t RXBnCTRL_RXM_EXT = 0x40;
295  static const uint8_t RXBnCTRL_RXM_STDEXT = 0x00;
296  static const uint8_t RXBnCTRL_RXM_MASK = 0x60;
297  static const uint8_t RXBnCTRL_RTR = 0x08;
298  static const uint8_t RXB0CTRL_BUKT = 0x04;
299  static const uint8_t RXB0CTRL_FILHIT_MASK = 0x03;
300  static const uint8_t RXB1CTRL_FILHIT_MASK = 0x07;
301  static const uint8_t RXB0CTRL_FILHIT = 0x00;
302  static const uint8_t RXB1CTRL_FILHIT = 0x01;
303 
304  static const uint8_t MCP_SIDH = 0;
305  static const uint8_t MCP_SIDL = 1;
306  static const uint8_t MCP_EID8 = 2;
307  static const uint8_t MCP_EID0 = 3;
308  static const uint8_t MCP_DLC = 4;
309  static const uint8_t MCP_DATA = 5;
310 
311  enum /*class*/ STAT : uint8_t {
312  STAT_RX0IF = (1<<0),
313  STAT_RX1IF = (1<<1)
314  };
315 
316  static const uint8_t STAT_RXIF_MASK = STAT_RX0IF | STAT_RX1IF;
317 
318  enum /*class*/ TXBnCTRL : uint8_t {
319  TXB_ABTF = 0x40,
320  TXB_MLOA = 0x20,
321  TXB_TXERR = 0x10,
322  TXB_TXREQ = 0x08,
323  TXB_TXIE = 0x04,
324  TXB_TXP = 0x03
325  };
326 
327  static const uint8_t EFLG_ERRORMASK = EFLG_RX1OVR
328  | EFLG_RX0OVR
329  | EFLG_TXBO
330  | EFLG_TXEP
331  | EFLG_RXEP;
332 
333  enum /*class*/ INSTRUCTION : uint8_t {
334  INSTRUCTION_WRITE = 0x02,
335  INSTRUCTION_READ = 0x03,
336  INSTRUCTION_BITMOD = 0x05,
337  INSTRUCTION_LOAD_TX0 = 0x40,
338  INSTRUCTION_LOAD_TX1 = 0x42,
339  INSTRUCTION_LOAD_TX2 = 0x44,
340  INSTRUCTION_RTS_TX0 = 0x81,
341  INSTRUCTION_RTS_TX1 = 0x82,
342  INSTRUCTION_RTS_TX2 = 0x84,
343  INSTRUCTION_RTS_ALL = 0x87,
344  INSTRUCTION_READ_RX0 = 0x90,
345  INSTRUCTION_READ_RX1 = 0x94,
346  INSTRUCTION_READ_STATUS = 0xA0,
347  INSTRUCTION_RX_STATUS = 0xB0,
348  INSTRUCTION_RESET = 0xC0
349  };
350 
351  enum /*class*/ REGISTER : uint8_t {
352  MCP_RXF0SIDH = 0x00,
353  MCP_RXF0SIDL = 0x01,
354  MCP_RXF0EID8 = 0x02,
355  MCP_RXF0EID0 = 0x03,
356  MCP_RXF1SIDH = 0x04,
357  MCP_RXF1SIDL = 0x05,
358  MCP_RXF1EID8 = 0x06,
359  MCP_RXF1EID0 = 0x07,
360  MCP_RXF2SIDH = 0x08,
361  MCP_RXF2SIDL = 0x09,
362  MCP_RXF2EID8 = 0x0A,
363  MCP_RXF2EID0 = 0x0B,
364  MCP_CANSTAT = 0x0E,
365  MCP_CANCTRL = 0x0F,
366  MCP_RXF3SIDH = 0x10,
367  MCP_RXF3SIDL = 0x11,
368  MCP_RXF3EID8 = 0x12,
369  MCP_RXF3EID0 = 0x13,
370  MCP_RXF4SIDH = 0x14,
371  MCP_RXF4SIDL = 0x15,
372  MCP_RXF4EID8 = 0x16,
373  MCP_RXF4EID0 = 0x17,
374  MCP_RXF5SIDH = 0x18,
375  MCP_RXF5SIDL = 0x19,
376  MCP_RXF5EID8 = 0x1A,
377  MCP_RXF5EID0 = 0x1B,
378  MCP_TEC = 0x1C,
379  MCP_REC = 0x1D,
380  MCP_RXM0SIDH = 0x20,
381  MCP_RXM0SIDL = 0x21,
382  MCP_RXM0EID8 = 0x22,
383  MCP_RXM0EID0 = 0x23,
384  MCP_RXM1SIDH = 0x24,
385  MCP_RXM1SIDL = 0x25,
386  MCP_RXM1EID8 = 0x26,
387  MCP_RXM1EID0 = 0x27,
388  MCP_CNF3 = 0x28,
389  MCP_CNF2 = 0x29,
390  MCP_CNF1 = 0x2A,
391  MCP_CANINTE = 0x2B,
392  MCP_CANINTF = 0x2C,
393  MCP_EFLG = 0x2D,
394  MCP_TXB0CTRL = 0x30,
395  MCP_TXB0SIDH = 0x31,
396  MCP_TXB0SIDL = 0x32,
397  MCP_TXB0EID8 = 0x33,
398  MCP_TXB0EID0 = 0x34,
399  MCP_TXB0DLC = 0x35,
400  MCP_TXB0DATA = 0x36,
401  MCP_TXB1CTRL = 0x40,
402  MCP_TXB1SIDH = 0x41,
403  MCP_TXB1SIDL = 0x42,
404  MCP_TXB1EID8 = 0x43,
405  MCP_TXB1EID0 = 0x44,
406  MCP_TXB1DLC = 0x45,
407  MCP_TXB1DATA = 0x46,
408  MCP_TXB2CTRL = 0x50,
409  MCP_TXB2SIDH = 0x51,
410  MCP_TXB2SIDL = 0x52,
411  MCP_TXB2EID8 = 0x53,
412  MCP_TXB2EID0 = 0x54,
413  MCP_TXB2DLC = 0x55,
414  MCP_TXB2DATA = 0x56,
415  MCP_RXB0CTRL = 0x60,
416  MCP_RXB0SIDH = 0x61,
417  MCP_RXB0SIDL = 0x62,
418  MCP_RXB0EID8 = 0x63,
419  MCP_RXB0EID0 = 0x64,
420  MCP_RXB0DLC = 0x65,
421  MCP_RXB0DATA = 0x66,
422  MCP_RXB1CTRL = 0x70,
423  MCP_RXB1SIDH = 0x71,
424  MCP_RXB1SIDL = 0x72,
425  MCP_RXB1EID8 = 0x73,
426  MCP_RXB1EID0 = 0x74,
427  MCP_RXB1DLC = 0x75,
428  MCP_RXB1DATA = 0x76
429  };
430 
431  static const uint32_t DEFAULT_SPI_CLOCK = 10000000; // 10MHz
432 
433  static const int N_TXBUFFERS = 3;
434  static const int N_RXBUFFERS = 2;
435 
436  static const struct TXBn_REGS {
437  REGISTER CTRL;
438  REGISTER SIDH;
439  REGISTER DATA;
440  } TXB[N_TXBUFFERS];
441 
442  static const struct RXBn_REGS {
443  REGISTER CTRL;
444  REGISTER SIDH;
445  REGISTER DATA;
446  CANINTF CANINTF_RXnIF;
447  } RXB[N_RXBUFFERS];
448 
449  uint8_t SPICS;
450  uint32_t SPI_CLOCK;
451  SPIClass * SPIn;
452 
453  private:
454 
455  void startSPI();
456  void endSPI();
457 
458  ERROR setMode(const CANCTRL_REQOP_MODE mode);
459 
460  uint8_t readRegister(const REGISTER reg);
461  void readRegisters(const REGISTER reg, uint8_t values[], const uint8_t n);
462  void setRegister(const REGISTER reg, const uint8_t value);
463  void setRegisters(const REGISTER reg, const uint8_t values[], const uint8_t n);
464  void modifyRegister(const REGISTER reg, const uint8_t mask, const uint8_t data);
465 
466  void prepareId(uint8_t *buffer, const bool ext, const uint32_t id);
467 
468  public:
469  MCP2515(const uint8_t _CS, const uint32_t _SPI_CLOCK = DEFAULT_SPI_CLOCK, SPIClass * _SPI = nullptr);
470  ERROR reset(void);
476  ERROR setClkOut(const CAN_CLKOUT divisor);
477  ERROR setBitrate(const CAN_SPEED canSpeed);
478  ERROR setBitrate(const CAN_SPEED canSpeed, const CAN_CLOCK canClock);
479  ERROR setFilterMask(const MASK num, const bool ext, const uint32_t ulData);
480  ERROR setFilter(const RXF num, const bool ext, const uint32_t ulData);
481  ERROR sendMessage(const TXBn txbn, const struct can_frame *frame);
482  ERROR sendMessage(const struct can_frame *frame);
483  ERROR readMessage(const RXBn rxbn, struct can_frame *frame);
484  ERROR readMessage(struct can_frame *frame);
485  bool checkReceive(void);
486  bool checkError(void);
487  uint8_t getErrorFlags(void);
488  void clearRXnOVRFlags(void);
489  uint8_t getInterrupts(void);
490  uint8_t getInterruptMask(void);
491  void clearInterrupts(void);
492  void clearTXInterrupts(void);
493  uint8_t getStatus(void);
494  void clearRXnOVR(void);
495  void clearMERR();
496  void clearERRIF();
497  uint8_t errorCountRX(void);
498  uint8_t errorCountTX(void);
499 };
500 
501 #endif
CAN_CLKOUT
Definition: mcp2515.h:201
@ CLKOUT_DIV1
Definition: mcp2515.h:203
@ CLKOUT_DIV2
Definition: mcp2515.h:204
@ CLKOUT_DIV8
Definition: mcp2515.h:206
@ CLKOUT_DISABLE
Definition: mcp2515.h:202
@ CLKOUT_DIV4
Definition: mcp2515.h:205
CAN_SPEED
Definition: mcp2515.h:182
@ CAN_500KBPS
Definition: mcp2515.h:197
@ CAN_5KBPS
Definition: mcp2515.h:183
@ CAN_50KBPS
Definition: mcp2515.h:189
@ CAN_83K3BPS
Definition: mcp2515.h:191
@ CAN_125KBPS
Definition: mcp2515.h:194
@ CAN_200KBPS
Definition: mcp2515.h:195
@ CAN_1000KBPS
Definition: mcp2515.h:198
@ CAN_20KBPS
Definition: mcp2515.h:185
@ CAN_95KBPS
Definition: mcp2515.h:192
@ CAN_40KBPS
Definition: mcp2515.h:188
@ CAN_33KBPS
Definition: mcp2515.h:187
@ CAN_100KBPS
Definition: mcp2515.h:193
@ CAN_31K25BPS
Definition: mcp2515.h:186
@ CAN_80KBPS
Definition: mcp2515.h:190
@ CAN_250KBPS
Definition: mcp2515.h:196
@ CAN_10KBPS
Definition: mcp2515.h:184
CAN_CLOCK
Definition: mcp2515.h:176
@ MCP_20MHZ
Definition: mcp2515.h:177
@ MCP_8MHZ
Definition: mcp2515.h:179
@ MCP_16MHZ
Definition: mcp2515.h:178
Definition: mcp2515.cpp:4
MCP2515(const uint8_t _CS, const uint32_t _SPI_CLOCK=DEFAULT_SPI_CLOCK, SPIClass *_SPI=nullptr)
Definition: mcp2515.cpp:15
void clearTXInterrupts(void)
Definition: mcp2515.cpp:736
ERROR setBitrate(const CAN_SPEED canSpeed)
Definition: mcp2515.cpp:196
void clearRXnOVRFlags(void)
Definition: mcp2515.cpp:716
ERROR sendMessage(const TXBn txbn, const struct can_frame *frame)
Definition: mcp2515.cpp:587
uint8_t errorCountRX(void)
Definition: mcp2515.cpp:766
uint8_t getErrorFlags(void)
Definition: mcp2515.cpp:711
void clearERRIF()
Definition: mcp2515.cpp:759
CANINTF
Definition: mcp2515.h:246
@ CANINTF_TX2IF
Definition: mcp2515.h:251
@ CANINTF_TX0IF
Definition: mcp2515.h:249
@ CANINTF_ERRIF
Definition: mcp2515.h:252
@ CANINTF_RX0IF
Definition: mcp2515.h:247
@ CANINTF_TX1IF
Definition: mcp2515.h:250
@ CANINTF_MERRF
Definition: mcp2515.h:254
@ CANINTF_WAKIF
Definition: mcp2515.h:253
@ CANINTF_RX1IF
Definition: mcp2515.h:248
ERROR setFilterMask(const MASK num, const bool ext, const uint32_t ulData)
Definition: mcp2515.cpp:537
RXBn
Definition: mcp2515.h:235
@ RXB1
Definition: mcp2515.h:237
@ RXB0
Definition: mcp2515.h:236
ERROR setListenOnlyMode()
Definition: mcp2515.cpp:155
TXBn
Definition: mcp2515.h:240
@ TXB1
Definition: mcp2515.h:242
@ TXB0
Definition: mcp2515.h:241
@ TXB2
Definition: mcp2515.h:243
uint8_t getStatus(void)
Definition: mcp2515.cpp:140
ERROR readMessage(const RXBn rxbn, struct can_frame *frame)
Definition: mcp2515.cpp:637
bool checkReceive(void)
Definition: mcp2515.cpp:690
MASK
Definition: mcp2515.h:221
@ MASK0
Definition: mcp2515.h:222
@ MASK1
Definition: mcp2515.h:223
void clearInterrupts(void)
Definition: mcp2515.cpp:726
RXF
Definition: mcp2515.h:226
@ RXF1
Definition: mcp2515.h:228
@ RXF5
Definition: mcp2515.h:232
@ RXF2
Definition: mcp2515.h:229
@ RXF0
Definition: mcp2515.h:227
@ RXF3
Definition: mcp2515.h:230
@ RXF4
Definition: mcp2515.h:231
bool checkError(void)
Definition: mcp2515.cpp:700
EFLG
Definition: mcp2515.h:257
@ EFLG_RXEP
Definition: mcp2515.h:262
@ EFLG_TXWAR
Definition: mcp2515.h:263
@ EFLG_EWARN
Definition: mcp2515.h:265
@ EFLG_TXBO
Definition: mcp2515.h:260
@ EFLG_RX1OVR
Definition: mcp2515.h:258
@ EFLG_TXEP
Definition: mcp2515.h:261
@ EFLG_RX0OVR
Definition: mcp2515.h:259
@ EFLG_RXWAR
Definition: mcp2515.h:264
void clearMERR()
Definition: mcp2515.cpp:752
ERROR setFilter(const RXF num, const bool ext, const uint32_t ulData)
Definition: mcp2515.cpp:560
ERROR setConfigMode()
Definition: mcp2515.cpp:150
ERROR setNormalMode()
Definition: mcp2515.cpp:170
ERROR setClkOut(const CAN_CLKOUT divisor)
Definition: mcp2515.cpp:495
ERROR reset(void)
Definition: mcp2515.cpp:40
void clearRXnOVR(void)
Definition: mcp2515.cpp:741
ERROR setLoopbackMode()
Definition: mcp2515.cpp:165
uint8_t getInterruptMask(void)
Definition: mcp2515.cpp:731
ERROR
Definition: mcp2515.h:212
@ ERROR_ALLTXBUSY
Definition: mcp2515.h:215
@ ERROR_FAILINIT
Definition: mcp2515.h:216
@ ERROR_FAIL
Definition: mcp2515.h:214
@ ERROR_FAILTX
Definition: mcp2515.h:217
@ ERROR_OK
Definition: mcp2515.h:213
@ ERROR_NOMSG
Definition: mcp2515.h:218
uint8_t errorCountTX(void)
Definition: mcp2515.cpp:771
ERROR setSleepMode()
Definition: mcp2515.cpp:160
uint8_t getInterrupts(void)
Definition: mcp2515.cpp:721
Definition: can.h:39