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
Revision 0:e35b82bee4e2, committed 2020-12-11
- Comitter:
- hakusan270
- Date:
- Fri Dec 11 07:19:10 2020 +0000
- Commit message:
- test
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 11 07:19:10 2020 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" + +/* + This basic example just shows how to read the ADC internal channels raw values. + Please look in the corresponding device reference manual for a complete + description of how to make a temperature sensor, VBat or Vref measurement. +*/ +DigitalIn mode(PC_13); +DigitalOut nRF_csn(D10 /*PB_6*/ ); +DigitalOut nRF_ce(D9); +DigitalIn IRQ(D8); +//SPI nRF_spi(D4, D5, D3);// mosi, miso, sck, +SPI nRF_spi(PA_7, PA_6, PA_5);// mosi, miso, sck + +int main() +{ + printf("SPI TEST\r\n"); + nRF_csn=1;//chip select disable + nRF_spi.frequency(4000000); // 1MHz SPI bus + nRF_spi.format(8,0); // 8bit normal porarity phase + wait(1.0); + int i; + int reg; + i=0; + + while(1) { + nRF_csn=0;//chip select enable + nRF_spi.write(i);//register read command I=register number + reg = nRF_spi.write(i);//read reg value + nRF_csn=1; //chip select disable + printf("%d %02x \r\n",i,reg); + i++; + if (i>=32) i=0; + wait(0.1f); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 11 07:19:10 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file