mcp2515_spi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 OTA keys S.A.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef MCP2515_SPI_H
22 #define MCP2515_SPI_H
23 
24 #include <stdint.h>
25 #include "candev_mcp2515.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
41 int mcp2515_spi_init(const candev_mcp2515_t *dev);
42 
53 int mcp2515_spi_reset(const candev_mcp2515_t *dev);
54 
66 int mcp2515_spi_read(const candev_mcp2515_t *dev, uint8_t addr, uint8_t *buf,
67  unsigned int len);
68 
80 int mcp2515_spi_read_rxbuf(const candev_mcp2515_t *dev, uint8_t mailbox,
81  void *buf, uint8_t len);
82 
94 int mcp2515_spi_write(const candev_mcp2515_t *dev, uint8_t addr, uint8_t *buf,
95  unsigned int len);
96 
108 int mcp2515_spi_write_txbuf(const candev_mcp2515_t *dev, uint8_t mailbox,
109  void *buf, uint8_t len);
110 
123 int mcp2515_spi_rts(const candev_mcp2515_t *dev, uint8_t mailbox);
124 
132 uint8_t mcp2515_spi_read_status(const candev_mcp2515_t *dev);
133 
143 
160 int mcp2515_spi_bitmod(const candev_mcp2515_t *dev, uint8_t addr, uint8_t mask,
161  uint8_t buf);
162 
163 #ifdef __cplusplus
164 }
165 #endif
166 
167 #endif /* MCP2515_SPI_H */
168 
mcp2515_spi_reset
int mcp2515_spi_reset(const candev_mcp2515_t *dev)
Reset MCP2515 device though SPI interface.
mcp2515_spi_write_txbuf
int mcp2515_spi_write_txbuf(const candev_mcp2515_t *dev, uint8_t mailbox, void *buf, uint8_t len)
Send the can data to the tx mailbox.
mcp2515_spi_write
int mcp2515_spi_write(const candev_mcp2515_t *dev, uint8_t addr, uint8_t *buf, unsigned int len)
Send the register value corresponding to addr.
mcp2515_spi_rts
int mcp2515_spi_rts(const candev_mcp2515_t *dev, uint8_t mailbox)
Initiate message transmission.
mcp2515_spi_bitmod
int mcp2515_spi_bitmod(const candev_mcp2515_t *dev, uint8_t addr, uint8_t mask, uint8_t buf)
Bit modify instruction.
candev_mcp2515.h
Definition of the implementation of the CAN controller driver.
mcp2515_spi_read_rxbuf
int mcp2515_spi_read_rxbuf(const candev_mcp2515_t *dev, uint8_t mailbox, void *buf, uint8_t len)
Read the can data received in the rx mailbox.
mcp2515_spi_read_status
uint8_t mcp2515_spi_read_status(const candev_mcp2515_t *dev)
Read MCP2515 status over SPI interface.
mcp2515_spi_init
int mcp2515_spi_init(const candev_mcp2515_t *dev)
Initialize SPI interface.
mcp2515_spi_read
int mcp2515_spi_read(const candev_mcp2515_t *dev, uint8_t addr, uint8_t *buf, unsigned int len)
Read the register value corresponding to addr.
mcp2515_spi_rx_status
int mcp2515_spi_rx_status(const candev_mcp2515_t *dev)
Read MCP2515 receive status over SPI interface.
candev_mcp2515
MCP2515 device descriptor.
Definition: candev_mcp2515.h:105