Abstract SPI bus interface.

The types and functions in <ctl_spi.h> provide a high-level set of services for a bus master to read and write data over one or more SPI buses. Additional features, such as sensor drivers and so on, build upon the services that the SPI interface offers. In addition, all SPI-interfaced devices in the CrossWorks Micro-Graphics Library use the SPI functions here for I/O to LCD and OLED display.

The SPI interface in this library is abstract in the sense that there is no concrete implementation within the library. Rather, implementations of the SPI interface are offered by the many driver packages that you can install as a CrossWorks package.

To see examples of this API in use, please install the CrossWorks demonstration package for your particular board and open up its contents in the Project Explorer and take a look around.

API Summary

CTL_SPI_BUS_t Abstract SPI bus interface
ctl_spi_attach_device Attach device to SPI bus
ctl_spi_deselect_device Deselect a device from SPI bus
ctl_spi_detach_device Detach device from SPI bus
ctl_spi_lock_bus Lock SPI bus
ctl_spi_lock_bus_ex Lock SPI bus (extended)
ctl_spi_select_device Select a device onto SPI bus
ctl_spi_unlock_bus Unlock SPI bus
CTL_SPI_DEVICE_t SPI device instance
CTL_SPI_MODE_t SPI device mode
CTL_SPI_PROTOCOL_t SPI device configuration
ctl_spi_exchange Exchange data with SPI device
ctl_spi_get Read one frame from SPI device
ctl_spi_issue_deselected_clocks Issue clocks to SPI bus with device deselected
ctl_spi_put Write one frame to SPI device
ctl_spi_put_get Exchange one frame with SPI device
ctl_spi_read Read from SPI device
ctl_spi_set_idle Set SPI device idle state
ctl_spi_set_mode Set SPI device mode
ctl_spi_set_protocol Set SPI device operating parameters
ctl_spi_set_speed Set SPI device clock speed
ctl_spi_set_width Set SPI device frame width
ctl_spi_write Write to SPI device
CTL_SPI_EXCHANGE_FN_t Exchange method prototype
CTL_SPI_SET_PROTOCOL_FN_t Set bus protocol prototype