SX1276 library for modtronix inair9. Edited for use with NRF51DK board.
Fork of SX1276Lib_modtronix by
Diff: sx1276/sx1276-inAir.cpp
- Revision:
- 25:72381be1b0ce
- Parent:
- 24:1346d1c71c40
- Child:
- 26:ad32782125eb
diff -r 1346d1c71c40 -r 72381be1b0ce sx1276/sx1276-inAir.cpp --- a/sx1276/sx1276-inAir.cpp Fri Jul 24 21:35:37 2015 +1000 +++ b/sx1276/sx1276-inAir.cpp Wed Jul 29 12:07:40 2015 +1000 @@ -31,9 +31,9 @@ SX1276inAir::SX1276inAir( 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 ), PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset, - PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5, + PinName dio0, PinName dio1, PinName dio2, PinName dio3, /*PinName dio4, PinName dio5,*/ PinName antSwitch ) - : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, mosi, miso, sclk, nss, reset, dio0, dio1, dio2, dio3, dio4, dio5), + : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, mosi, miso, sclk, nss, reset, dio0, dio1, dio2, dio3/*, dio4, dio5*/), antSwitch( NC ), fake( NC ) { @@ -62,21 +62,21 @@ #if( (defined (TARGET_NUCLEO_L152RE) || defined (TARGET_NUCLEO_F401RE)) && defined(SHIELD_SHD3I_INAIR9)) //For SHD3I with BOARD_INAIR4 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*/ ), + D11/*MOSI*/, D12/*MISO*/, D13/*SCLK*/, D7/*CS*/, A5/*RST*/, D2/*DIO0*/, D8, D4, A4), #elif( defined (TARGET_K64F) && defined(SHIELD_SHD3I_INAIR9) ) /* Use pin PTC0 as fake pin */ //For SHD3I with BOARD_INAIR4 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*/ ), + D11/*MOSI*/, D12/*MISO*/, D13/*SCLK*/, D7/*CS*/, A5/*RST*/, D2/*DIO0*/, D8, D4, A4), #elif( defined (TARGET_KL25Z) && defined(SHIELD_SHD3I_INAIR9) ) /* Use pin PTD7 as fake pin - only A & D pins have interrupts */ //For SHD3I with BOARD_INAIR4 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*/ ), + D11/*MOSI*/, D12/*MISO*/, D13/*SCLK*/, D7/*CS*/, A5/*RST*/, D2/*DIO0*/, D8, D4, A4), #elif ( defined(TARGET_NZ32ST1L) || defined(TARGET_NZ32SC151) ) //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, PC_3/*FAKE!!!*/, PC_13/*DIO5*/ ), + PB_5/*MOSI*/, PB_4/*MISO*/, PB_3/*SCLK*/, PC_8/*CS*/, PA_9/*RST*/, PB_0/*DIO0*/, PB_1, PC_6, PA_10), #else - : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), + : SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5), #endif antSwitch( NC ), fake( NC ) @@ -130,9 +130,7 @@ { nss = 1; spi.format( 8,0 ); - //uint32_t frequencyToSet = 8000000; - // TEST TEST - uint32_t frequencyToSet = 1000000; //DJH - Reduced speed to 1MHz + uint32_t frequencyToSet = 8000000; #if( defined ( TARGET_NUCLEO_L152RE ) || defined (TARGET_NUCLEO_F401RE) || defined ( TARGET_LPC11U6X ) || defined (TARGET_K64F) || defined ( TARGET_NZ32ST1L ) || defined(TARGET_NZ32SC151) ) spi.frequency( frequencyToSet ); #elif( defined ( TARGET_KL25Z ) ) //busclock frequency is halved -> double the spi frequency to compensate @@ -151,7 +149,7 @@ dio1.mode(PullDown); dio2.mode(PullDown); dio3.mode(PullDown); - dio4.mode(PullDown); + //dio4.mode(PullDown); #endif dio0.rise( this, static_cast< TriggerInAir > ( irqHandlers[0] ) ); dio1.rise( this, static_cast< TriggerInAir > ( irqHandlers[1] ) ); @@ -162,7 +160,7 @@ #else dio3.rise( this, static_cast< TriggerInAir > ( irqHandlers[3] ) ); #endif - dio4.rise( this, static_cast< TriggerInAir > ( irqHandlers[4] ) ); + //dio4.rise( this, static_cast< TriggerInAir > ( irqHandlers[4] ) ); } void SX1276inAir::IoDeInit( void )