Loading...
Searching...
No Matches
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
28extern "C" {
29#endif
30
42
54
66int mcp2515_spi_read(const candev_mcp2515_t *dev, uint8_t addr, uint8_t *buf,
67 unsigned int len);
68
80int mcp2515_spi_read_rxbuf(const candev_mcp2515_t *dev, uint8_t mailbox,
81 void *buf, uint8_t len);
82
94int mcp2515_spi_write(const candev_mcp2515_t *dev, uint8_t addr, uint8_t *buf,
95 unsigned int len);
96
108int mcp2515_spi_write_txbuf(const candev_mcp2515_t *dev, uint8_t mailbox,
109 void *buf, uint8_t len);
110
123int mcp2515_spi_rts(const candev_mcp2515_t *dev, uint8_t mailbox);
124
133
143
160int 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 */
Definition of the implementation of the CAN controller driver.
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.
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.
uint8_t mcp2515_spi_read_status(const candev_mcp2515_t *dev)
Read MCP2515 status over SPI interface.
int mcp2515_spi_reset(const candev_mcp2515_t *dev)
Reset MCP2515 device though SPI interface.
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.
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.
int mcp2515_spi_rts(const candev_mcp2515_t *dev, uint8_t mailbox)
Initiate message transmission.
int mcp2515_spi_init(const candev_mcp2515_t *dev)
Initialize SPI interface.
int mcp2515_spi_rx_status(const candev_mcp2515_t *dev)
Read MCP2515 receive status over SPI interface.
int mcp2515_spi_bitmod(const candev_mcp2515_t *dev, uint8_t addr, uint8_t mask, uint8_t buf)
Bit modify instruction.
MCP2515 device descriptor.