SPI Peripheral Driver.
More...
|
file | spi.c |
| SPI Driver - gnulinux platform.
|
|
file | spi.c |
| SPI Driver - uos3-proto board.
|
|
|
uint8_t | SPI_cmd (uint8_t spi_num, uint8_t cmd) |
|
uint8_t | SPI_read8 (uint8_t spi_num, uint8_t addr, uint8_t *data) |
|
uint8_t | SPI_write8 (uint8_t spi_num, uint8_t addr, uint8_t *data) |
|
uint8_t | SPI_burstread8 (uint8_t spi_num, uint8_t addr, uint8_t *data, uint32_t len) |
|
uint8_t | SPI_burstwrite8 (uint8_t spi_num, uint8_t addr, uint8_t *data, uint32_t len) |
|
uint8_t | SPI_read16 (uint8_t spi_num, uint16_t addr, uint8_t *data) |
|
uint8_t | SPI_write16 (uint8_t spi_num, uint16_t addr, uint8_t *data) |
|
uint8_t | SPI_burstread16 (uint8_t spi_num, uint16_t addr, uint8_t *data, uint32_t len) |
|
uint8_t | SPI_burstwrite16 (uint8_t spi_num, uint16_t addr, uint8_t *data, uint32_t len) |
|
uint8_t | SPI_read32 (uint8_t spi_num, uint32_t addr, uint8_t *data) |
|
uint8_t | SPI_write32 (uint8_t spi_num, uint32_t addr, uint8_t *data) |
|
uint8_t | SPI_burstread32 (uint8_t spi_num, uint32_t addr, uint8_t *data, uint32_t len) |
|
uint8_t | SPI_burstwrite32 (uint8_t spi_num, uint32_t addr, uint8_t *data, uint32_t len) |
|
SPI Peripheral Driver.
Hardware SPI Peripheral Driver.
SPI ports for each board are defined in ${board}/board.h
The relevant SPI Port/Peripheral is initialised if required on any function call.
uint8_t SPI_cmd |
( |
uint8_t |
spi_num, |
|
|
uint8_t |
cmd |
|
) |
| |
Sends a single 'command' byte on the specified SPI peripheral
- Parameters
-
spi_num | ID of the SPI peripheral |
cmd | Command byte to be sent |
- Returns
- Status byte
Public Functions
Definition at line 15 of file spi.c.
uint8_t SPI_read8 |
( |
uint8_t |
spi_num, |
|
|
uint8_t |
addr, |
|
|
uint8_t * |
data |
|
) |
| |
Reads a byte from an address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Address of the slave device register |
data | Pointer to a byte for storage of the data retrieved |
- Returns
- Status byte
Definition at line 23 of file spi.c.
uint8_t SPI_write8 |
( |
uint8_t |
spi_num, |
|
|
uint8_t |
addr, |
|
|
uint8_t * |
data |
|
) |
| |
Writes a byte to an address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Address of the slave device register |
data | Pointer to a byte containing the data to be written |
- Returns
- Status byte
Definition at line 42 of file spi.c.
uint8_t SPI_burstread8 |
( |
uint8_t |
spi_num, |
|
|
uint8_t |
addr, |
|
|
uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Reads a number of bytes from an address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Address of the slave device register |
data | Pointer to bytes for storage of the data retrieved |
len | Number of bytes to be read |
- Returns
- Status byte
Definition at line 32 of file spi.c.
uint8_t SPI_burstwrite8 |
( |
uint8_t |
spi_num, |
|
|
uint8_t |
addr, |
|
|
uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Writes a number of bytes to an address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Address of the slave device register |
data | Pointer to bytes containing the data to be written |
len | Number of bytes to be written |
- Returns
- Status byte
Definition at line 51 of file spi.c.
uint8_t SPI_read16 |
( |
uint8_t |
spi_num, |
|
|
uint16_t |
addr, |
|
|
uint8_t * |
data |
|
) |
| |
Reads a byte from an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to a byte for storage of the data retrieved |
- Returns
- Status byte
Definition at line 61 of file spi.c.
uint8_t SPI_write16 |
( |
uint8_t |
spi_num, |
|
|
uint16_t |
addr, |
|
|
uint8_t * |
data |
|
) |
| |
Writes a byte to an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to a byte containing the data to be written |
- Returns
- Status byte
Definition at line 80 of file spi.c.
uint8_t SPI_burstread16 |
( |
uint8_t |
spi_num, |
|
|
uint16_t |
addr, |
|
|
uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Reads a number of bytes from an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to bytes for storage of the data retrieved |
len | Number of bytes to be read |
- Returns
- Status byte
Definition at line 70 of file spi.c.
uint8_t SPI_burstwrite16 |
( |
uint8_t |
spi_num, |
|
|
uint16_t |
addr, |
|
|
uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Writes a number of bytes to an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to bytes containing the data to be written |
len | Number of bytes to be written |
- Returns
- Status byte
Definition at line 89 of file spi.c.
uint8_t SPI_read32 |
( |
uint8_t |
spi_num, |
|
|
uint32_t |
addr, |
|
|
uint8_t * |
data |
|
) |
| |
Reads a byte from an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to a byte for storage of the data retrieved |
- Returns
- Status byte
Definition at line 99 of file spi.c.
uint8_t SPI_write32 |
( |
uint8_t |
spi_num, |
|
|
uint32_t |
addr, |
|
|
uint8_t * |
data |
|
) |
| |
Writes a byte to an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to a byte containing the data to be written |
- Returns
- Status byte
Definition at line 118 of file spi.c.
uint8_t SPI_burstread32 |
( |
uint8_t |
spi_num, |
|
|
uint32_t |
addr, |
|
|
uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Reads a number of bytes from an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to bytes for storage of the data retrieved |
len | Number of bytes to be read |
- Returns
- Status byte
Definition at line 108 of file spi.c.
uint8_t SPI_burstwrite32 |
( |
uint8_t |
spi_num, |
|
|
uint32_t |
addr, |
|
|
uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
Writes a number of bytes to an extended address of the slave device on the specified SPI peripheral.
- Parameters
-
spi_num | ID of the SPI peripheral |
addr | Extended address of the slave device register |
data | Pointer to bytes containing the data to be written |
len | Number of bytes to be written |
- Returns
- Status byte
Definition at line 127 of file spi.c.