Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
spi_master.cpp
00001 #include "mbed.h" 00002 00003 SPI to_eps(p5,p6,p7); 00004 DigitalOut cs(p8); 00005 00006 Serial pc(USBTX,USBRX); 00007 00008 #define DTIME 0.1 00009 00010 int main() 00011 { 00012 pc.printf("--Hi,this is cdh(master).\r\n"); 00013 cs = 1; 00014 00015 to_eps.format(8,3); 00016 to_eps.frequency(1000000); 00017 int cmd = 0; 00018 00019 while(1) { 00020 char c = pc.getc(); 00021 pc.printf("count: %d, ",cmd); 00022 00023 cs=0; 00024 int dummy = to_eps.write(cmd); // send command 00025 int rdata = to_eps.write(0x00); 00026 cs=1; 00027 00028 pc.printf("dummy: %d, ",dummy); 00029 pc.printf("rdata: %d\r\n",rdata); 00030 00031 cmd++; 00032 } 00033 }
Generated on Tue Aug 9 2022 09:43:15 by
1.7.2