SX1276Lib updated in order to be RTOS aware
Fork of SX1276Lib by
Revision 1:f979673946c0, committed 2014-08-19
- Comitter:
- GregCr
- Date:
- Tue Aug 19 07:10:31 2014 +0000
- Parent:
- 0:e6ceb13d2d05
- Child:
- 2:5eb3066446dd
- Commit message:
- Added board detection following default status of Antenna Switch pin
Changed in this revision
--- 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 {
--- a/sx1276/sx1276-hal.h Mon Aug 18 14:24:46 2014 +0000 +++ b/sx1276/sx1276-hal.h Tue Aug 19 07:10:31 2014 +0000 @@ -26,7 +26,7 @@ /*! * Antenna switch GPIO pins objects */ - DigitalOut antSwitch; + DigitalInOut antSwitch; DigitalIn fake; @@ -42,6 +42,12 @@ virtual ~SX1276MB1xAS( ) { }; protected: + + /*! + * @brief Detect the board connected by reading the value of the antenna switch pin + */ + virtual void DetectBoardType( void ); + /*! * @brief Initializes the radio I/Os pins interface */
--- a/sx1276/sx1276.h Mon Aug 18 14:24:46 2014 +0000 +++ b/sx1276/sx1276.h Tue Aug 19 07:10:31 2014 +0000 @@ -69,6 +69,8 @@ bool isRadioActive; + uint8_t boardConnected; //1 = SX1276MB1LAS; 0 = SX1276MB1MAS + uint8_t *rxBuffer; uint8_t previousOpMode;