Kevin Moloney
/
spi-master-demo
test
Revision 0:57242c7f2b63, committed 2017-06-02
- Comitter:
- kevin1990
- Date:
- Fri Jun 02 09:18:26 2017 +0000
- Commit message:
- test
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 57242c7f2b63 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 02 09:18:26 2017 +0000 @@ -0,0 +1,24 @@ +#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 +}
diff -r 000000000000 -r 57242c7f2b63 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 02 09:18:26 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/86740a56073b \ No newline at end of file