Kevin Moloney
/
spi-master-demo
test
main.cpp
- Committer:
- kevin1990
- Date:
- 2017-06-02
- Revision:
- 0:57242c7f2b63
File content as of revision 0:57242c7f2b63:
#include "mbed.h" #define VALUE_SENT 0xFA Serial pc(SERIAL_TX, SERIAL_RX); SPI spi(D11, D12, D13); DigitalOut chipSelect(D10); int main() { int masterVal = VALUE_SENT; chipSelect = 1; // Deselect device spi.format(8,3); // Setup: bit data, high steady state clock, 2nd edge capture spi.frequency(1000000); //1MHz chipSelect = 0; // Select device spi.write(masterVal); wait(2); chipSelect = 1; // Deselect device }