A SPI slave, used for communicating with a SPI master device. More...
Public Member Functions
|SPISlave (PinName mosi, PinName miso, PinName sclk, PinName ssel)|
|Create a SPI slave connected to the specified pins. More...|
|void||format (int bits, int mode=0)|
|Configure the data transmission format. More...|
|void||frequency (int hz=1000000)|
|Set the SPI bus clock frequency. More...|
|Polls the SPI to see if data has been received. More...|
|Retrieve data from receive buffer as slave. More...|
|void||reply (int value)|
|Fill the transmission buffer with the value to be written out as slave on the next received message from the master. More...|
A SPI slave, used for communicating with a SPI master device.
The default format is set to 8 bits, mode 0 and a clock frequency of 1MHz.
Example of how to reply to a SPI master as slave:
Definition at line 59 of file SPISlave.h.
Configure the data transmission format.
|bits||Number of bits per SPI frame (4 - 16).|
|mode||Clock polarity and phase mode (0 - 3).|
|void frequency||(||int||hz = ||)|
Set the SPI bus clock frequency.
|hz||Clock frequency in hz (default = 1MHz).|
Retrieve data from receive buffer as slave.
Polls the SPI to see if data has been received.
|0||No data waiting.|
Fill the transmission buffer with the value to be written out as slave on the next received message from the master.
|value||The data to be transmitted next.|