SPI library functions.
More...
|
int | spi_init (uint8_t channel) |
| Initialises the spidev interface.
|
|
int | spi_config (int fd, uint8_t mode, uint8_t bits, uint32_t speed, uint16_t delay) |
| Configures the spidev interface.
|
|
int | spi_config_default (int fd) |
| Configures the spidev interface with default values.
|
|
int | spi_transfer (int fd, uint8_t txbuf[], uint8_t rxbuf[], uint8_t len) |
| Initiates SPI transfers.
|
|
SPI library functions.
int spi_config |
( |
int |
fd, |
|
|
uint8_t |
mode, |
|
|
uint8_t |
bits, |
|
|
uint32_t |
speed, |
|
|
uint16_t |
delay |
|
) |
| |
Configures the spidev interface.
- Parameters
-
fd | File descriptor to use, can be acquired via spi_init() |
mode | SPI mode |
bits | Number of bits |
speed | Bus speed |
delay | Amount of delay |
- Returns
- 1 for success, -1 for failure
Definition at line 116 of file pi_spi.c.
int spi_config_default |
( |
int |
fd | ) |
|
Configures the spidev interface with default values.
- Parameters
-
fd | File descriptor to use, can be acquired via spi_init() |
- Returns
- 1 for success, -1 for failure
Definition at line 155 of file pi_spi.c.
int spi_init |
( |
uint8_t |
channel | ) |
|
Initialises the spidev interface.
- Parameters
-
channel | SPI channel to use (0 or 1) |
- Returns
- 1 for success, -1 for failure
Definition at line 53 of file pi_spi.c.
int spi_transfer |
( |
int |
fd, |
|
|
uint8_t |
txbuf[], |
|
|
uint8_t |
rxbuf[], |
|
|
uint8_t |
len |
|
) |
| |
Initiates SPI transfers.
- Parameters
-
fd | File descriptor to use, can be acquired via spi_init() |
txbuf | Transmit buffer array |
rxbuf | Receive buffer array |
len | Length of transfer |
- Returns
- 1 for success, -1 for failure
Definition at line 175 of file pi_spi.c.