libjaylink
0.3.1
Library to access J-Link devices
|
Serial Peripheral Interface (SPI) functions. More...
Functions | |
int | jaylink_spi_io (struct jaylink_device_handle *devh, const uint8_t *mosi, uint8_t *miso, uint32_t length, uint32_t flags) |
Perform SPI I/O operation. More... | |
Serial Peripheral Interface (SPI) functions.
int jaylink_spi_io | ( | struct jaylink_device_handle * | devh, |
const uint8_t * | mosi, | ||
uint8_t * | miso, | ||
uint32_t | length, | ||
uint32_t | flags | ||
) |
Perform SPI I/O operation.
The device acts as master and operates in mode 3 (CPOL = 1, CPHA = 1). Data is transferred with the most significant bit (MSB) first.
[in,out] | devh | Device handle. |
[in] | mosi | Buffer to read MOSI data from. Can be NULL. |
[out] | miso | Buffer to store MISO data on success. Its content is undefined on failure. The buffer must be large enough to contain at least the specified number of bytes to transfer. Can be NULL. |
[in] | length | Number of bytes to transfer. |
[in] | flags | Flags, see jaylink_spi_flag for more details. |
JAYLINK_OK | Success. |
JAYLINK_ERR_ARG | Invalid arguments. |
JAYLINK_ERR_TIMEOUT | A timeout occurred. |
JAYLINK_ERR_PROTO | Protocol violation. |
JAYLINK_ERR | Other error conditions. |