Ryo Od
/
mbed-os_SPITest_Slave
SPI Test (Slave)
Diff: main.cpp
- Revision:
- 0:317ca984456c
- Child:
- 1:7090a42ac6e0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 18 07:01:22 2017 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" + +SPISlave spiS(D11, D12, D13, A2); // mosi, miso, sclk, ssel + +int main() +{ + printf("SPISlave Test\r\n"); + + spiS.format(8, 0); + spiS.frequency(8000000); + + for (;;) { + if (spiS.receive()) { + int rdata = spiS.read(); + printf("received: %x\r\n", rdata); + spiS.reply(0xAA); + } + } +}