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.
A SPI mode determines a combination of the idle state of the clock line (the clock polarity, or “CPOL”), and which clock edge triggers data capture (the clock phase, or “CPHA”).
Values:
Clock idles low, data captured on rising edge (first transition)
Clock idles low, data captured on falling edge (second transition)
Clock idles high, data captured on falling edge (first transition)
Clock idles high, data captured on rising edge (second transition)
Same as SPI_MODE_LOW_RISING.
Same as SPI_MODE_LOW_FALLING.
Same as SPI_MODE_HIGH_FALLING.
Same as SPI_MODE_HIGH_RISING.
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: |
|
---|
Deprecated.
Use spi_config_gpios() instead.
See: | spi_config_gpios() |
---|
Configure and enable a SPI device as bus master.
The device’s peripheral will be disabled before being reconfigured.
Parameters: |
|
---|---|
See: | spi_cfg_flag |
Configure and enable a SPI device as a bus slave.
The device’s peripheral will be disabled before being reconfigured.
Parameters: |
|
---|---|
See: | spi_cfg_flag |
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: | spi_interrupt |
Disable SPI interrupt requests.
Parameters: |
|
---|---|
See: | spi_interrupt |
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. |