Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_Private_LoRa
Revision 29:cc4c7c1defca, committed 2020-12-18
- Comitter:
- hakusan270
- Date:
- Fri Dec 18 00:26:38 2020 +0000
- Parent:
- 28:9ee41259a3eb
- Commit message:
- Private Lora SX1276 1st
Changed in this revision
sx1276/sx1276-hal.cpp | Show annotated file Show diff for this revision Revisions of this file |
sx1276/sx1276.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/sx1276/sx1276-hal.cpp Wed Nov 25 08:17:26 2020 +0000 +++ b/sx1276/sx1276-hal.cpp Fri Dec 18 00:26:38 2020 +0000 @@ -57,9 +57,12 @@ antSwitch( P0_23 ), fake( A3 ) #else - : SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), - antSwitch( A4 ), - fake( A3 ) + : SX1276( events, D11, D12, D13, D10, D9, D8, D7, D6, D4, D3, D2 ), // For NUCLEO + antSwitch( A4 ), + fake( D8 ) +// : SX1276( events, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ), +// antSwitch( A4 ), +// fake( A3 ) #endif { this->RadioEvents = events; @@ -92,9 +95,12 @@ if( boardConnected == UNKNOWN ) { antSwitch.input( ); +// printf("antSwitch %d\r\n",ant); wait_ms( 1 ); - if(1 /* antSwitch == 1*/ ) - { + int ant=1; + if(ant == 1) + { + printf("SX1276MB1LAS \r\n"); boardConnected = SX1276MB1LAS; } else @@ -133,25 +139,25 @@ #elif( defined ( TARGET_KL25Z ) ) //busclock frequency is halved -> double the spi frequency to compensate spi.frequency( frequencyToSet * 2 ); #else - #warning "Check the board's SPI frequency" + spi.frequency( frequencyToSet ); #endif wait(0.1); } void SX1276MB1xAS::IoIrqInit( DioIrqHandler *irqHandlers ) { -#if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) || defined ( TARGET_NUCLEO_L073RZ ) || defined ( TARGET_NUCLEO_L053R8 ) ) +//#if( defined ( TARGET_NUCLEO_L152RE ) || defined ( TARGET_LPC11U6X ) || defined ( TARGET_NUCLEO_L073RZ ) || defined ( TARGET_NUCLEO_L053R8 ) ) dio0.mode( PullDown ); - dio1.mode( PullDown ); - dio2.mode( PullDown ); - dio3.mode( PullDown ); - dio4.mode( PullDown ); -#endif +// dio1.mode( PullDown ); +// dio2.mode( PullDown ); +// dio3.mode( PullDown ); +// dio4.mode( PullDown ); +//#endif dio0.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[0] ) ); - dio1.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[1] ) ); - dio2.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[2] ) ); - dio3.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[3] ) ); - dio4.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[4] ) ); +// dio1.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[1] ) ); +// dio2.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[2] ) ); +// dio3.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[3] ) ); +// dio4.rise( this, static_cast< TriggerMB1xAS > ( irqHandlers[4] ) ); } void SX1276MB1xAS::IoDeInit( void ) @@ -161,7 +167,7 @@ uint8_t SX1276MB1xAS::GetPaSelect( uint32_t channel ) { - if( channel > RF_MID_BAND_THRESH ) + if( 1 /*channel > RF_MID_BAND_THRESH*/ ) { if( boardConnected == SX1276MB1LAS ) {
--- a/sx1276/sx1276.cpp Wed Nov 25 08:17:26 2020 +0000 +++ b/sx1276/sx1276.cpp Fri Dec 18 00:26:38 2020 +0000 @@ -395,19 +395,23 @@ paConfig = Read( REG_PACONFIG ); paDac = Read( REG_PADAC ); + printf("1 pa config %02x dac %02x\r\n",paConfig ,paDac); paConfig = ( paConfig & RF_PACONFIG_PASELECT_MASK ) | GetPaSelect( this->settings.Channel ); paConfig = ( paConfig & RF_PACONFIG_MAX_POWER_MASK ) | 0x70; + printf("2 pa config %02x dac %02x\r\n",paConfig ,paDac); if( ( paConfig & RF_PACONFIG_PASELECT_PABOOST ) == RF_PACONFIG_PASELECT_PABOOST ) { if( power > 17 ) { paDac = ( paDac & RF_PADAC_20DBM_MASK ) | RF_PADAC_20DBM_ON; + printf("20dBm on\r\n"); } else { paDac = ( paDac & RF_PADAC_20DBM_MASK ) | RF_PADAC_20DBM_OFF; + printf("20dBm off\r\n"); } if( ( paDac & RF_PADAC_20DBM_ON ) == RF_PADAC_20DBM_ON ) { @@ -419,6 +423,8 @@ { power = 20; } + printf("power = %d\r\n",power); + paConfig = ( paConfig & RF_PACONFIG_OUTPUTPOWER_MASK ) | ( uint8_t )( ( uint16_t )( power - 5 ) & 0x0F ); } else @@ -431,6 +437,7 @@ { power = 17; } + printf("power 2 = %d\r\n",power); paConfig = ( paConfig & RF_PACONFIG_OUTPUTPOWER_MASK ) | ( uint8_t )( ( uint16_t )( power - 2 ) & 0x0F ); } } @@ -444,6 +451,7 @@ { power = 14; } + printf("power 3 = %d\r\n",power); paConfig = ( paConfig & RF_PACONFIG_OUTPUTPOWER_MASK ) | ( uint8_t )( ( uint16_t )( power + 1 ) & 0x0F ); } Write( REG_PACONFIG, paConfig );