|
TTK4155 Lab Node 1
Term project in the NTNU course TTK4155 Embedded and Industrial Computer Systems Design
|
CAN driver. More...
Go to the source code of this file.
Data Structures | |
| struct | can_msg |
| Represents a simple CAN message with an address, data count, and a single byte of data. More... | |
| struct | can_device |
| Represents a CAN device, storing the SPI slave controlling the MCP2515. More... | |
| struct | CAN_frame |
| Represents a full CAN frame for sending/receiving. More... | |
Macros | |
| #define | CAN_ID_ERROR 0x01 |
| #define | CAN_ID_GAMEOVER 0x02 |
| #define | CAN_ID_GAMESTART 0x03 |
| #define | CAN_ID_JOYPOS 0x04 |
| #define | CAN_ID_RESET 0x05 |
| #define | CAN_ID_READY 0x06 |
| #define | CAN_ID_SCORE 0x07 |
| #define | CAN_ID_DEFAULT 0x08 |
| #define | CAN_RXQ_SIZE 8 |
Functions | |
| int8_t | can_init (struct can_device *dev) |
| Initialize a CAN device. | |
| int8_t | can_write (struct can_device *dev, struct CAN_frame msg) |
| Write a CAN frame to the MCP2515 transmit buffer. | |
| int8_t | can_read_rx0 (struct can_device *dev, struct CAN_frame *out) |
| Read a message from RX buffer 0. | |
| int8_t | can_read_rx1 (struct can_device *dev, struct CAN_frame *out) |
| Read a message from RX buffer 1. | |
| int | can_rxq_add (struct CAN_frame *msg) |
| Add a CAN frame to the internal receive queue. | |
| int | can_rxq_pull (struct CAN_frame *out) |
| Pull a CAN frame from the internal receive queue. | |
| int8_t | can_reset (struct can_device *dev, uint8_t address, struct CAN_frame data_frame) |
| int8_t | MCP2515_init (struct can_device *dev) |
| int8_t | MCP2515_read (struct can_device *dev, uint8_t rx_buf_num, uint8_t *out) |
| int8_t | MCP2515_write (struct can_device *dev, uint8_t addr, uint8_t data) |
| int8_t | MCP2515_request_to_send (struct can_device *dev, uint8_t tx_buf_num) |
| int8_t | MCP2515_bit_modify (struct can_device *dev, uint8_t reg, uint8_t mask, uint8_t set_val) |
| int8_t | MCP2515_reset (struct can_device *dev) |
| int8_t | MCP2515_read_status (struct can_device *dev, uint8_t *out) |
CAN driver.
Definition in file can.h.