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
Fork of SPI_master_frdm by
main.cpp
- Committer:
- armdran
- Date:
- 2015-03-18
- Revision:
- 1:4445caa57b32
- Parent:
- 0:244a4a925723
- Child:
- 2:52f588020826
File content as of revision 1:4445caa57b32:
#include "mbed.h"
//SPI Master
SPI spi(p25, p28, p29); // mosi, miso, sclk
Serial pc(USBTX, USBRX);
DigitalOut led(LED1);
DigitalOut cs(p24);
int main() {
spi.format(8,0); //not usefull results
spi.frequency(1000000);
uint8_t i;
int j = 0;
uint8_t fail;
uint8_t success;
int pause = 1;
while(1) {
fail = 0;
success = 0;
for (i = 0; i < 32; i++) {
cs = 0;
spi.write(i);
cs = 1;
cs = 0;
uint8_t response = spi.write(0xFF);
cs = 1;
if(response == i + 0x10) {
success++;
} else {
fail++;
}
}
pc.printf("%d: fails: %d, success: %d\r\n",j++ , fail, success);
wait(.5);
}
}
