SX1276 library for modtronix inair9. Edited for use with NRF51DK board.
Fork of SX1276Lib_modtronix by
Diff: sx1276/sx1276-inAir.cpp
- Revision:
- 18:cdb08d710838
- Parent:
- 17:6ae745bb937f
- Child:
- 20:7cf7c08f0088
diff -r 6ae745bb937f -r cdb08d710838 sx1276/sx1276-inAir.cpp --- a/sx1276/sx1276-inAir.cpp Tue Mar 03 10:42:25 2015 +0000 +++ b/sx1276/sx1276-inAir.cpp Tue Mar 03 23:28:08 2015 +0000 @@ -58,14 +58,18 @@ SX1276inAir9::SX1276inAir9( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ) ) - #if( defined ( TARGET_NUCLEO_L152RE ) || defined (TARGET_NUCLEO_F401RE)) + #if( (defined (TARGET_NUCLEO_L152RE) || defined (TARGET_NUCLEO_F401RE)) && defined(SHIELD_SHD3I_INAIR9)) //For SHD3I with inAir9 in imod3, on Nucleo board : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11/*MOSI*/, D12/*MISO*/, D13/*SCLK*/, D7/*CS*/, A5/*RST*/, D2/*DIO0*/, D8, D4, A4, PC_3/*FAKE!!!*/, D3/*DIO5*/ ), - #elif( defined (TARGET_K64F) ) - //For SHD3I with inAir9 in imod3, on Nucleo board + #elif( defined (TARGET_K64F) && defined(SHIELD_SHD3I_INAIR9) ) /* Use pin PTC0 as fake pin */ + //For SHD3I with inAir9 in imod3, on FRDM-K64F board : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11/*MOSI*/, D12/*MISO*/, D13/*SCLK*/, D7/*CS*/, A5/*RST*/, D2/*DIO0*/, D8, D4, A4, PTC0/*FAKE!!!*/, D3/*DIO5*/ ), + #elif( defined (TARGET_KL25Z) && defined(SHIELD_SHD3I_INAIR9) ) /* Use pin PTD7 as fake pin - only A & D pins have interrupts */ + //For SHD3I with inAir9 in imod3, on FRDM-KL25Z board + : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, + D11/*MOSI*/, D12/*MISO*/, D13/*SCLK*/, D7/*CS*/, A5/*RST*/, D2/*DIO0*/, D8, D4, A4, PTD7/*FAKE!!!*/, D3/*DIO5*/ ), #elif ( defined ( TARGET_NZ32ST1L ) ) //For NZ32ST1L board with inAir9 in imod2 : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, @@ -145,7 +149,7 @@ uint32_t frequencyToSet = 1000000; //DJH - Reduced speed to 1MHz #if( defined ( TARGET_NUCLEO_L152RE ) || defined (TARGET_NUCLEO_F401RE) || defined ( TARGET_LPC11U6X ) || defined (TARGET_K64F) || defined ( TARGET_NZ32ST1L ) ) debug( "SpiInit!\n\r", NULL ); - //spi.frequency( frequencyToSet ); + spi.frequency( frequencyToSet ); #elif( defined ( TARGET_KL25Z ) ) //busclock frequency is halved -> double the spi frequency to compensate spi.frequency( frequencyToSet * 2 ); #else @@ -156,6 +160,7 @@ void SX1276inAir9::IoIrqInit( DioIrqHandler *irqHandlers ) { + //TARGET_KL25Z board does not have pulldown resistors, seems like TARGET_K64F does have them #if( defined ( TARGET_NUCLEO_L152RE ) || defined (TARGET_NUCLEO_F401RE) || defined ( TARGET_LPC11U6X ) || defined (TARGET_K64F) || defined ( TARGET_NZ32ST1L )) dio0.mode(PullDown); dio1.mode(PullDown); @@ -166,7 +171,12 @@ dio0.rise( this, static_cast< TriggerInAir > ( irqHandlers[0] ) ); dio1.rise( this, static_cast< TriggerInAir > ( irqHandlers[1] ) ); dio2.rise( this, static_cast< TriggerInAir > ( irqHandlers[2] ) ); + //For SHD3I with inAir9 in imod3, on FRDM-KL25Z board. It uses A4 on FRDM-KL25Z board, which does not have interrupt + #if( defined ( TARGET_KL25Z ) && defined(SHIELD_SHD3I_INAIR9) ) + //Nothing to be done + #else dio3.rise( this, static_cast< TriggerInAir > ( irqHandlers[3] ) ); + #endif dio4.rise( this, static_cast< TriggerInAir > ( irqHandlers[4] ) ); }