Platform drivers for Mbed.

Dependents:   EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more

Embed: (wiki syntax)

« Back to documentation index

spi.cpp File Reference

spi.cpp File Reference

Implementation of SPI Mbed platform driver interfaces. More...

Go to the source code of this file.

Functions

int32_t spi_init_noos (struct spi_desc **desc, const struct spi_init_param *param)
 Initialize the SPI communication peripheral.
int32_t spi_remove (struct spi_desc *desc)
 Free the resources allocated by spi_init().
int32_t spi_write_and_read (struct spi_desc *desc, uint8_t *data, uint16_t bytes_number)
 Write and read data to/from SPI.
int32_t spi_transfer (struct spi_desc *desc, struct spi_msg *msgs, uint32_t num_of_msgs)
 Transfer (write/read) the number of SPI messages.

Detailed Description

Implementation of SPI Mbed platform driver interfaces.

Copyright (c) 2019-2021 Analog Devices, Inc. All rights reserved.

This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Definition in file spi.cpp.


Function Documentation

int32_t spi_init_noos ( struct spi_desc **  desc,
const struct spi_init_param *  param 
)

Initialize the SPI communication peripheral.

Parameters:
desc- The SPI descriptor.
init_param- The structure that contains the SPI parameters.
Returns:
SUCCESS in case of success, FAILURE otherwise.

NOTE: Actual frequency of SPI clk will be somewhat device dependent, relating to clock-settings, prescalars etc. If absolute SPI frequency is required, consult your device documentation.

Definition at line 55 of file spi.cpp.

int32_t spi_remove ( struct spi_desc *  desc )

Free the resources allocated by spi_init().

Parameters:
desc- The SPI descriptor.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 155 of file spi.cpp.

int32_t spi_transfer ( struct spi_desc *  desc,
struct spi_msg *  msgs,
uint32_t  num_of_msgs 
)

Transfer (write/read) the number of SPI messages.

Parameters:
desc- The SPI descriptor
msgs- Pointer to SPI messages
num_of_msgs- Number of SPI messages
Returns:
SUCCESS in case of success, FAILURE otherwise.
Note:
Use of this function requires CSB pin to be software controlled

Definition at line 229 of file spi.cpp.

int32_t spi_write_and_read ( struct spi_desc *  desc,
uint8_t *  data,
uint16_t  bytes_number 
)

Write and read data to/from SPI.

Parameters:
desc- The SPI descriptor.
data- The buffer with the transmitted/received data.
bytes_number- Number of bytes to write/read.
Returns:
SUCCESS in case of success, FAILURE otherwise.

Definition at line 192 of file spi.cpp.