SPI (Serial Peripheral Interface) is a full duplex serial port where a master control the speed through selecting device and clocking the bus. Both master and slave send at the same time controlled by the clock ticked by Master. Modern MCU’s have a number of SPI’s implemented as IO and supported by DMA. Various SPI protocols are supported on chips making it easy to interface to hardware. From an user perspective SPI is a serial protocol with a byte stream in/out. Each hardware device have it’s own protocol so we need to maintain separate streams for each device.
Smart SPI used to communicate on a network will only allow Smart SPI enabled devices on that bus and it also require awareness of the protocol that makes implementation a bit special. This causes SPI to be implemented in a series of sub-modules:
Main class used to wire up an SPI port. The SPI instances is typically declared global and wired to the ports with supportive setting in GPIO.
Generic SPI Device Interface. This is typically used to connect to a general purpose SPI Network with one or more devices. Each device is optionally associated with a GPIO Ship Select pin.
|Smart SPI Master/Slave. Smart SPI requires some intelligence on low level to allow streams to flow to/from different devices without using Ship Select pins.