Andrea Palmieri / X_NUCLEO_COMMON

Fork of X_NUCLEO_COMMON by ST

Embed: (wiki syntax)

« Back to documentation index

DevSPI Class Reference

DevSPI Class Reference

Helper class DevSPI providing functions for SPI communication common for a series of SPI devices. More...

#include <DevSPI.h>

Public Member Functions

int spi_write (uint8_t *pBuffer, DigitalOut ssel, uint16_t NumBytesToWrite)
 Writes a buffer to the SPI peripheral device.
int spi_read (uint8_t *pBuffer, DigitalOut ssel, uint16_t NumBytesToRead)
 Reads a buffer from the SPI peripheral device.
int spi_read_write (uint8_t *pBufferToRead, uint8_t *pBufferToWrite, DigitalOut ssel, uint16_t NumBytes)
 Reads and write a buffer from/to the SPI peripheral device at the same time.

Detailed Description

Helper class DevSPI providing functions for SPI communication common for a series of SPI devices.

Definition at line 50 of file DevSPI.h.


Member Function Documentation

int spi_read ( uint8_t *  pBuffer,
DigitalOut  ssel,
uint16_t  NumBytesToRead 
)

Reads a buffer from the SPI peripheral device.

Parameters:
[out]pBufferpointer to the buffer to read data into.
[in]sselGPIO of the SSEL pin of the SPI device to be used for communication.
[in]NumBytesToReadnumber of bytes to read.
Return values:
0if ok.
Note:
When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.

Definition at line 137 of file DevSPI.h.

int spi_read_write ( uint8_t *  pBufferToRead,
uint8_t *  pBufferToWrite,
DigitalOut  ssel,
uint16_t  NumBytes 
)

Reads and write a buffer from/to the SPI peripheral device at the same time.

Parameters:
[out]pBufferToReadpointer to the buffer to read data into.
[in]pBufferToWritepointer to the buffer of data to send.
[in]sselGPIO of the SSEL pin of the SPI device to be used for communication.
[in]NumBytesnumber of bytes to read and write.
Return values:
0if ok.
Note:
When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.

Definition at line 173 of file DevSPI.h.

int spi_write ( uint8_t *  pBuffer,
DigitalOut  ssel,
uint16_t  NumBytesToWrite 
)

Writes a buffer to the SPI peripheral device.

Parameters:
[in]pBufferpointer to the buffer of data to send.
[in]sselGPIO of the SSEL pin of the SPI device to be used for communication.
[in]NumBytesToWritenumber of bytes to write.
Return values:
0if ok.
Note:
When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.

Definition at line 102 of file DevSPI.h.