Espotel / SX1272lib-PABOOST-HW-Modification

Dependents:   LoRaWAN_Serial_port_driven_and_configurable_ELMO_based_on_TxRx_Template

Fork of SX1272lib by Espotel

Changes compared to original SX1272lib:

HW modification was made to remove RFO-output and replaced with PABOOST-output. PASELECT changed accordingly.

Revision:
3:81cc2c384b1b
Parent:
0:669f3b0e91c8
Child:
6:a8a402ec1169
Child:
8:ead3f4cc5923
--- a/sx1272/sx1272.cpp	Thu Sep 17 15:26:17 2015 +0200
+++ b/sx1272/sx1272.cpp	Thu Oct 01 10:45:20 2015 +0200
@@ -66,7 +66,12 @@
     this->dioIrq[3] = static_cast< DioIrqHandler > (&SX1272::OnDio3Irq);
     this->dioIrq[4] = static_cast< DioIrqHandler > (&SX1272::OnDio4Irq);
     this->dioIrq[5] = static_cast< DioIrqHandler > (0);
+
     
+    rssi_last_received_packet = 0;
+    rssi_current_packet = 0;
+    snr_value = 0;
+
     this->settings.State = IDLE;
 }
 
@@ -310,11 +315,23 @@
 }
 
 
+
+void SX1272::SetTxConfig(  ModemType modem, int8_t power, uint32_t fdev,
+                           uint32_t bandwidth, uint32_t datarate,
+                           uint8_t coderate, uint16_t preambleLen,
+                           bool fixLen, bool crcOn, bool freqHopOn,
+                           uint8_t hopPeriod, bool iqInverted, uint32_t timeout )
+{
+    SetTxConfig(modem, power, fdev, bandwidth, datarate, coderate, preambleLen,
+                fixLen, crcOn, freqHopOn, hopPeriod, iqInverted, timeout,
+                GetPaSelect( this->settings.Channel ) == RF_PACONFIG_PASELECT_PABOOST);
+}
+
 void SX1272::SetTxConfig( ModemType modem, int8_t power, uint32_t fdev, 
                         uint32_t bandwidth, uint32_t datarate,
                         uint8_t coderate, uint16_t preambleLen,
                         bool fixLen, bool crcOn, bool freqHopOn, 
-                        uint8_t hopPeriod, bool iqInverted, uint32_t timeout )
+                        uint8_t hopPeriod, bool iqInverted, uint32_t timeout, bool paBoost )
 {
     uint8_t paConfig = 0;
     uint8_t paDac = 0;
@@ -324,7 +341,7 @@
     paConfig = Read( REG_PACONFIG );
     paDac = Read( REG_PADAC );
     
-    paConfig = ( paConfig & RF_PACONFIG_PASELECT_MASK ) | GetPaSelect( this->settings.Channel );
+    paConfig = ( paConfig & RF_PACONFIG_PASELECT_MASK ) | (paBoost ? RF_PACONFIG_PASELECT_PABOOST : RF_PACONFIG_PASELECT_RFO);
     
     if( ( paConfig & RF_PACONFIG_PASELECT_PABOOST ) == RF_PACONFIG_PASELECT_PABOOST )
     {
@@ -1108,6 +1125,10 @@
                     }
 
                     int16_t rssi = Read( REG_LR_PKTRSSIVALUE );
+                    rssi_last_received_packet = rssi;
+                    rssi_current_packet = GetRssi(MODEM_LORA);
+                    snr_value = snr;
+
                     if( snr < 0 )
                     {
                         this->settings.LoRaPacketHandler.RssiValue = RSSI_OFFSET + rssi + ( rssi >> 4 ) +