Enda Kilgarriff / platform_drivers
Embed: (wiki syntax)

« Back to documentation index

spi.cpp File Reference

spi.cpp File Reference

Implementation of SPI No-OS 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.

Detailed Description

Implementation of SPI No-OS platform driver interfaces.

Copyright (c) 2019, 2020 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 48 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 116 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 151 of file spi.cpp.