libjaylink 0.3.1
Library to access J-Link devices
Loading...
Searching...
No Matches
Functions
spi.c File Reference

Serial Peripheral Interface (SPI) functions. More...

#include <stdint.h>
#include "libjaylink.h"
#include "libjaylink-internal.h"

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.
 

Detailed Description

Serial Peripheral Interface (SPI) functions.

Function Documentation

◆ jaylink_spi_io()

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.

Note
This function must only be used if the device has the JAYLINK_DEV_CAP_SPI capability and if the JAYLINK_TIF_SPI interface is available and selected.
Parameters
[in,out]devhDevice handle.
[in]mosiBuffer to read MOSI data from. Can be NULL.
[out]misoBuffer 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]lengthNumber of bytes to transfer.
[in]flagsFlags, see jaylink_spi_flag for more details.
Return values
JAYLINK_OKSuccess.
JAYLINK_ERR_ARGInvalid arguments.
JAYLINK_ERR_TIMEOUTA timeout occurred.
JAYLINK_ERR_PROTOProtocol violation.
JAYLINK_ERROther error conditions.
Since
0.3.0