Contiki-NG

Files

 

Functions

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 *write_buf, int wlen, uint8_t *inbuf, int rlen, int ignore_len)
 Performs an SPI transfer. More...
 

Detailed Description

Function Documentation

◆ spi_arch_close_and_unlock()

spi_status_t spi_arch_close_and_unlock ( const spi_device_t dev)

Closes and unlocks an SPI controller.

Parameters
devAn SPI device configuration that specifies the controller.
Returns
SPI return code

This should turn off the SPI controller to put it in low power mode and unlock it. It should work only if the device has already locked the SPI controller.

Definition at line 170 of file spi-arch.c.

◆ spi_arch_has_lock()

bool spi_arch_has_lock ( const spi_device_t dev)

Checks if a device has locked an SPI controller.

Parameters
devAn SPI device configuration which defines the controller to be checked if it is locked and the respective device.
Returns
1 if the device has the lock, 0 otherwise.

Definition at line 99 of file spi-arch.c.

◆ spi_arch_is_bus_locked()

bool spi_arch_is_bus_locked ( const spi_device_t dev)

Checks if an SPI controller is locked by any device.

Parameters
devAn SPI device configuration which defines the controller to be checked.
Returns
1 if the controller is locked, 0 otherwise.

Definition at line 110 of file spi-arch.c.

◆ spi_arch_lock_and_open()

spi_status_t spi_arch_lock_and_open ( const spi_device_t dev)

Locks and opens an SPI controller to the configuration specified.

Parameters
devAn SPI device configuration.
Returns
SPI return code

This should work only if the device has already locked the SPI controller.

Definition at line 121 of file spi-arch.c.

◆ spi_arch_transfer()

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.

Parameters
devAn SPI device configuration that specifies the controller.
dataA pointer to the data to be written. Set it to NULL to skip writing.
wlenLength of data to write.
bufA pointer to buffer to copy the data read. Set to NULL to skip reading.
rlenLength of data to read.
ignore_lenLength of data to read and ignore.
Returns
SPI return code

It should work only if the device has already locked the SPI controller. A total of rlen+ignore_len bytes will be read. The first rlen bytes will be copied to buf. The remaining ignore_len bytes won't be copied to the buffer. The maximum of wlen and rlen+ignore_len of bytes will be transfered.

Definition at line 199 of file spi-arch.c.