SX1276 library for modtronix inair9. Edited for use with NRF51DK board.

Dependents:   InAir9_PingPong

Fork of SX1276Lib_modtronix by modtronix H

Revision:
26:ad32782125eb
Parent:
25:72381be1b0ce
diff -r 72381be1b0ce -r ad32782125eb sx1276/sx1276-inAir.cpp
--- a/sx1276/sx1276-inAir.cpp	Wed Jul 29 12:07:40 2015 +1000
+++ b/sx1276/sx1276-inAir.cpp	Sun Nov 19 18:19:55 2017 +0000
@@ -75,6 +75,18 @@
                         //For NZ32ST1L board with BOARD_INAIR4 in imod2
                         :   SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone,
                                     PB_5/*MOSI*/, PB_4/*MISO*/, PB_3/*SCLK*/, PC_8/*CS*/, PA_9/*RST*/, PB_0/*DIO0*/, PB_1, PC_6, PA_10),
+                        #elif defined( TARGET_NRF51_DK )
+                        #warning "Target_NRF51_DK_Registered"
+                        //FOLLOWING PINS ARE LISTED IN ORDER OF ARGUMENTS IN SX1276()
+						//FOR SPI INSTANCE 0: mosi -> SPI_PSELMOSI0 = p25, miso -> SPI_PSELMISO0 = p28, sclk -> SPI_PSELSCK0 = p29, nss -> SPI_PSELSS0 = p24
+                        //FOR SPI INSTANCE 1 WHICH IS USED HERE: mosi->SPI_PSELMOSI1 = p13, miso -> SPI_PSELMISO1 = p14, sclk -> SPI_PSELSCK1  = p15, nss -> SPI_PSELSS1   = p12
+                        //FOR RESET: reset -> P0_4 = p4
+                        //FOR GPIO: dio0 -> P0_0  = p0, dio1 ->  P0_1  = p1, dio2 -> P0_2  = p2, dio3 -> P0_3  = p3, 4&5 NOT ATTACHED AND NOT INCLUDED (dio4(NC) -> P0_19 = p19, dio4(NC) -> P0_20 = p20)
+                        //FOR ANTENNA SWITCH: antSwitch -> P0_13=p13
+                        //FOR FAKE: Fake -> P0_14=p14 NOT CONNECTED
+                        :   SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, SPI_PSELMOSI1, SPI_PSELMISO1, SPI_PSELSCK1, SPI_PSELSS1, P0_4, P0_0, P0_1, P0_2, P0_3),
+                           	//AntSwitch( P0_13 ), 
+                            //Fake( NC )
                         #else
                         :   SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5),
                         #endif
@@ -82,6 +94,7 @@
                             fake( NC )
 
 {
+    
     Reset( );
     
     boardConnected = BOARD_UNKNOWN;
@@ -99,6 +112,7 @@
     SetModem( MODEM_FSK );
 
     this->settings.State = IDLE ;
+	
 }
 
 //-------------------------------------------------------------------------
@@ -135,6 +149,8 @@
         spi.frequency( frequencyToSet );
     #elif( defined ( TARGET_KL25Z ) ) //busclock frequency is halved -> double the spi frequency to compensate
         spi.frequency( frequencyToSet * 2 );
+    #elif( defined ( TARGET_NRF51_DK ) ) //busclock frequency is halved -> double the spi frequency to compensate
+        spi.frequency( frequencyToSet );
     #else
         #warning "Check the board's SPI frequency"
     #endif