SX1276 library for modtronix inair9. Edited for use with NRF51DK board.
Fork of SX1276Lib_modtronix by
Diff: sx1276/sx1276-inAir.cpp
- Revision:
- 17:6ae745bb937f
- Parent:
- 16:0927c093fd82
- Child:
- 18:cdb08d710838
diff -r 0927c093fd82 -r 6ae745bb937f sx1276/sx1276-inAir.cpp --- a/sx1276/sx1276-inAir.cpp Mon Mar 02 23:54:25 2015 +0000 +++ b/sx1276/sx1276-inAir.cpp Tue Mar 03 10:42:25 2015 +0000 @@ -6,7 +6,7 @@ Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin */ -#include "debug.h" +#include "myDebug.h" #include "sx1276-inAir.h" const RadioRegisters_t SX1276inAir9::RadioRegsInit[] = @@ -56,13 +56,16 @@ this->settings.State = IDLE ; } - 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)) //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 + : 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_NZ32ST1L ) ) //For NZ32ST1L board with inAir9 in imod2 : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, @@ -140,9 +143,9 @@ spi.format( 8,0 ); //uint32_t frequencyToSet = 8000000; uint32_t frequencyToSet = 1000000; //DJH - Reduced speed to 1MHz - #if( defined ( TARGET_NUCLEO_L152RE ) || defined (TARGET_NUCLEO_F401RE) || defined ( TARGET_LPC11U6X ) || defined ( TARGET_NZ32ST1L ) ) + #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 @@ -153,7 +156,7 @@ void SX1276inAir9::IoIrqInit( DioIrqHandler *irqHandlers ) { - #if( defined ( TARGET_NUCLEO_L152RE ) || defined (TARGET_NUCLEO_F401RE) || defined ( TARGET_LPC11U6X ) || defined ( TARGET_NZ32ST1L )) + #if( defined ( TARGET_NUCLEO_L152RE ) || defined (TARGET_NUCLEO_F401RE) || defined ( TARGET_LPC11U6X ) || defined (TARGET_K64F) || defined ( TARGET_NZ32ST1L )) dio0.mode(PullDown); dio1.mode(PullDown); dio2.mode(PullDown);