31 #define MCP2515_MAX_PAYLOAD_DATA (8) 36 #define MCP2515_MAX_PKT_DATA (13) 39 #define MCP2515_PKT_SIDH (0) 40 #define MCP2515_PKT_SIDL (1) 41 #define MCP2515_PKT_EID8 (2) 42 #define MCP2515_PKT_EID0 (3) 43 #define MCP2515_PKT_DLC (4) 44 #define MCP2515_PKT_D0 (5) 45 #define MCP2515_PKT_D1 (6) 46 #define MCP2515_PKT_D2 (7) 47 #define MCP2515_PKT_D3 (8) 48 #define MCP2515_PKT_D4 (9) 49 #define MCP2515_PKT_D5 (10) 50 #define MCP2515_PKT_D6 (11) 51 #define MCP2515_PKT_D7 (12) 54 #define MCP2515_MAX_ID_BYTES (4) 60 uint8_t data[MCP2515_MAX_ID_BYTES];
72 uint8_t data[MCP2515_MAX_PKT_DATA];
107 MCP2515_REG_FILTER0 = 0x00,
108 MCP2515_REG_FILTER1 = 0x04,
110 MCP2515_REG_FILTER2 = 0x08,
111 MCP2515_REG_FILTER3 = 0x10,
112 MCP2515_REG_FILTER4 = 0x14,
113 MCP2515_REG_FILTER5 = 0x18,
119 MCP2515_REG_MASK0 = 0x20,
121 MCP2515_REG_MASK1 = 0x24,
123 MCP2515_REG_BFPCTL = 0x0c,
124 MCP2515_REG_TXRTSCTRL = 0x0d,
132 MCP2515_REG_CANSTAT = 0x0e,
133 MCP2515_REG_CANSTAT_0 = 0x0e,
135 MCP2515_REG_CANSTAT_1 = 0x1e,
136 MCP2515_REG_CANSTAT_2 = 0x2e,
137 MCP2515_REG_CANSTAT_3 = 0x3e,
138 MCP2515_REG_CANSTAT_4 = 0x4e,
139 MCP2515_REG_CANSTAT_5 = 0x5e,
140 MCP2515_REG_CANSTAT_6 = 0x6e,
141 MCP2515_REG_CANSTAT_7 = 0x7e,
144 MCP2515_REG_CANCTRL = 0x0f,
145 MCP2515_REG_CANCTRL_0 = 0x0f,
147 MCP2515_REG_CANCTRL_1 = 0x1f,
148 MCP2515_REG_CANCTRL_2 = 0x2f,
149 MCP2515_REG_CANCTRL_3 = 0x3f,
150 MCP2515_REG_CANCTRL_4 = 0x4f,
151 MCP2515_REG_CANCTRL_5 = 0x5f,
152 MCP2515_REG_CANCTRL_6 = 0x6f,
153 MCP2515_REG_CANCTRL_7 = 0x7f,
155 MCP2515_REG_TEC = 0x1c,
156 MCP2515_REG_REC = 0x1d,
158 MCP2515_REG_CNF3 = 0x28,
159 MCP2515_REG_CNF2 = 0x29,
160 MCP2515_REG_CNF1 = 0x2a,
162 MCP2515_REG_CANINTE = 0x2b,
163 MCP2515_REG_CANINTF = 0x2c,
165 MCP2515_REG_EFLG = 0x2a,
174 MCP2515_REG_TXB0CTRL = 0x30,
175 MCP2515_REG_TXB1CTRL = 0x40,
176 MCP2515_REG_TXB2CTRL = 0x50,
178 MCP2515_REG_RXB0CTRL = 0x60,
179 MCP2515_REG_RXB1CTRL = 0x70
184 MCP2515_CANCTRL_CLKPRE0 = 0x01,
185 MCP2515_CANCTRL_CLKPRE1 = 0x02,
186 _MCP2515_CANCTRL_CLKPRE_MASK = 3,
187 _MCP2515_CANCTRL_CLKPRE_SHIFT = 0,
189 MCP2515_CANCTRL_CLKEN = 0x04,
191 MCP2515_CANCTRL_OSM = 0x08,
193 MCP2515_CANCTRL_ABAT = 0x10,
195 MCP2515_CANCTRL_REQOP0 = 0x20,
196 MCP2515_CANCTRL_REQOP1 = 0x40,
197 MCP2515_CANCTRL_REQOP2 = 0x80,
198 _MCP2515_CANCTRL_REQOP_MASK = 7,
199 _MCP2515_CANCTRL_REQOP_SHIFT = 5,
200 } MCP2515_CANCTRL_BITS_T;
204 MCP2515_CLKPRE_DIV1 = 0,
205 MCP2515_CLKPRE_DIV2 = 1,
206 MCP2515_CLKPRE_DIV4 = 2,
207 MCP2515_CLKPRE_DIV8 = 3
213 MCP2515_OPMODE_NORMAL = 0,
214 MCP2515_OPMODE_SLEEP = 1,
215 MCP2515_OPMODE_LOOPBACK = 2,
216 MCP2515_OPMODE_LISTENONLY = 3,
217 MCP2515_OPMODE_CONFIG = 4
224 MCP2515_CANSTAT_ICOD0 = 0x02,
225 MCP2515_CANSTAT_ICOD1 = 0x04,
226 MCP2515_CANSTAT_ICOD2 = 0x08,
227 _MCP2515_CANSTAT_ICOD_MASK = 7,
228 _MCP2515_CANSTAT_ICOD_SHIFT = 1,
232 MCP2515_CANSTAT_OPMODE0 = 0x20,
233 MCP2515_CANSTAT_OPMODE1 = 0x40,
234 MCP2515_CANSTAT_OPMODE2 = 0x80,
235 _MCP2515_CANSTAT_OPMODE_MASK = 7,
236 _MCP2515_CANSTAT_OPMODE_SHIFT = 5,
237 } MCP2515_CANSTAT_BITS_T;
241 MCP2515_BFPCTL_B0BFM = 0x01,
242 MCP2515_BFPCTL_B1BFM = 0x02,
244 MCP2515_BFPCTL_B0BFE = 0x04,
245 MCP2515_BFPCTL_B1BFE = 0x08,
247 MCP2515_BFPCTL_B0BFS = 0x10,
248 MCP2515_BFPCTL_B1BFS = 0x20,
251 } MCP2515_BFPCTL_BITS_T;
255 MCP2515_TXRTSCTRL_B0RTSM = 0x01,
256 MCP2515_TXRTSCTRL_B1RTSM = 0x02,
257 MCP2515_TXRTSCTRL_B2RTSM = 0x04,
259 MCP2515_TXRTSCTRL_B0RTS = 0x08,
261 MCP2515_TXRTSCTRL_B1RTS = 0x10,
262 MCP2515_TXRTSCTRL_B2RTS = 0x20,
265 } MCP2515_TXRTSCTRL_BITS_T;
269 MCP2515_EFLG_EWARN = 0x01,
270 MCP2515_EFLG_RXWAR = 0x02,
271 MCP2515_EFLG_TXWAR = 0x04,
273 MCP2515_EFLG_RXEP = 0x08,
274 MCP2515_EFLG_TXEP = 0x10,
276 MCP2515_EFLG_TXBO = 0x20,
278 MCP2515_EFLG_RX0OVR = 0x40,
279 MCP2515_EFLG_RX1OVR = 0x80,
280 } MCP2515_EFLG_BITS_T;
286 MCP2515_CANINT_RX0I = 0x01,
287 MCP2515_CANINT_RX1I = 0x02,
289 MCP2515_CANINT_TX0I = 0x04,
290 MCP2515_CANINT_TX1I = 0x08,
291 MCP2515_CANINT_TX2I = 0x10,
293 MCP2515_CANINT_ERRI = 0x20,
294 MCP2515_CANINT_WAKI = 0x40,
296 MCP2515_CANINT_MERR = 0x80
297 } MCP2515_CANINT_BITS_T;
302 MCP2515_TXBCTRL_TXP0 = 0x01,
303 MCP2515_TXBCTRL_TXP1 = 0x02,
304 _MCP2515_TXBCTRL_TXP_MASK = 3,
305 _MCP2515_TXBCTRL_TXP_SHIFT = 0,
309 MCP2515_TXBCTRL_TXREQ = 0x08,
310 MCP2515_TXBCTRL_TXERR = 0x10,
311 MCP2515_TXBCTRL_MLOA = 0x20,
312 MCP2515_TXBCTRL_ABTF = 0x40
315 } MCP2515_TXBCTRL_BITS_T;
319 MCP2515_TXP_LOWEST = 0,
321 MCP2515_TXP_HIGH = 2,
322 MCP2515_TXP_HIGHEST = 3
327 MCP2515_TXBDLC_DLC0 = 0x01,
328 MCP2515_TXBDLC_DLC1 = 0x02,
329 MCP2515_TXBDLC_DLC2 = 0x04,
330 MCP2515_TXBDLC_DLC3 = 0x08,
331 _MCP2515_TXBDLC_MASK = 15,
332 _MCP2515_TXBDLC_SHIFT = 0,
336 MCP2515_TXBDLC_RTR = 0x40,
341 } MCP2515_TXBDLC_BITS_T;
345 MCP2515_RXB0CTRL_FILHIT = 0x01,
347 MCP2515_RXB0CTRL_BUKT1 = 0x02,
348 MCP2515_RXB0CTRL_BUKT = 0x04,
350 MCP2515_RXB0CTRL_RXRTR = 0x08,
354 MCP2515_RXB0CTRL_RXMODE0 = 0x20,
355 MCP2515_RXB0CTRL_RXMODE1 = 0x40,
356 _MCP2515_RXB0CTRL_RXMODE_MASK = 3,
357 _MCP2515_RXB0CTRL_RXMODE_SHIFT = 5
360 } MCP2515_RXB0CTRL_BITS_T;
366 MCP2515_RXMODE_ANY_FILTER = 0,
367 MCP2515_RXMODE_STANDARD_FILTER = 1,
368 MCP2515_RXMODE_EXTENDED_FILTER = 2,
369 MCP2515_RXMODE_ANY_NOFILTER = 3
374 MCP2515_RXB1CTRL_FILHIT0 = 0x01,
375 MCP2515_RXB1CTRL_FILHIT1 = 0x02,
376 MCP2515_RXB1CTRL_FILHIT2 = 0x04,
377 _MCP2515_RXB1CTRL_FILHIT_MASK = 7,
378 _MCP2515_RXB1CTRL_FILHIT_SHIFT = 0,
380 MCP2515_RXB1CTRL_RXRTR = 0x08,
384 MCP2515_RXB1CTRL_RXMODE0 = 0x20,
385 MCP2515_RXB1CTRL_RXMODE1 = 0x40,
386 _MCP2515_RXB1CTRL_RXMODE_MASK = 3,
387 _MCP2515_RXB1CTRL_RXMODE_SHIFT = 5
390 } MCP2515_RXB1CTRL_BITS_T;
394 MCP2515_FILHIT_F0 = 0,
395 MCP2515_FILHIT_F1 = 1,
396 MCP2515_FILHIT_F2 = 2,
397 MCP2515_FILHIT_F3 = 3,
398 MCP2515_FILHIT_F4 = 4,
399 MCP2515_FILHIT_F5 = 5
410 MCP2515_SPEED_5KBPS = 0,
411 MCP2515_SPEED_10KBPS = 1,
412 MCP2515_SPEED_20KBPS = 2,
413 MCP2515_SPEED_25KBPS = 3,
414 MCP2515_SPEED_31_25KBPS = 4,
415 MCP2515_SPEED_33KBPS = 5,
416 MCP2515_SPEED_40KBPS = 6,
417 MCP2515_SPEED_50KBPS = 7,
418 MCP2515_SPEED_80KBPS = 8,
419 MCP2515_SPEED_83KBPS = 9,
421 MCP2515_SPEED_95KBPS = 10,
422 MCP2515_SPEED_100KBPS = 11,
423 MCP2515_SPEED_125KBPS = 12,
424 MCP2515_SPEED_200KBPS = 13,
425 MCP2515_SPEED_250KBPS = 14,
426 MCP2515_SPEED_500KBPS = 15,
427 MCP2515_SPEED_666KBPS = 16,
428 MCP2515_SPEED_1000KBPS = 17
433 MCP2515_RXBDLC_DLC0 = 0x01,
434 MCP2515_RXBDLC_DLC1 = 0x02,
435 MCP2515_RXBDLC_DLC2 = 0x04,
436 MCP2515_RXBDLC_DLC3 = 0x08,
437 _MCP2515_RXBDLC_MASK = 15,
438 _MCP2515_RXBDLC_SHIFT = 0,
442 MCP2515_RXBDLC_RTR = 0x40,
448 } MCP2515_RXBDLC_BITS_T;
456 MCP2515_CMD_RESET = 0xc0,
458 MCP2515_CMD_READ = 0x03,
471 MCP2515_CMD_READ_RXBUF_RXB0SIDH = 0x90,
472 MCP2515_CMD_READ_RXBUF_RXB0D0 = 0x92,
473 MCP2515_CMD_READ_RXBUF_RXB1SIDH = 0x94,
474 MCP2515_CMD_READ_RXBUF_RXB1D0 = 0x96,
476 MCP2515_CMD_WRITE = 0x02,
491 MCP2515_CMD_LOAD_TXBUF_TXB0SIDH = 0x40,
492 MCP2515_CMD_LOAD_TXBUF_TXB0D0 = 0x41,
493 MCP2515_CMD_LOAD_TXBUF_TXB1SIDH = 0x42,
494 MCP2515_CMD_LOAD_TXBUF_TXB1D0 = 0x43,
495 MCP2515_CMD_LOAD_TXBUF_TXB2SIDH = 0x44,
496 MCP2515_CMD_LOAD_TXBUF_TXB2D0 = 0x45,
505 MCP2515_CMD_RTS = 0x80,
506 MCP2515_CMD_RTS_BUFFER0 = 0x81,
507 MCP2515_CMD_RTS_BUFFER1 = 0x82,
508 MCP2515_CMD_RTS_BUFFER2 = 0x84,
511 MCP2515_CMD_READ_STATUS = 0xa0,
515 MCP2515_CMD_RX_STATUS = 0xb0,
523 MCP2515_CMD_BIT_MODIFY = 0x05
529 MCP2515_RDSTATUS_RX0IF = 0x01,
530 MCP2515_RDSTATUS_RX1IF = 0x02,
531 MCP2515_RDSTATUS_TXB0REQ = 0x04,
532 MCP2515_RDSTATUS_TXB0IF = 0x08,
533 MCP2515_RDSTATUS_TXB1REQ = 0x10,
534 MCP2515_RDSTATUS_TXB1IF = 0x20,
535 MCP2515_RDSTATUS_TXB2REQ = 0x40,
536 MCP2515_RDSTATUS_TXB2IF = 0x80
537 } MCP2515_RDSTATUS_BITS_T;
542 MCP2515_RXSTATUS_FILTERMATCH0 = 0x01,
543 MCP2515_RXSTATUS_FILTERMATCH1 = 0x02,
544 MCP2515_RXSTATUS_FILTERMATCH2 = 0x04,
545 _MCP2515_RXSTATUS_FILTERMATCH_MASK = 7,
546 _MCP2515_RXSTATUS_FILTERMATCH_SHIFT = 0,
548 MCP2515_RXSTATUS_MSGTYPE0 = 0x08,
549 MCP2515_RXSTATUS_MSGTYPE1 = 0x10,
550 _MCP2515_RXSTATUS_MSGTYPE_MASK = 3,
551 _MCP2515_RXSTATUS_MSGTYPE_SHIFT = 3,
555 MCP2515_RXSTATUS_RXMSG0 = 0x40,
556 MCP2515_RXSTATUS_RXMSG1 = 0x80,
557 _MCP2515_RXSTATUS_RXMSG_MASK = 3,
558 _MCP2515_RXSTATUS_RXMSG_SHIFT = 6
559 } MCP2515_RXSTATUS_BITS_T;
563 MCP2515_FILTERMATCH_RXF0 = 0,
564 MCP2515_FILTERMATCH_RXF1 = 1,
565 MCP2515_FILTERMATCH_RXF2 = 2,
566 MCP2515_FILTERMATCH_RXF3 = 3,
567 MCP2515_FILTERMATCH_RXF4 = 4,
568 MCP2515_FILTERMATCH_RXF5 = 5,
569 MCP2515_FILTERMATCH_RXF0_ROLLOVER = 6,
570 MCP2515_FILTERMATCH_RXF1_ROLLOVER = 7
571 } MCP2515_FILTERMATCH_T;
575 MCP2515_MSGTYPE_STD = 0,
576 MCP2515_MSGTYPE_STDRF = 1,
577 MCP2515_MSGTYPE_EXT = 2,
578 MCP2515_MSGTYPE_EXTRF = 3
583 MCP2515_RXMSG_NONE = 0,
584 MCP2515_RXMSG_RXB0 = 1,
585 MCP2515_RXMSG_RXB1 = 2,
586 MCP2515_RXMSG_BOTH = 3
593 MCP2515_SIDL_EID16 = 0x01,
594 MCP2515_SIDL_EID17 = 0x02,
598 MCP2515_SIDL_EXIDE = 0x08,
602 MCP2515_SIDL_SID0 = 0x20,
603 MCP2515_SIDL_SID1 = 0x40,
604 MCP2515_SIDL_SID2 = 0x80
609 MCP2515_TX_BUFFER0 = 0,
610 MCP2515_TX_BUFFER1 = 1,
611 MCP2515_TX_BUFFER2 = 2,
613 MCP2515_TX_NO_BUFFERS = 255
614 } MCP2515_TX_BUFFER_T;
618 MCP2515_RX_BUFFER0 = 0,
619 MCP2515_RX_BUFFER1 = 1
620 } MCP2515_RX_BUFFER_T;
624 MCP2515_RX_FILTER0 = 0,
625 MCP2515_RX_FILTER1 = 1,
626 MCP2515_RX_FILTER2 = 2,
627 MCP2515_RX_FILTER3 = 3,
628 MCP2515_RX_FILTER4 = 4,
629 MCP2515_RX_FILTER5 = 5
630 } MCP2515_RX_FILTER_T;
634 MCP2515_RX_MASK0 = 0,
Definition: mcp2515_regs.h:71
Definition: mcp2515_regs.h:59
Definition: mcp2515_regs.h:92