![](/media/cache/group/Prelude_LOGO.png.50x50_q85.png)
For Master of SPI Communication between two LPC1768
Dependencies: mbed
spi_master.cpp
- Committer:
- taiga_prelude
- Date:
- 2021-01-02
- Revision:
- 0:382b3838a100
File content as of revision 0:382b3838a100:
#include "mbed.h" SPI to_eps(p5,p6,p7); DigitalOut cs(p8); Serial pc(USBTX,USBRX); #define DTIME 0.1 int main() { pc.printf("--Hi,this is cdh(master).\r\n"); cs = 1; to_eps.format(8,3); to_eps.frequency(1000000); int cmd = 0; while(1) { char c = pc.getc(); pc.printf("count: %d, ",cmd); cs=0; int dummy = to_eps.write(cmd); // send command int rdata = to_eps.write(0x00); cs=1; pc.printf("dummy: %d, ",dummy); pc.printf("rdata: %d\r\n",rdata); cmd++; } }