libnile
|
Go to the source code of this file.
Macros | |
#define | NILE_SPI_XCH_ERROR_MASK 0xFF00 |
Enumerations | |
enum | nile_spi_speed_t { NILE_SPI_SPEED_384KHZ = 0x00 , NILE_SPI_SPEED_6MHZ = 0x01 , NILE_SPI_SPEED_24MHZ = 0x02 } |
Functions | |
uint16_t | nile_spi_get_timeout (void) |
Get the SPI communication timeout value, in milliseconds. | |
void | nile_spi_set_timeout (uint16_t ms) |
Set the SPI communication timeout value, in milliseconds. | |
bool | nile_spi_wait_ready (void) |
Wait until the SPI interface is ready. The maximum number of milliseconds for the wait is set using nile_spi_set_timeout. | |
bool | nile_spi_abort (void) |
Abort SPI transfer. | |
bool | nile_spi_set_speed (nile_spi_speed_t speed) |
Safely set the speed used by the SPI controller. | |
bool | nile_spi_set_device (uint16_t device) |
Safely set the device targetted by the SPI controller. | |
bool | nile_spi_set_control (uint16_t value) |
Safely configure the control port. | |
static void | nile_spi_flip_buffer (void) |
Flip the currently accessible SPI buffer. | |
bool | nile_spi_rx_async (uint16_t size, uint16_t mode) |
Asynchronously receive block of data over the SPI interface. | |
static bool | nile_spi_tx_async (uint16_t size) |
Asynchronously transfer block of data over the SPI interface. | |
bool | nile_spi_tx_async_block (const void __far *buf, uint16_t size) |
Asynchronously transfer block of data over the SPI interface. | |
static bool | nile_spi_tx_sync_block (const void __far *buf, uint16_t size) |
Synchronously transfer block of data over the SPI interface. | |
bool | nile_spi_rx_sync_flip (uint16_t size, uint16_t mode) |
Synchronously receive block of data over the SPI interface and flip the buffer so that it can be accessed. | |
bool | nile_spi_rx_sync_block (void __far *buf, uint16_t size, uint16_t mode) |
Synchronously receive block of data over the SPI interface. | |
bool | nile_spi_xch_block (void __far *buf, uint16_t size) |
Synchronously exchange block of data over the SPI interface. | |
uint16_t | nile_spi_xch (uint8_t value) |
Synchronously exchange byte over the SPI interface. |
enum nile_spi_speed_t |
bool nile_spi_abort | ( | void | ) |
Abort SPI transfer.
|
inlinestatic |
uint16_t nile_spi_get_timeout | ( | void | ) |
Get the SPI communication timeout value, in milliseconds.
bool nile_spi_rx_async | ( | uint16_t | size, |
uint16_t | mode ) |
Asynchronously receive block of data over the SPI interface.
size | Length of data to receive. |
mode | Transfer mode. |
bool nile_spi_rx_sync_block | ( | void __far * | buf, |
uint16_t | size, | ||
uint16_t | mode ) |
Synchronously receive block of data over the SPI interface.
buf | Destination data block. |
size | Length of data to receive. |
mode | Transfer mode. |
bool nile_spi_rx_sync_flip | ( | uint16_t | size, |
uint16_t | mode ) |
Synchronously receive block of data over the SPI interface and flip the buffer so that it can be accessed.
size | Length of data to receive. |
mode | Transfer mode. |
bool nile_spi_set_control | ( | uint16_t | value | ) |
Safely configure the control port.
bool nile_spi_set_device | ( | uint16_t | device | ) |
Safely set the device targetted by the SPI controller.
device | SPI device. |
bool nile_spi_set_speed | ( | nile_spi_speed_t | speed | ) |
Safely set the speed used by the SPI controller.
This does not set the speed expected by the MCU!
speed | SPI controller speed. |
void nile_spi_set_timeout | ( | uint16_t | ms | ) |
Set the SPI communication timeout value, in milliseconds.
|
inlinestatic |
bool nile_spi_tx_async_block | ( | const void __far * | buf, |
uint16_t | size ) |
Asynchronously transfer block of data over the SPI interface.
buf | Data block. |
size | Length of data block. |
|
inlinestatic |
bool nile_spi_wait_ready | ( | void | ) |
Wait until the SPI interface is ready. The maximum number of milliseconds for the wait is set using nile_spi_set_timeout.
uint16_t nile_spi_xch | ( | uint8_t | value | ) |
Synchronously exchange byte over the SPI interface.
value | Byte to exchange. |
bool nile_spi_xch_block | ( | void __far * | buf, |
uint16_t | size ) |
Synchronously exchange block of data over the SPI interface.
buf | Destination data block. |
size | Length of data to send and receive. |
mode | Transfer mode. |