Contiki-NG
Data Structures | Macros | Functions

Header file for the SPI HAL. More...

#include "contiki.h"
#include "gpio-hal.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  spi_device
 SPI Device Configuration. More...
 

Macros

#define SPI_DEVICE_PORT(member, device)   (device)->port_spi_##member
 Retrieve the SPI device's port number if applicable. More...
 

Typedefs

typedef struct spi_device spi_device_t
 SPI Device Configuration. More...
 

Enumerations

enum  spi_status_t
 SPI return codes.
 

Functions

spi_status_t spi_acquire (const spi_device_t *dev)
 Locks and then opens an SPI controller. More...
 
spi_status_t spi_release (const spi_device_t *dev)
 Closes and then unlocks an SPI controller. More...
 
spi_status_t spi_select (const spi_device_t *dev)
 Selects the SPI peripheral. More...
 
spi_status_t spi_deselect (const spi_device_t *dev)
 Deselects the SPI peripheral. More...
 
bool spi_has_bus (const spi_device_t *dev)
 Checks if a device has locked an SPI controller. More...
 
spi_status_t spi_write_byte (const spi_device_t *dev, uint8_t data)
 Writes a single byte to an SPI device. More...
 
spi_status_t spi_read_byte (const spi_device_t *dev, uint8_t *data)
 Reads a single byte from an SPI device. More...
 
spi_status_t spi_write (const spi_device_t *dev, const uint8_t *data, int size)
 Writes a buffer to an SPI device. More...
 
spi_status_t spi_read (const spi_device_t *dev, uint8_t *data, int size)
 Reads a buffer from an SPI device. More...
 
spi_status_t spi_read_skip (const spi_device_t *dev, int size)
 Reads and ignores data from an SPI device. More...
 
spi_status_t spi_transfer (const spi_device_t *dev, const uint8_t *data, int wsize, uint8_t *buf, int rsize, int ignore)
 Performs a generic SPI transfer. More...
 
spi_status_t spi_strobe (const spi_device_t *dev, uint8_t strobe, uint8_t *status)
 Reads and Writes one byte from/to an SPI device. More...
 
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. More...
 
bool spi_arch_has_lock (const spi_device_t *dev)
 Checks if a device has locked an SPI controller. More...
 
bool spi_arch_is_bus_locked (const spi_device_t *dev)
 Checks if an SPI controller is locked by any device. More...
 
spi_status_t spi_arch_lock_and_open (const spi_device_t *dev)
 Locks and opens an SPI controller to the configuration specified. More...
 
spi_status_t spi_arch_close_and_unlock (const spi_device_t *dev)
 Closes and unlocks an SPI controller. More...
 
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. More...
 

Detailed Description

Header file for the SPI HAL.

Definition in file spi.h.