Fork of this for my stuff.

Revision:
111:c47d5224a2d1
Parent:
110:e04a263e272d
Child:
118:422309953e38
--- a/sx1276/sx1276-mbed-hal.cpp	Fri May 18 16:40:16 2018 +0200
+++ b/sx1276/sx1276-mbed-hal.cpp	Sun Jun 03 15:07:53 2018 +0200
@@ -37,6 +37,7 @@
     this->RadioEvents = events;
     boardConnected = board;
     
+    _antSwitchPwr = NULL;
     _antSwitch = NULL;
     _antSwitchTX = NULL;
     _antSwitchTXBoost = NULL;
@@ -52,6 +53,9 @@
             break;
         case RFM95_SX1276:
             break;
+        case HELTEC_L4_1276:
+            _antSwitchPwr = new DigitalOut(antSwitch);
+            break;
         case MURATA_SX1276:
             _antSwitch = new DigitalOut(antSwitch);
             _antSwitchTX = new DigitalOut(antSwitchTX);
@@ -105,6 +109,8 @@
     rxTimeoutTimer.detach();
     rxTimeoutSyncWord.detach();
     
+    if (_antSwitchPwr)
+        delete(_antSwitchPwr);
     if (_antSwitch)
     	delete _antSwitch;
     if (_antSwitchTX)
@@ -271,7 +277,7 @@
 {
     if( channel > RF_MID_BAND_THRESH )
     {
-        if (boardConnected == SX1276MB1LAS || boardConnected == RFM95_SX1276 || boardConnected == MURATA_SX1276)
+        if (boardConnected == SX1276MB1LAS || boardConnected == RFM95_SX1276 || boardConnected == MURATA_SX1276 || boardConnected == HELTEC_L4_1276)
         {
             return RF_PACONFIG_PASELECT_PABOOST;
         }
@@ -311,6 +317,8 @@
     	*_antSwitchTX = 0;
 		*_antSwitchTXBoost = 0;
     }
+    if (boardConnected == HELTEC_L4_1276)
+        *_antSwitchPwr = PWR_OFF;
 }
 
 void SX1276Generic::AntSwDeInit( void )
@@ -321,6 +329,8 @@
         *_antSwitchTX = 0;
     	*_antSwitchTXBoost = 0;
     }
+    if (boardConnected == HELTEC_L4_1276)
+        *_antSwitchPwr = PWR_OFF;
 }
 
 
@@ -339,6 +349,8 @@
                 if (_antSwitch)
 	        		*_antSwitch = 1;
 			}
+            if (boardConnected == HELTEC_L4_1276)
+                *_antSwitchPwr = PWR_ON;
             break;
         case RFLR_OPMODE_RECEIVER:
         case RFLR_OPMODE_RECEIVER_SINGLE:
@@ -347,7 +359,9 @@
                 *_antSwitch = 1;  // Murata-RX
             	*_antSwitchTX = 0;
             	*_antSwitchTXBoost = 0;
-            } else {
+            } else if (boardConnected == HELTEC_L4_1276) {
+                *_antSwitchPwr = PWR_ON;
+    		} else {
                 if (_antSwitch)
         			_antSwitch = 0;
             }
@@ -359,7 +373,9 @@
                 *_antSwitch = 0;  //Murata-RX
             	*_antSwitchTX = 0;
             	*_antSwitchTXBoost = 0;
-            } else {
+            } else if (boardConnected == HELTEC_L4_1276) {
+                *_antSwitchPwr = PWR_OFF;
+    		} else {
                 if (_antSwitch)
         			*_antSwitch = 0;
             }