local copy of sx1276 library
Dependents: SX1276_GPS demo_SX1276_standalone
Fork of SX1276Lib by
Diff: sx1276/sx1276-hal.cpp
- Revision:
- 5:11ec8a6ba4f0
- Parent:
- 4:f0ce52e94d3f
- Child:
- 6:e7f02929cd3d
diff -r f0ce52e94d3f -r 11ec8a6ba4f0 sx1276/sx1276-hal.cpp --- a/sx1276/sx1276-hal.cpp Wed Aug 20 06:29:01 2014 +0000 +++ b/sx1276/sx1276-hal.cpp Thu Aug 21 11:58:28 2014 +0000 @@ -25,7 +25,7 @@ { MODEM_FSK , REG_SYNCVALUE1 , 0xC1 }, { MODEM_FSK , REG_SYNCVALUE2 , 0x94 }, { MODEM_FSK , REG_SYNCVALUE3 , 0xC1 }, - { MODEM_FSK , REG_PACKETCONFIG1 , 0xD8 }, + { MODEM_FSK , REG_PACKETCONFIG1 , 0x98 }, { MODEM_FSK , REG_FIFOTHRESH , 0x8F }, { MODEM_FSK , REG_IMAGECAL , 0x02 }, { MODEM_FSK , REG_DIOMAPPING1 , 0x00 }, @@ -79,6 +79,8 @@ { Reset( ); + boardConnected = UNKNOWN; + DetectBoardType( ); RxChainCalibration( ); @@ -100,19 +102,21 @@ //------------------------------------------------------------------------- uint8_t SX1276MB1xAS::DetectBoardType( void ) { - antSwitch.input( ); - wait_ms( 1 ); - if( antSwitch == 1 ) + if( boardConnected == UNKNOWN ) { - boardConnected = SX1276MB1LAS; + antSwitch.input( ); + wait_ms( 1 ); + if( antSwitch == 1 ) + { + boardConnected = SX1276MB1LAS; + } + else + { + boardConnected = SX1276MB1MAS; + } + antSwitch.output( ); + wait_ms( 1 ); } - else - { - boardConnected = SX1276MB1MAS; - } - antSwitch.output( ); - wait_ms( 1 ); - return ( boardConnected ); }