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.
Revision 0:69fc4661515e, committed 2019-03-25
- Comitter:
- lucem1n
- Date:
- Mon Mar 25 12:13:12 2019 +0000
- Commit message:
- gosha dinah)
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 69fc4661515e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Mar 25 12:13:12 2019 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" + +SPI spi(D11, D12, D13); +DigitalOut cs(D9); +AnalogOut my_output(PA_4); +int SIZE; + +int main() { + while(1) + { + // Chip must be deselected + cs = 1; + + // Setup the spi for 8 bit data, high steady state clock, + // second edge capture, with a 1MHz clock rate + spi.format(8,0); + spi.frequency(1000000); + + // Select the device by seting chip select low + cs = 0; + + // Send 0x8f, the command to read the WHOAMI register + spi.write(0x03); + spi.write(0x00); + spi.write(0x00); + spi.write(0x00); + + // Send a dummy byte to receive the contents of the WHOAMI register + SIZE = 600000; + for(int i=0; i<SIZE; i++) + { + uint16_t sample = spi.write(0x01); + // my_output.write_u16(sample); + //wait_us(125); + } + // Deselect the device + cs = 1; + } + } \ No newline at end of file
diff -r 000000000000 -r 69fc4661515e mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Mar 25 12:13:12 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file