Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of X_NUCLEO_COMMON by
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] 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.
- 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 | ( | 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] 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.
- 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 | ( | uint8_t * | pBuffer, |
| DigitalOut | ssel, | ||
| uint16_t | NumBytesToWrite | ||
| ) |
Writes a buffer to the SPI peripheral device.
- 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.
- Note:
- When using the SPI in Interrupt-mode, remember to disable interrupts before calling this function and to enable them again after.
Generated on Fri Jul 15 2022 01:50:51 by
1.7.2
