SPI#
Basic Serial Peripheral Interface Driver.
Simple, blocking SPI controller implementation for communication with external devices.
Functions#
Initialize a USART peripheral for SPI.
De-initialize a USART peripheral for SPI.
Write a single byte discarding the received byte.
Write two bytes discarding the received bytes.
Write three bytes discarding the received bytes.
Read a byte by sending a 0xFF byte.
Read two bytes by sending two 0xFF bytes.
Assert the peripheral select line.
Dessert the peripheral select line.
Get PPUSATD word of the (E)USART in use.
Function Documentation#
spi_init#
void spi_init (void )
Initialize a USART peripheral for SPI.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
spi_deinit#
void spi_deinit (void )
De-initialize a USART peripheral for SPI.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
spi_writeByte#
void spi_writeByte (uint8_t data)
Write a single byte discarding the received byte.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | data | The byte to send |
spi_writeHalfword#
void spi_writeHalfword (uint16_t data)
Write two bytes discarding the received bytes.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | data | The bytes to send, most significant byte first |
spi_write3Byte#
void spi_write3Byte (uint32_t data)
Write three bytes discarding the received bytes.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | data | The bytes to send, most significant byte first |
spi_readByte#
uint8_t spi_readByte (void )
Read a byte by sending a 0xFF byte.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
The received byte
spi_readHalfword#
uint16_t spi_readHalfword (void )
Read two bytes by sending two 0xFF bytes.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
The received bytes, most significant byte first
spi_setCsActive#
void spi_setCsActive (void )
Assert the peripheral select line.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Polarity is configured by spi_init.
spi_setCsInactive#
void spi_setCsInactive (void )
Dessert the peripheral select line.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Polarity is configured by spi_init.
spi_getUsartPPUSATD#
uint32_t spi_getUsartPPUSATD (uint32_t * ppusatdNr)
Get PPUSATD word of the (E)USART in use.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t * | [out] | ppusatdNr | PPUSATD register number |
Returns
The PPUSATD word of the (E)USART in use