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_lpc11u53 by
main.cpp
- Committer:
- armdran
- Date:
- 2015-04-01
- Revision:
- 4:995eae7f13f4
- Parent:
- 3:8f2dc71bae92
- Child:
- 5:5db204c0979d
File content as of revision 4:995eae7f13f4:
#include "mbed.h" //SPI Master Serial pc(USBTX, USBRX); DigitalOut led(LED1); //arch ble //SPI spi(p25, p28, p29); // mosi, miso, sclk //DigitalOut cs(p24); //frdm - spi0 //SPI spi(PTD6, PTD7, PTD5); // mosi, miso, sclk //DigitalOut cs(PTA14); //ssel seems to work, data = ff :( //frdm - spi1 SPI spi(D11, D12, D13); // mosi, miso, sclk DigitalOut cs(D10); int main() { spi.format(8,1); //not usefull results spi.frequency(1000000); //spi.frequency(4000000); uint8_t i; int j = 0; uint8_t fail; uint8_t success; while(1) { fail = 0; success = 0; for (i = 0; i < 10; i++) { cs = 0; spi.write(i); cs = 1; wait_ms(100); cs = 0; uint8_t response = spi.write(0xFF); cs = 1; printf("send: %x received: %x\r\n", i, response); if(response == i + 0x10) { success++; } else { fail++; } wait_ms(2000); } pc.printf("%d: fails: %d, success: %d\r\n",j++ , fail, success); wait(.5); } }