|
MiraOS
1.14
|
MiraOS SPI driver. More...
#include <stdint.h>Go to the source code of this file.
Functions | |
| void | mira_spi_init (uint32_t clock_speed) |
| Initialize the SPI driver. More... | |
| void | mira_spi_set_clock_speed (uint32_t clock_speed) |
| Updates SPI clock speed. More... | |
| uint32_t | mira_spi_get_clock_speed (void) |
| Gets current clock speed. More... | |
| void | mira_spi_write (uint8_t data) |
| Writes a byte to the SPI bus. More... | |
| uint8_t | mira_spi_read (void) |
| Reads a byte from the SPI bus. More... | |
| void | mira_spi_transfer (uint8_t *source, uint8_t *destination, uint16_t src_length, uint16_t dest_length) |
| A full SPI transfer. More... | |
| void | mira_spi_flush (void) |
| Flush the SPI driver FIFO. More... | |
MiraOS SPI driver.
| void mira_spi_flush | ( | void | ) |
Flush the SPI driver FIFO.
| uint32_t mira_spi_get_clock_speed | ( | void | ) |
Gets current clock speed.
| void mira_spi_init | ( | uint32_t | clock_speed | ) |
Initialize the SPI driver.
| clock_speed | SPI maximum clock speed in Hz |
| uint8_t mira_spi_read | ( | void | ) |
Reads a byte from the SPI bus.
Sends 0x00 on the SPI bus to clock in a byte from a slave device
| void mira_spi_set_clock_speed | ( | uint32_t | clock_speed | ) |
Updates SPI clock speed.
| clock_speed | SPI maximum clock speed in Hz |
| void mira_spi_transfer | ( | uint8_t * | source, |
| uint8_t * | destination, | ||
| uint16_t | src_length, | ||
| uint16_t | dest_length | ||
| ) |
A full SPI transfer.
This function performs a full SPI transfer (both write and read). To total number of bytes written to the bus is MAX(src_length, dest_length), if needed the write data is padded with 0x00. No more than dest_bytes of data will be written to destination. source or destination MAY be NULL.
| source | pointer to the source data buffer |
| destination | pointer to the destination data buffer |
| src_length | the number of bytes to read from the source buffer |
| dest_length | the number of bytes to write into the destination buffer |
| void mira_spi_write | ( | uint8_t | data | ) |
Writes a byte to the SPI bus.
Any received data is discarded
| data | a byte to write to the SPI bus |
1.8.11