libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Functions | |
void | spi_enable (uint32_t spi) |
SPI Enable. More... | |
void | spi_disable (uint32_t spi) |
SPI Disable. More... | |
uint16_t | spi_clean_disable (uint32_t spi) |
SPI Clean Disable. More... | |
void | spi_write (uint32_t spi, uint16_t data) |
SPI Data Write. More... | |
void | spi_send (uint32_t spi, uint16_t data) |
SPI Data Write with Blocking. More... | |
uint16_t | spi_read (uint32_t spi) |
SPI Data Read. More... | |
uint16_t | spi_xfer (uint32_t spi, uint16_t data) |
SPI Data Write and Read Exchange. More... | |
void | spi_set_bidirectional_mode (uint32_t spi) |
SPI Set Bidirectional Simplex Mode. More... | |
void | spi_set_unidirectional_mode (uint32_t spi) |
SPI Set Unidirectional Mode. More... | |
void | spi_set_bidirectional_receive_only_mode (uint32_t spi) |
SPI Set Bidirectional Simplex Receive Only Mode. More... | |
void | spi_set_bidirectional_transmit_only_mode (uint32_t spi) |
SPI Set Bidirectional Simplex Receive Only Mode. More... | |
void | spi_enable_crc (uint32_t spi) |
SPI Enable the CRC. More... | |
void | spi_disable_crc (uint32_t spi) |
SPI Disable the CRC. More... | |
void | spi_set_next_tx_from_buffer (uint32_t spi) |
SPI Next Transmit is a Data Word. More... | |
void | spi_set_next_tx_from_crc (uint32_t spi) |
SPI Next Transmit is a CRC Word. More... | |
void | spi_set_full_duplex_mode (uint32_t spi) |
SPI Set Full Duplex (3-wire) Mode. More... | |
void | spi_set_receive_only_mode (uint32_t spi) |
SPI Set Receive Only Mode for Simplex (2-wire) Unidirectional Transfers. More... | |
void | spi_disable_software_slave_management (uint32_t spi) |
SPI Disable Slave Management by Hardware. More... | |
void | spi_enable_software_slave_management (uint32_t spi) |
SPI Enable Slave Management by Software. More... | |
void | spi_set_nss_high (uint32_t spi) |
SPI Set the Software NSS Signal High. More... | |
void | spi_set_nss_low (uint32_t spi) |
SPI Set the Software NSS Signal Low. More... | |
void | spi_send_lsb_first (uint32_t spi) |
SPI Set to Send LSB First. More... | |
void | spi_send_msb_first (uint32_t spi) |
SPI Set to Send MSB First. More... | |
void | spi_set_baudrate_prescaler (uint32_t spi, uint8_t baudrate) |
SPI Set the Baudrate Prescaler. More... | |
void | spi_set_master_mode (uint32_t spi) |
SPI Set to Master Mode. More... | |
void | spi_set_slave_mode (uint32_t spi) |
SPI Set to Slave Mode. More... | |
void | spi_set_clock_polarity_1 (uint32_t spi) |
SPI Set the Clock Polarity to High when Idle. More... | |
void | spi_set_clock_polarity_0 (uint32_t spi) |
SPI Set the Clock Polarity to Low when Idle. More... | |
void | spi_set_clock_phase_1 (uint32_t spi) |
SPI Set the Clock Phase to Capture on Trailing Edge. More... | |
void | spi_set_clock_phase_0 (uint32_t spi) |
SPI Set the Clock Phase to Capture on Leading Edge. More... | |
void | spi_enable_tx_buffer_empty_interrupt (uint32_t spi) |
SPI Enable the Transmit Buffer Empty Interrupt. More... | |
void | spi_disable_tx_buffer_empty_interrupt (uint32_t spi) |
SPI Disable the Transmit Buffer Empty Interrupt. More... | |
void | spi_enable_rx_buffer_not_empty_interrupt (uint32_t spi) |
SPI Enable the Receive Buffer Ready Interrupt. More... | |
void | spi_disable_rx_buffer_not_empty_interrupt (uint32_t spi) |
SPI Disable the Receive Buffer Ready Interrupt. More... | |
void | spi_enable_error_interrupt (uint32_t spi) |
SPI Enable the Error Interrupt. More... | |
void | spi_disable_error_interrupt (uint32_t spi) |
SPI Disable the Error Interrupt. More... | |
void | spi_enable_ss_output (uint32_t spi) |
SPI Set the NSS Pin as an Output. More... | |
void | spi_disable_ss_output (uint32_t spi) |
SPI Set the NSS Pin as an Input. More... | |
void | spi_enable_tx_dma (uint32_t spi) |
SPI Enable Transmit Transfers via DMA. More... | |
void | spi_disable_tx_dma (uint32_t spi) |
SPI Disable Transmit Transfers via DMA. More... | |
void | spi_enable_rx_dma (uint32_t spi) |
SPI Enable Receive Transfers via DMA. More... | |
void | spi_disable_rx_dma (uint32_t spi) |
SPI Disable Receive Transfers via DMA. More... | |
void | spi_set_standard_mode (uint32_t spi, uint8_t mode) |
SPI Standard Mode selection. More... | |
int | spi_init_master (uint32_t spi, uint32_t br, uint32_t cpol, uint32_t cpha, uint32_t lsbfirst) |
Configure the SPI as Master. More... | |
void | spi_send8 (uint32_t spi, uint8_t data) |
uint8_t | spi_read8 (uint32_t spi) |
void | spi_set_crcl_8bit (uint32_t spi) |
SPI Set CRC length to 8 bits. More... | |
void | spi_set_crcl_16bit (uint32_t spi) |
SPI Set CRC length to 16 bits. More... | |
void | spi_set_data_size (uint32_t spi, uint16_t data_s) |
SPI Set data size. More... | |
void | spi_fifo_reception_threshold_8bit (uint32_t spi) |
SPI Set reception threshold to 8 bits. More... | |
void | spi_fifo_reception_threshold_16bit (uint32_t spi) |
SPI Set reception threshold to 16 bits. More... | |
Devices can have up to three SPI peripherals. The common 4-wire full-duplex mode of operation is supported, along with 3-wire variants using unidirectional communication modes or half-duplex bidirectional communication. A variety of options allows many of the SPI variants to be supported. Multimaster operation is also supported. A CRC can be generated and checked in hardware.
Example: Clk/4, positive clock polarity, leading edge trigger, 8-bit words, LSB first.
Devices can have up to three SPI peripherals. The common 4-wire full-duplex mode of operation is supported, along with 3-wire variants using unidirectional communication modes or half-duplex bidirectional communication. A variety of options allows many of the SPI variants to be supported. Multimaster operation is also supported. A CRC can be generated and checked in hardware.
Example: Clk/4, positive clock polarity, leading edge trigger, 8-bit words, LSB first.
uint16_t spi_clean_disable | ( | uint32_t | spi | ) |
SPI Clean Disable.
Disable the SPI peripheral according to the procedure in section 23.3.8 of the reference manual. This prevents corruption of any ongoing transfers and prevents the BSY flag from becoming unreliable.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 104 of file spi_common_all.c.
References SPI_CR1, SPI_DR, SPI_SR, SPI_SR_BSY, SPI_SR_RXNE, and SPI_SR_TXE.
void spi_disable | ( | uint32_t | spi | ) |
SPI Disable.
The SPI peripheral is disabled.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 84 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_SPE.
void spi_disable_crc | ( | uint32_t | spi | ) |
SPI Disable the CRC.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 276 of file spi_common_all.c.
References SPI_CR1.
void spi_disable_error_interrupt | ( | uint32_t | spi | ) |
SPI Disable the Error Interrupt.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 570 of file spi_common_all.c.
References SPI_CR2.
void spi_disable_rx_buffer_not_empty_interrupt | ( | uint32_t | spi | ) |
SPI Disable the Receive Buffer Ready Interrupt.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 548 of file spi_common_all.c.
References SPI_CR2.
void spi_disable_rx_dma | ( | uint32_t | spi | ) |
SPI Disable Receive Transfers via DMA.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 651 of file spi_common_all.c.
References SPI_CR2.
void spi_disable_software_slave_management | ( | uint32_t | spi | ) |
SPI Disable Slave Management by Hardware.
In slave mode the NSS hardware input is used as a select enable for the slave.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 342 of file spi_common_all.c.
References SPI_CR1.
void spi_disable_ss_output | ( | uint32_t | spi | ) |
SPI Set the NSS Pin as an Input.
In master mode this allows the master to sense the presence of other masters. If NSS is then pulled low the master is placed into slave mode. In slave mode NSS becomes a slave enable.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 599 of file spi_common_all.c.
References SPI_CR2.
void spi_disable_tx_buffer_empty_interrupt | ( | uint32_t | spi | ) |
SPI Disable the Transmit Buffer Empty Interrupt.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 526 of file spi_common_all.c.
References SPI_CR2.
void spi_disable_tx_dma | ( | uint32_t | spi | ) |
SPI Disable Transmit Transfers via DMA.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 625 of file spi_common_all.c.
References SPI_CR2.
void spi_enable | ( | uint32_t | spi | ) |
SPI Enable.
The SPI peripheral is enabled.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 70 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_SPE.
void spi_enable_crc | ( | uint32_t | spi | ) |
SPI Enable the CRC.
The SPI peripheral is set to use a CRC field for transmit and receive.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 265 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_CRCEN.
void spi_enable_error_interrupt | ( | uint32_t | spi | ) |
SPI Enable the Error Interrupt.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 559 of file spi_common_all.c.
References SPI_CR2, and SPI_CR2_ERRIE.
void spi_enable_rx_buffer_not_empty_interrupt | ( | uint32_t | spi | ) |
SPI Enable the Receive Buffer Ready Interrupt.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 537 of file spi_common_all.c.
References SPI_CR2, and SPI_CR2_RXNEIE.
void spi_enable_rx_dma | ( | uint32_t | spi | ) |
SPI Enable Receive Transfers via DMA.
This allows received data streams to proceed unattended using DMA to move data from the receive buffer as data becomes available. The DMA channels provided for each SPI peripheral are given in the Technical Manual DMA section.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 640 of file spi_common_all.c.
References SPI_CR2, and SPI_CR2_RXDMAEN.
void spi_enable_software_slave_management | ( | uint32_t | spi | ) |
SPI Enable Slave Management by Software.
In slave mode the NSS hardware input is replaced by an internal software enable/disable of the slave (spi_set_nss_high).
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 356 of file spi_common_all.c.
References SPI_CR1, SPI_CR1_SSM, and SPI_CR2.
void spi_enable_ss_output | ( | uint32_t | spi | ) |
SPI Set the NSS Pin as an Output.
Normally used in master mode to allows the master to place all devices on the SPI bus into slave mode. Multimaster mode is not possible.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 584 of file spi_common_all.c.
References SPI_CR2, and SPI_CR2_SSOE.
void spi_enable_tx_buffer_empty_interrupt | ( | uint32_t | spi | ) |
SPI Enable the Transmit Buffer Empty Interrupt.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 515 of file spi_common_all.c.
References SPI_CR2, and SPI_CR2_TXEIE.
void spi_enable_tx_dma | ( | uint32_t | spi | ) |
SPI Enable Transmit Transfers via DMA.
This allows transmissions to proceed unattended using DMA to move data to the transmit buffer as it becomes available. The DMA channels provided for each SPI peripheral are given in the Technical Manual DMA section.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 614 of file spi_common_all.c.
References SPI_CR2, and SPI_CR2_TXDMAEN.
void spi_fifo_reception_threshold_16bit | ( | uint32_t | spi | ) |
SPI Set reception threshold to 16 bits.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 164 of file spi_common_v2.c.
References SPI_CR2.
void spi_fifo_reception_threshold_8bit | ( | uint32_t | spi | ) |
SPI Set reception threshold to 8 bits.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 153 of file spi_common_v2.c.
References SPI_CR2, and SPI_CR2_FRXTH.
int spi_init_master | ( | uint32_t | spi, |
uint32_t | br, | ||
uint32_t | cpol, | ||
uint32_t | cpha, | ||
uint32_t | lsbfirst | ||
) |
Configure the SPI as Master.
The SPI peripheral is configured as a master with communication parameters baudrate, frame format lsb/msb first, clock polarity and phase. The SPI enable, CRC enable, CRC next CRC length controls are not affected. These must be controlled separately.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
[in] | br | Unsigned int32. Baudrate SPI peripheral baud rates. |
[in] | cpol | Unsigned int32. Clock polarity SPI clock polarity. |
[in] | cpha | Unsigned int32. Clock Phase SPI clock phase. |
[in] | lsbfirst | Unsigned int32. Frame format lsb/msb first SPI lsb/msb first. |
Definition at line 76 of file spi_common_v2.c.
References SPI_CR1, SPI_CR1_CRCEN, SPI_CR1_CRCL, SPI_CR1_CRCNEXT, SPI_CR1_MSTR, SPI_CR1_SPE, SPI_CR2, and SPI_CR2_SSOE.
uint16_t spi_read | ( | uint32_t | spi | ) |
SPI Data Read.
Data is read from the SPI interface after the incoming transfer has finished.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 165 of file spi_common_all.c.
References SPI_DR, SPI_SR, and SPI_SR_RXNE.
uint8_t spi_read8 | ( | uint32_t | spi | ) |
Definition at line 105 of file spi_common_v2.c.
References SPI_DR8, SPI_SR, and SPI_SR_RXNE.
void spi_send | ( | uint32_t | spi, |
uint16_t | data | ||
) |
SPI Data Write with Blocking.
Data is written to the SPI interface after the previous write transfer has finished.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
[in] | data | Unsigned int16. 8 or 16 bit data to be written. |
Definition at line 147 of file spi_common_all.c.
References SPI_DR, SPI_SR, and SPI_SR_TXE.
void spi_send8 | ( | uint32_t | spi, |
uint8_t | data | ||
) |
Definition at line 97 of file spi_common_v2.c.
References SPI_DR8, SPI_SR, and SPI_SR_TXE.
void spi_send_lsb_first | ( | uint32_t | spi | ) |
SPI Set to Send LSB First.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 400 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_LSBFIRST.
void spi_send_msb_first | ( | uint32_t | spi | ) |
SPI Set to Send MSB First.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 411 of file spi_common_all.c.
References SPI_CR1.
void spi_set_baudrate_prescaler | ( | uint32_t | spi, |
uint8_t | baudrate | ||
) |
SPI Set the Baudrate Prescaler.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
[in] | baudrate | Unsigned int8. Baudrate prescale value SPI peripheral baud rate prescale values. |
Definition at line 426 of file spi_common_all.c.
References SPI_CR1.
void spi_set_bidirectional_mode | ( | uint32_t | spi | ) |
SPI Set Bidirectional Simplex Mode.
The SPI peripheral is set for bidirectional transfers in two-wire simplex mode (using a clock wire and a bidirectional data wire).
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 205 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_BIDIMODE.
void spi_set_bidirectional_receive_only_mode | ( | uint32_t | spi | ) |
SPI Set Bidirectional Simplex Receive Only Mode.
The SPI peripheral is set for bidirectional transfers in two-wire simplex mode (using a clock wire and a bidirectional data wire), and is placed in a receive state.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 235 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_BIDIMODE.
void spi_set_bidirectional_transmit_only_mode | ( | uint32_t | spi | ) |
SPI Set Bidirectional Simplex Receive Only Mode.
The SPI peripheral is set for bidirectional transfers in two-wire simplex mode (using a clock wire and a bidirectional data wire), and is placed in a transmit state.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 251 of file spi_common_all.c.
References SPI_CR1, SPI_CR1_BIDIMODE, and SPI_CR1_BIDIOE.
void spi_set_clock_phase_0 | ( | uint32_t | spi | ) |
SPI Set the Clock Phase to Capture on Leading Edge.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 504 of file spi_common_all.c.
References SPI_CR1.
void spi_set_clock_phase_1 | ( | uint32_t | spi | ) |
SPI Set the Clock Phase to Capture on Trailing Edge.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 492 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_CPHA.
void spi_set_clock_polarity_0 | ( | uint32_t | spi | ) |
SPI Set the Clock Polarity to Low when Idle.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 480 of file spi_common_all.c.
References SPI_CR1.
void spi_set_clock_polarity_1 | ( | uint32_t | spi | ) |
SPI Set the Clock Polarity to High when Idle.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 468 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_CPOL.
void spi_set_crcl_16bit | ( | uint32_t | spi | ) |
SPI Set CRC length to 16 bits.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 130 of file spi_common_v2.c.
References SPI_CR1, and SPI_CR1_CRCL.
void spi_set_crcl_8bit | ( | uint32_t | spi | ) |
SPI Set CRC length to 8 bits.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 119 of file spi_common_v2.c.
References SPI_CR1.
void spi_set_data_size | ( | uint32_t | spi, |
uint16_t | data_s | ||
) |
SPI Set data size.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
[in] | data_s | Unsigned int16. data size SPI data size. |
Definition at line 141 of file spi_common_v2.c.
References SPI_CR2, and SPI_CR2_DS_MASK.
void spi_set_full_duplex_mode | ( | uint32_t | spi | ) |
SPI Set Full Duplex (3-wire) Mode.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 317 of file spi_common_all.c.
References SPI_CR1.
void spi_set_master_mode | ( | uint32_t | spi | ) |
SPI Set to Master Mode.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 445 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_MSTR.
void spi_set_next_tx_from_buffer | ( | uint32_t | spi | ) |
SPI Next Transmit is a Data Word.
The next transmission to take place is a data word from the transmit buffer. This must be called before transmission to distinguish between sending of a data or CRC word.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 291 of file spi_common_all.c.
References SPI_CR1.
void spi_set_next_tx_from_crc | ( | uint32_t | spi | ) |
SPI Next Transmit is a CRC Word.
The next transmission to take place is a crc word from the hardware crc unit. This must be called before transmission to distinguish between sending of a data or CRC word.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 306 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_CRCNEXT.
void spi_set_nss_high | ( | uint32_t | spi | ) |
SPI Set the Software NSS Signal High.
In slave mode, and only when software slave management is used, this replaces the NSS signal with a slave select enable signal.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 375 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_SSI.
void spi_set_nss_low | ( | uint32_t | spi | ) |
SPI Set the Software NSS Signal Low.
In slave mode, and only when software slave management is used, this replaces the NSS signal with a slave select disable signal.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 389 of file spi_common_all.c.
References SPI_CR1.
void spi_set_receive_only_mode | ( | uint32_t | spi | ) |
SPI Set Receive Only Mode for Simplex (2-wire) Unidirectional Transfers.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 329 of file spi_common_all.c.
References SPI_CR1, and SPI_CR1_RXONLY.
void spi_set_slave_mode | ( | uint32_t | spi | ) |
SPI Set to Slave Mode.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 456 of file spi_common_all.c.
References SPI_CR1.
void spi_set_standard_mode | ( | uint32_t | spi, |
uint8_t | mode | ||
) |
SPI Standard Mode selection.
Set SPI standard Modes
Mode | CPOL | CPHA |
---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
2 | 1 | 0 |
3 | 1 | 1 |
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
[in] | mode | Unsigned int8. Standard SPI mode (0, 1, 2, 3) |
Definition at line 671 of file spi_common_all.c.
References SPI_CR1, SPI_CR1_CPHA, and SPI_CR1_CPOL.
void spi_set_unidirectional_mode | ( | uint32_t | spi | ) |
SPI Set Unidirectional Mode.
The SPI peripheral is set for unidirectional transfers. This is used in full duplex mode or when the SPI is placed in two-wire simplex mode that uses a clock wire and a unidirectional data wire.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
Definition at line 220 of file spi_common_all.c.
References SPI_CR1.
void spi_write | ( | uint32_t | spi, |
uint16_t | data | ||
) |
SPI Data Write.
Data is written to the SPI interface.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
[in] | data | Unsigned int16. 8 or 16 bit data to be written. |
Definition at line 131 of file spi_common_all.c.
References SPI_DR.
Referenced by spi_xfer().
uint16_t spi_xfer | ( | uint32_t | spi, |
uint16_t | data | ||
) |
SPI Data Write and Read Exchange.
Data is written to the SPI interface, then a read is done after the incoming transfer has finished.
[in] | spi | Unsigned int32. SPI peripheral identifier SPI Register base address. |
[in] | data | Unsigned int16. 8 or 16 bit data to be written. |
Definition at line 185 of file spi_common_all.c.
References SPI_DR, SPI_SR, SPI_SR_RXNE, and spi_write().