The SPI peripheral is used for synchronous serial communication with other devices.
More...
|
enum | spi_dopo_t { SPI_DOPO_0_SCK_1 = 0
, SPI_DOPO_2_SCK_3
, SPI_DOPO_3_SCK_1
, SPI_DOPO_0_SCK_3
} |
|
enum | spi_dipo_t {
SPI_DIPO_0 = 0
, SPI_DIPO_1
, SPI_DIPO_2
, SPI_DIPO_3
,
SPI_DIPO_NONE = 0xff
} |
|
|
void | spi_init (uint32_t baud) |
| Initializes the SPI SERCOM as a controller for a board with a defined SPI_SERCOM.
|
|
void | spi_enable (void) |
| Enables the SPI SERCOM for a board with a defined SPI_SERCOM.
|
|
uint8_t | spi_transfer (uint8_t data) |
| Transfers a byte over SPI for a board with a defined SPI_SERCOM.
|
|
void | spi_disable (void) |
| Disables the SPI SERCOM for a board with a defined SPI_SERCOM.
|
|
void | spi_init_instance (uint8_t sercom, spi_dopo_t dopo, spi_dipo_t dipo, uint32_t baud) |
| Initializes a specific SERCOM instance as an SPI controller.
|
|
void | spi_enable_instance (uint8_t sercom) |
| Enables a specific SERCOM instance for SPI.
|
|
uint8_t | spi_transfer_instance (uint8_t sercom, uint8_t data) |
| Transfers a byte over SPI.
|
|
void | spi_disable_instance (uint8_t sercom) |
| Disables a specific SERCOM instance for SPI.
|
|
The SPI peripheral is used for synchronous serial communication with other devices.
Gossamer's SPI implementation only supports SPI controller mode, not peripheral mode. Your DOPO pin in this case is COPI/MOSI, and your DIPO pin is CIPO/MISO.
◆ spi_disable_instance()
void spi_disable_instance |
( |
uint8_t |
sercom | ) |
|
Disables a specific SERCOM instance for SPI.
- Parameters
-
sercom | The SERCOM instance to disable. |
◆ spi_enable_instance()
void spi_enable_instance |
( |
uint8_t |
sercom | ) |
|
Enables a specific SERCOM instance for SPI.
- Parameters
-
sercom | The SERCOM instance to enable. |
◆ spi_init()
void spi_init |
( |
uint32_t |
baud | ) |
|
Initializes the SPI SERCOM as a controller for a board with a defined SPI_SERCOM.
- Parameters
-
baud | The desired baud rate |
◆ spi_init_instance()
void spi_init_instance |
( |
uint8_t |
sercom, |
|
|
spi_dopo_t |
dopo, |
|
|
spi_dipo_t |
dipo, |
|
|
uint32_t |
baud |
|
) |
| |
Initializes a specific SERCOM instance as an SPI controller.
- Parameters
-
sercom | The SERCOM instance to initialize. |
dopo | The data out pinout. |
- See also
- spi_dopo_t
- Parameters
-
- See also
- spi_dipo_t
- Parameters
-
baud | The desired baud rate |
◆ spi_transfer()
uint8_t spi_transfer |
( |
uint8_t |
data | ) |
|
Transfers a byte over SPI for a board with a defined SPI_SERCOM.
- Parameters
-
- Returns
- The byte received.
◆ spi_transfer_instance()
uint8_t spi_transfer_instance |
( |
uint8_t |
sercom, |
|
|
uint8_t |
data |
|
) |
| |
Transfers a byte over SPI.
- Parameters
-
sercom | The SERCOM instance to use. |
data | The byte to send. |
- Returns
- The byte received.
FIXME: Do we need to disable this check for a transmit-only SPI?