SX1261 and sx1262 common library
Dependents: SX126xDevKit SX1262PingPong SX126X_TXonly SX126X_PingPong_Demo ... more
Fork of SX126xLib by
Diff: sx126x-hal.cpp
- Revision:
- 6:1e2345700991
- Parent:
- 5:e488e6f185f3
--- a/sx126x-hal.cpp Fri Mar 09 13:19:45 2018 +0000 +++ b/sx126x-hal.cpp Wed Jul 18 13:33:42 2018 +0000 @@ -291,12 +291,56 @@ uint8_t SX126xHal::GetDeviceType( void ) { - return( DeviceSelect.read( ) ); + uint16_t val = 0; + val = DeviceSelect.read_u16( ); + + if( val <= 0x2000 ) + { + return( SX1262 ); + } + else if( val <= 0xA000 ) + { + return( SX1268 ); + } + else + { + return( SX1261 ); + } } uint8_t SX126xHal::GetFreqSelect( void ) { - return( FreqSelect.read( ) ); + uint16_t val = 0; + val = FreqSelect.read_u16( ); + + if( val < 100 ) + { + return( MATCHING_FREQ_915 ); + } + else if( val <= 0x3000 ) + { + return( MATCHING_FREQ_780 ); + } + else if( val <= 0x4900 ) // 0x4724 + { + return( MATCHING_FREQ_490 ); + } + else if( val <= 1 ) + { + return( MATCHING_FREQ_434 ); + } + else if( val <= 1 ) + { + return( MATCHING_FREQ_280 ); + } + else if( val <= 0xF000 ) + { + return( MATCHING_FREQ_169 ); + } + else + { + return( MATCHING_FREQ_868 ); + } } void SX126xHal::AntSwOn( void )