local copy of sx1276 library
Dependents: SX1276_GPS demo_SX1276_standalone
Fork of SX1276Lib by
Diff: sx1276/sx1276-hal.cpp
- Revision:
- 16:29f09ac61412
- Parent:
- 12:aa5b3bf7fdf4
--- a/sx1276/sx1276-hal.cpp Tue Dec 16 10:02:45 2014 +0000 +++ b/sx1276/sx1276-hal.cpp Tue Jun 16 11:52:30 2015 +0000 @@ -13,6 +13,7 @@ Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin */ #include "sx1276-hal.h" +#include "main.h" const RadioRegisters_t SX1276MB1xAS::RadioRegsInit[] = { @@ -31,7 +32,8 @@ { MODEM_FSK , REG_DIOMAPPING1 , 0x00 }, { MODEM_FSK , REG_DIOMAPPING2 , 0x30 }, { MODEM_LORA, REG_LR_PAYLOADMAXLENGTH, 0x40 }, -}; + { MODEM_LORA, REG_SEQCONFIG1 , 0x02 }, // per errata to optimitze sensitivity + }; SX1276MB1xAS::SX1276MB1xAS( 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 ), @@ -131,6 +133,17 @@ SetModem( RadioRegsInit[i].Modem ); Write( RadioRegsInit[i].Addr, RadioRegsInit[i].Value ); } + if( Frequency > RF_MID_BAND_THRESH ) + { + SetModem(MODEM_LORA); + Write(REG_TIMER2COEF, 0x64 ); // per errata to optimize sensitivity + + } + else + { + SetModem(MODEM_LORA); + Write(REG_TIMER2COEF, 0x7f ); // per errata to optimize sensitivity + } } void SX1276MB1xAS::SpiInit( void ) @@ -171,19 +184,22 @@ uint8_t SX1276MB1xAS::GetPaSelect( uint32_t channel ) { + if( channel > RF_MID_BAND_THRESH ) { if( boardConnected == SX1276MB1LAS ) { + return RF_PACONFIG_PASELECT_PABOOST; } else { + return RF_PACONFIG_PASELECT_RFO; } } else - { + { return RF_PACONFIG_PASELECT_RFO; } }