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
main.cpp
00001 #include "mbed.h" 00002 00003 /* 00004 This basic example just shows how to read the ADC internal channels raw values. 00005 Please look in the corresponding device reference manual for a complete 00006 description of how to make a temperature sensor, VBat or Vref measurement. 00007 */ 00008 DigitalIn mode(PC_13); 00009 DigitalOut nRF_csn(D10 /*PB_6*/ ); 00010 DigitalOut nRF_ce(D9); 00011 DigitalIn IRQ(D8); 00012 //SPI nRF_spi(D4, D5, D3);// mosi, miso, sck, 00013 SPI nRF_spi(PA_7, PA_6, PA_5);// mosi, miso, sck 00014 00015 int main() 00016 { 00017 printf("SPI TEST\r\n"); 00018 nRF_csn=1;//chip select disable 00019 nRF_spi.frequency(4000000); // 1MHz SPI bus 00020 nRF_spi.format(8,0); // 8bit normal porarity phase 00021 wait(1.0); 00022 int i; 00023 int reg; 00024 i=0; 00025 00026 while(1) { 00027 nRF_csn=0;//chip select enable 00028 nRF_spi.write(i);//register read command I=register number 00029 reg = nRF_spi.write(i);//read reg value 00030 nRF_csn=1; //chip select disable 00031 printf("%d %02x \r\n",i,reg); 00032 i++; 00033 if (i>=32) i=0; 00034 wait(0.1f); 00035 } 00036 }
Generated on Thu Jul 21 2022 14:49:10 by
1.7.2