SPI controller on one RP2040 SPI peripheral; sketches use SPI.
More...
#include <SPI.h>
|
| | PhyduinoSPI (spi_inst_t *spi, pin_size_t sck, pin_size_t mosi, pin_size_t miso) |
| | Binds the controller to an SPI peripheral and its pins; nothing is set up until begin().
|
| void | begin () override |
| | Starts the controller and connects SCK, MOSI and MISO.
|
|
void | end () override |
| | Stops the controller and frees its pins.
|
| void | beginTransaction (arduino::SPISettings settings) override |
| | Applies the clock, bit order and mode for the next transfers.
|
|
void | endTransaction () override |
| | Ends a transaction. Does nothing; kept for Arduino compatibility.
|
| uint8_t | transfer (uint8_t data) override |
| | Sends one byte and returns the byte received at the same time.
|
| uint16_t | transfer16 (uint16_t data) override |
| | Sends 16 bits as two bytes, in the bit order of the transaction.
|
| void | transfer (void *buffer, size_t count) override |
| | Sends a buffer and replaces its contents with the bytes received.
|
Not needed in v0.1: these do nothing.
|
|
void | usingInterrupt (int) override |
| | Does nothing.
|
|
void | notUsingInterrupt (int) override |
| | Does nothing.
|
|
void | attachInterrupt () override |
| | Does nothing.
|
|
void | detachInterrupt () override |
| | Does nothing.
|
SPI controller on one RP2040 SPI peripheral; sketches use SPI.
Transfers 8 bits at a time. LSBFIRST is supported (done in software).
◆ PhyduinoSPI()
Binds the controller to an SPI peripheral and its pins; nothing is set up until begin().
- Parameters
-
| spi | pico-sdk SPI (spi0 or spi1). |
| sck | Arduino pin for SCK. |
| mosi | Arduino pin for MOSI. |
| miso | Arduino pin for MISO. |
◆ begin()
| void PhyduinoSPI::begin |
( |
| ) |
|
|
override |
Starts the controller and connects SCK, MOSI and MISO.
Uses the settings of the last beginTransaction(), or 4 MHz, MSBFIRST, SPI_MODE0 if there was none.
◆ beginTransaction()
| void PhyduinoSPI::beginTransaction |
( |
arduino::SPISettings | settings | ) |
|
|
override |
Applies the clock, bit order and mode for the next transfers.
- Parameters
-
| settings | E.g. SPISettings(1000000, MSBFIRST, SPI_MODE0). |
◆ transfer() [1/2]
| uint8_t PhyduinoSPI::transfer |
( |
uint8_t | data | ) |
|
|
override |
Sends one byte and returns the byte received at the same time.
- Parameters
-
- Returns
- Byte received.
◆ transfer() [2/2]
| void PhyduinoSPI::transfer |
( |
void * | buffer, |
|
|
size_t | count ) |
|
override |
Sends a buffer and replaces its contents with the bytes received.
- Parameters
-
| buffer | Bytes to send; overwritten with the received bytes. |
| count | Number of bytes. |
◆ transfer16()
| uint16_t PhyduinoSPI::transfer16 |
( |
uint16_t | data | ) |
|
|
override |
Sends 16 bits as two bytes, in the bit order of the transaction.
- Parameters
-
- Returns
- Value received.
The documentation for this class was generated from the following file: