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
Diff: main.cpp
- Revision:
- 0:244a4a925723
- Child:
- 1:4445caa57b32
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Mar 18 08:31:07 2015 +0000 @@ -0,0 +1,43 @@ +#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 = 0; + + while(1) { + + cs = 0; + wait_ms(10); + uint8_t dummy_response = spi.write(i); + wait_ms(10); + cs = 1; + + led = 1; + wait(2); + led = 0; + + cs = 0; + wait_ms(10); + uint8_t response = spi.write(0xFF); + wait_ms(10); + cs = 1; + + pc.printf("instruction: 0x%X; dummy_response = 0x%X; response = 0x%X\r\n", i, dummy_response, response); + + led = 1; + wait(2); + led = 0; + i++; + } + +} \ No newline at end of file