Hexmodal SX1276lib
Dependents: LoRaWAN-hello-world_Class_C_Anish
Diff: sx1276/sx1276-hal.cpp
- Revision:
- 1:f979673946c0
- Parent:
- 0:e6ceb13d2d05
- Child:
- 2:5eb3066446dd
--- a/sx1276/sx1276-hal.cpp Mon Aug 18 14:24:46 2014 +0000 +++ b/sx1276/sx1276-hal.cpp Tue Aug 19 07:10:31 2014 +0000 @@ -13,6 +13,7 @@ Maintainers: Miguel Luis, Gregory Cristian and Nicolas Huguenin */ #include "sx1276-hal.h" +#include "debug.h" const RadioRegisters_t SX1276MB1xAS::RadioRegsInit[] = { @@ -79,6 +80,8 @@ { Reset( ); + DetectBoardType( ); + RxChainCalibration( ); IoInit( ); @@ -96,6 +99,19 @@ //------------------------------------------------------------------------- // Board relative functions //------------------------------------------------------------------------- +void SX1276MB1xAS::DetectBoardType( void ) +{ + antSwitch.input( ); + if( antSwitch == 1 ) + { + boardConnected = 0x01; + } + else + { + boardConnected = 0x00; + } + antSwitch.output( ); +} void SX1276MB1xAS::IoInit( void ) { @@ -153,7 +169,14 @@ { if( channel > RF_MID_BAND_THRESH ) { - return RF_PACONFIG_PASELECT_PABOOST; + if( boardConnected == 0x01 ) + { + return RF_PACONFIG_PASELECT_PABOOST; + } + else + { + return RF_PACONFIG_PASELECT_RFO; + } } else {