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
main.cpp
00001 #include "mbed.h" 00002 /* 00003 Gael board NUCLEO-F401RE SPI slave 00004 */ 00005 00006 //------------------------------------ 00007 // Serial configuration (Put on hyperterminal or Putty) 00008 // 115200 bauds, 8-bit data, no parity 00009 //------------------------------------ 00010 Serial serialIO(SERIAL_TX, SERIAL_RX); 00011 00012 int main() { 00013 00014 // Configure the serial speed. 00015 serialIO.baud(115200); 00016 serialIO.printf("SPI Slave example with mbed!\r\n"); 00017 00018 // Configure the SPI to 8-bits Mode 0, 5Mhz 00019 SPISlave spiSlave(PA_7, PA_6, PA_5, PA_15); // mosi, miso, sclk, ssel 00020 spiSlave.format(8,0); 00021 spiSlave.frequency(5000000); 00022 spiSlave.reply(191); 00023 00024 serialIO.printf("SPI Slave Waiting!\r\n"); 00025 while(1) { 00026 wait_us(2); 00027 if(spiSlave.receive()) 00028 { 00029 serialIO.printf("Slave received: %d\r\n",spiSlave.read()); 00030 } 00031 } 00032 } 00033
Generated on Thu Jul 14 2022 01:45:34 by
1.7.2