mbed library sources: Modified to operate FRDM-KL25Z at 48MHz from internal 32kHz oscillator (nothing else changed).
Fork of mbed-src by
SPI Class Reference
A SPI Master, used for communicating with SPI slave devices. More...
#include <SPI.h>
Public Member Functions | |
SPI (PinName mosi, PinName miso, PinName sclk) | |
Create a SPI master connected to the specified pins. | |
void | format (int bits, int mode=0) |
Configure the data transmission format. | |
void | frequency (int hz=1000000) |
Set the spi bus clock frequency. | |
virtual int | write (int value) |
Write to the SPI Slave and return the response. |
Detailed Description
A SPI Master, used for communicating with SPI slave devices.
The default format is set to 8-bits, mode 0, and a clock frequency of 1MHz
Most SPI devices will also require Chip Select and Reset signals. These can be controlled using <DigitalOut> pins
Example:
// Send a byte to a SPI slave, and record the response #include "mbed.h" SPI device(p5, p6, p7); // mosi, miso, sclk int main() { int response = device.write(0xFF); }
Definition at line 47 of file SPI.h.
Constructor & Destructor Documentation
SPI | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk | ||
) |
Member Function Documentation
void format | ( | int | bits, |
int | mode = 0 |
||
) |
void frequency | ( | int | hz = 1000000 ) |
Generated on Wed Jul 13 2022 19:29:55 by 1.7.2