Serial Peripheral Interface (SPI) support. Currently, there is no I2S support beyond register bit definitions.
Contents
SPI register map type.
Public Members
- __io uint32 CR1
Control register 1.
- __io uint32 CR2
Control register 2.
- __io uint32 SR
Status register.
- __io uint32 DR
Data register.
- __io uint32 CRCPR
CRC polynomial register.
- __io uint32 RXCRCR
RX CRC register.
- __io uint32 TXCRCR
TX CRC register.
- __io uint32 I2SCFGR
I2S configuration register.
- __io uint32 I2SPR
I2S prescaler register.
SPI device type.
Public Members
- spi_reg_map * regs
Register map.
- rcc_clk_id clk_id
RCC clock information.
- nvic_irq_num irq_num
NVIC interrupt number.
SPI mode configuration.
Determines a combination of clock polarity (CPOL), which determines idle state of the clock line, and clock phase (CPHA), which determines which clock edge triggers data capture.
Values:
Clock line idles low (0), data capture on first clock transition.
Clock line idles low (0), data capture on second clock transition.
Clock line idles high (1), data capture on first clock transition.
Clock line idles high (1), data capture on second clock transition.
SPI baud rate configuration, as a divisor of f_PCLK, the PCLK clock frequency.
Values:
f_PCLK/2
f_PCLK/4
f_PCLK/8
f_PCLK/16
f_PCLK/32
f_PCLK/64
f_PCLK/128
f_PCLK/256
SPI initialization flags.
See: |
---|
Values:
Bidirectional mode enable.
Output enable in bidirectional mode.
Cyclic redundancy check (CRC) enable.
8-bit data frame format (this is the default)
16-bit data frame format
Receive only.
Software slave management.
Software (internal) slave select.
This flag only has an effect when used in combination with SPI_SW_SLAVE.
LSB-first (little-endian) frame format.
MSB-first (big-endian) frame format (this is the default).
Available SPI interrupts.
Values:
TX buffer empty interrupt.
RX buffer not empty interrupt.
Error interrupt (CRC, overrun, and mode fault errors for SPI; underrun, overrun errors for I2S).
Initialize and reset a SPI device.
Parameters: |
|
---|
Configure GPIO bit modes for use as a SPI port’s pins.
Parameters: |
|
---|
Configure and enable a SPI device as bus master.
The device’s peripheral will be disabled before being reconfigured.
Parameters: |
|
---|---|
See: |
Configure and enable a SPI device as a bus slave.
The device’s peripheral will be disabled before being reconfigured.
Parameters: |
|
---|---|
See: |
Nonblocking SPI transmit.
Parameters: |
|
---|---|
Return: | Number of elements transmitted. |
Call a function on each SPI port.
Parameters: |
|
---|
Enable a SPI peripheral.
Parameters: |
|
---|
Disable a SPI peripheral.
Parameters: |
|
---|
Disable all SPI peripherals.
Enable DMA requests whenever the transmit buffer is empty.
Parameters: |
|
---|
Disable DMA requests whenever the transmit buffer is empty.
Parameters: |
|
---|
Enable DMA requests whenever the receive buffer is empty.
Parameters: |
|
---|
Disable DMA requests whenever the receive buffer is empty.
Parameters: |
|
---|
Determine if a SPI peripheral is enabled.
Parameters: |
|
---|---|
Return: | True, if and only if dev’s peripheral is enabled. |
Enable SPI interrupt requests.
Parameters: |
|
---|---|
See: |
Disable SPI interrupt requests.
Parameters: |
|
---|---|
See: |
Get the data frame format flags with which a SPI port is configured.
Parameters: |
|
---|---|
Return: | SPI_DFF_8_BIT, if dev has an 8-bit data frame format. Otherwise, SPI_DFF_16_BIT. |
Determine whether the device’s peripheral receive (RX) register is empty.
Parameters: |
|
---|---|
Return: | true, iff dev’s RX register is empty. |
Retrieve the contents of the device’s peripheral receive (RX) register.
You may only call this function when the RX register is nonempty. Calling this function clears the contents of the RX register.
Parameters: |
|
---|---|
Return: | Contents of dev’s peripheral RX register |
See: | spi_is_rx_reg_nonempty() |
Determine whether the device’s peripheral transmit (TX) register is empty.
Parameters: |
|
---|---|
Return: | true, iff dev’s TX register is empty. |
Load a value into the device’s peripheral transmit (TX) register.
You may only call this function when the TX register is empty. Calling this function loads val into the peripheral’s TX register. If the device is properly configured, this will initiate a transmission, the completion of which will cause the TX register to be empty again.
Parameters: |
|
---|---|
See: | spi_is_tx_reg_empty() |
Determine whether the device’s peripheral busy (SPI_SR_BSY) flag is set.
Parameters: |
|
---|---|
Return: | true, iff dev’s BSY flag is set. |
SPI1 register map base pointer.
SPI2 register map base pointer.
SPI3 register map base pointer.