|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...|
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:
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.|