SPI#

Basic Serial Peripheral Interface Driver.

Simple, blocking SPI controller implementation for communication with external devices.

Functions#

void
spi_init(void)

Initialize a USART peripheral for SPI.

void

De-initialize a USART peripheral for SPI.

void
spi_writeByte(uint8_t data)

Write a single byte discarding the received byte.

void
spi_writeHalfword(uint16_t data)

Write two bytes discarding the received bytes.

void
spi_write3Byte(uint32_t data)

Write three bytes discarding the received bytes.

uint8_t

Read a byte by sending a 0xFF byte.

uint16_t

Read two bytes by sending two 0xFF bytes.

void

Assert the peripheral select line.

void

Dessert the peripheral select line.

uint32_t
spi_getUsartPPUSATD(uint32_t *ppusatdNr)

Get PPUSATD word of the (E)USART in use.

Function Documentation#

spi_init#

void spi_init (void)

Initialize a USART peripheral for SPI.

Parameters
N/A

Definition at line 34 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_deinit#

void spi_deinit (void)

De-initialize a USART peripheral for SPI.

Parameters
N/A

Definition at line 39 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_writeByte#

void spi_writeByte (uint8_t data)

Write a single byte discarding the received byte.

Parameters
[in]data

The byte to send


Definition at line 46 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_writeHalfword#

void spi_writeHalfword (uint16_t data)

Write two bytes discarding the received bytes.

Parameters
[in]data

The bytes to send, most significant byte first


Definition at line 53 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_write3Byte#

void spi_write3Byte (uint32_t data)

Write three bytes discarding the received bytes.

Parameters
[in]data

The bytes to send, most significant byte first


Definition at line 60 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_readByte#

uint8_t spi_readByte (void)

Read a byte by sending a 0xFF byte.

Parameters
N/A

Returns

  • The received byte


Definition at line 67 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_readHalfword#

uint16_t spi_readHalfword (void)

Read two bytes by sending two 0xFF bytes.

Parameters
N/A

Returns

  • The received bytes, most significant byte first


Definition at line 74 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_setCsActive#

void spi_setCsActive (void)

Assert the peripheral select line.

Parameters
N/A

Polarity is configured by spi_init.


Definition at line 79 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_setCsInactive#

void spi_setCsInactive (void)

Dessert the peripheral select line.

Parameters
N/A

Polarity is configured by spi_init.


Definition at line 84 of file platform/bootloader/driver/btl_driver_spi_controller.h

spi_getUsartPPUSATD#

uint32_t spi_getUsartPPUSATD (uint32_t *ppusatdNr)

Get PPUSATD word of the (E)USART in use.

Parameters
[out]ppusatdNr

PPUSATD register number

Returns

  • The PPUSATD word of the (E)USART in use


Definition at line 93 of file platform/bootloader/driver/btl_driver_spi_controller.h