58 #ifdef SPI_HAL_CONF_ARCH_HDR_PATH 59 #include SPI_HAL_CONF_ARCH_HDR_PATH 62 #ifdef SPI_CONF_CONTROLLER_COUNT 66 #define SPI_CONTROLLER_COUNT SPI_CONF_CONTROLLER_COUNT 68 #define SPI_CONTROLLER_COUNT 0 72 #define SPI_CONTROLLER_SPI0 0 73 #define SPI_CONTROLLER_SPI1 1 82 SPI_DEV_STATUS_EINVAL,
83 SPI_DEV_STATUS_TRANSFER_ERR,
84 SPI_DEV_STATUS_BUS_LOCKED,
85 SPI_DEV_STATUS_BUS_NOT_OWNED,
101 #if GPIO_HAL_PORT_PIN_NUMBERING 111 uint32_t spi_bit_rate;
114 uint8_t spi_controller;
128 #if GPIO_HAL_PORT_PIN_NUMBERING 129 #define SPI_DEVICE_PORT(member, device) (device)->port_spi_##member 131 #define SPI_DEVICE_PORT(member, device) GPIO_HAL_NULL_PORT 212 const uint8_t *data,
int size);
254 const uint8_t *data,
int wsize,
255 uint8_t *buf,
int rsize,
int ignore);
280 uint8_t *data,
int size);
346 const uint8_t *data,
int wlen,
347 uint8_t *buf,
int rlen,
bool spi_arch_has_lock(const spi_device_t *dev)
Checks if a device has locked an SPI controller.
struct spi_device spi_device_t
SPI Device Configuration.
spi_status_t spi_select(const spi_device_t *dev)
Selects the SPI peripheral.
spi_status_t spi_read(const spi_device_t *dev, uint8_t *buf, int size)
Reads a buffer from an SPI device.
spi_status_t spi_write_byte(const spi_device_t *dev, uint8_t data)
Writes a single byte to an SPI device.
spi_status_t spi_arch_transfer(const spi_device_t *dev, const uint8_t *data, int wlen, uint8_t *buf, int rlen, int ignore_len)
Performs an SPI transfer.
spi_status_t spi_transfer(const spi_device_t *dev, const uint8_t *wdata, int wsize, uint8_t *rbuf, int rsize, int ignore)
Performs a generic SPI transfer.
uint8_t gpio_hal_port_t
A data structure that represents ports.
spi_status_t spi_read_skip(const spi_device_t *dev, int size)
Reads and ignores data from an SPI device.
spi_status_t
SPI return codes.
spi_status_t spi_arch_lock_and_open(const spi_device_t *dev)
Locks and opens an SPI controller to the configuration specified.
spi_status_t spi_strobe(const spi_device_t *dev, uint8_t strobe, uint8_t *result)
Reads and Writes one byte from/to an SPI device.
spi_status_t spi_read_register(const spi_device_t *dev, uint8_t reg, uint8_t *data, int size)
Reads a buffer of bytes from a register of an SPI device.
bool spi_has_bus(const spi_device_t *dev)
Checks if a device has locked an SPI controller.
spi_status_t spi_read_byte(const spi_device_t *dev, uint8_t *buf)
Reads a single byte from an SPI device.
uint8_t gpio_hal_pin_t
GPIO pin number representation.
spi_status_t spi_write(const spi_device_t *dev, const uint8_t *data, int size)
Writes a buffer to an SPI device.
spi_status_t spi_acquire(const spi_device_t *dev)
Locks and then opens an SPI controller.
spi_status_t spi_deselect(const spi_device_t *dev)
Deselects the SPI peripheral.
bool spi_arch_is_bus_locked(const spi_device_t *dev)
Checks if an SPI controller is locked by any device.
SPI Device Configuration.
spi_status_t spi_release(const spi_device_t *dev)
Closes and then unlocks an SPI controller.
Header file for the GPIO HAL.
spi_status_t spi_arch_close_and_unlock(const spi_device_t *dev)
Closes and unlocks an SPI controller.