Initial release. Mbed library for VL53L1CB
DevSPI Class Reference
Helper class DevSPI providing functions for synchronous 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 in 8-bit data mode using synchronous SPI communication. | |
int | spi_read (uint8_t *pBuffer, DigitalOut &ssel, uint16_t NumBytesToRead) |
Reads a buffer from the SPI peripheral device in 8-bit data mode using synchronous SPI communication. | |
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 in 8-bit data mode using synchronous SPI communication. | |
int | spi_write (uint16_t *pBuffer, DigitalOut &ssel, uint16_t NumValuesToWrite) |
Writes a buffer to the SPI peripheral device in 16-bit data mode using synchronous SPI communication. | |
int | spi_read (uint16_t *pBuffer, DigitalOut &ssel, uint16_t NumValuesToRead) |
Reads a buffer from the SPI peripheral device in 16-bit data mode using synchronous SPI communication. | |
int | spi_read_write (uint16_t *pBufferToRead, uint16_t *pBufferToWrite, DigitalOut &ssel, uint16_t NumValues) |
Reads and write a buffer from/to the SPI peripheral device at the same time in 16-bit data mode using synchronous SPI communication. |
Detailed Description
Helper class DevSPI providing functions for synchronous SPI communication common for a series of SPI devices.
Definition at line 57 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 in 8-bit data mode using synchronous SPI communication.
- Parameters:
-
[out] pBuffer pointer to the buffer to read data into. [in] ssel GPIO of the SSEL pin of the SPI device to be used for communication. [in] NumBytesToRead number of bytes to read.
- Return values:
-
0 if ok. -1 if data format error.
- Note:
- When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.
int spi_read | ( | uint16_t * | pBuffer, |
DigitalOut & | ssel, | ||
uint16_t | NumValuesToRead | ||
) |
Reads a buffer from the SPI peripheral device in 16-bit data mode using synchronous SPI communication.
- Parameters:
-
[out] pBuffer pointer to the buffer to read data into. [in] ssel GPIO of the SSEL pin of the SPI device to be used for communication. [in] NumValuesToRead number of 16-bit values to read.
- Return values:
-
0 if ok. -1 if data format error.
- Note:
- When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.
- In order to guarantee this method to work correctly you have to pass buffers which are correctly aligned.
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 in 8-bit data mode using synchronous SPI communication.
- Parameters:
-
[out] pBufferToRead pointer to the buffer to read data into. [in] pBufferToWrite pointer to the buffer of data to send. [in] ssel GPIO of the SSEL pin of the SPI device to be used for communication. [in] NumBytes number of bytes to read and write.
- Return values:
-
0 if ok. -1 if data format error.
- Note:
- When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.
int spi_read_write | ( | uint16_t * | pBufferToRead, |
uint16_t * | pBufferToWrite, | ||
DigitalOut & | ssel, | ||
uint16_t | NumValues | ||
) |
Reads and write a buffer from/to the SPI peripheral device at the same time in 16-bit data mode using synchronous SPI communication.
- Parameters:
-
[out] pBufferToRead pointer to the buffer to read data into. [in] pBufferToWrite pointer to the buffer of data to send. [in] ssel GPIO of the SSEL pin of the SPI device to be used for communication. [in] NumValues number of 16-bit values to read and write.
- Return values:
-
0 if ok. -1 if data format error.
- Note:
- When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.
- In order to guarantee this method to work correctly you have to pass buffers which are correctly aligned.
int spi_write | ( | uint8_t * | pBuffer, |
DigitalOut & | ssel, | ||
uint16_t | NumBytesToWrite | ||
) |
Writes a buffer to the SPI peripheral device in 8-bit data mode using synchronous SPI communication.
- Parameters:
-
[in] pBuffer pointer to the buffer of data to send. [in] ssel GPIO of the SSEL pin of the SPI device to be used for communication. [in] NumBytesToWrite number of bytes to write.
- Return values:
-
0 if ok. -1 if data format error.
- Note:
- When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.
int spi_write | ( | uint16_t * | pBuffer, |
DigitalOut & | ssel, | ||
uint16_t | NumValuesToWrite | ||
) |
Writes a buffer to the SPI peripheral device in 16-bit data mode using synchronous SPI communication.
- Parameters:
-
[in] pBuffer pointer to the buffer of data to send. [in] ssel GPIO of the SSEL pin of the SPI device to be used for communication. [in] NumValuesToWrite number of 16-bit values to write.
- Return values:
-
0 if ok. -1 if data format error.
- Note:
- When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.
- In order to guarantee this method to work correctly you have to pass buffers which are correctly aligned.
Generated on Tue Jul 12 2022 20:07:15 by 1.7.2