Fix ADR channel mask handling

Dependents:  

Fork of lmic_MOTE_L152RC by canuck lehead

Revision:
3:d87012f45bf6
Parent:
2:edb5d1f3deeb
Child:
4:1a9a62cf220f
diff -r edb5d1f3deeb -r d87012f45bf6 radio.cpp
--- a/radio.cpp	Thu Jun 04 20:00:55 2015 +0000
+++ b/radio.cpp	Thu Jun 18 23:22:43 2015 +0000
@@ -10,7 +10,7 @@
  *******************************************************************************/
 
 #include "lmic.h"
-#include "debug.h"  // wbr
+#include "mbed.h"
 
 // ---------------------------------------- 
 // Registers Mapping
@@ -105,7 +105,7 @@
 #define LORARegSyncWord                            0x39
 #define FSKRegTimer2Coef                           0x3A
 #define FSKRegImageCal                             0x3B
-#define LORARegTimingInvert                        0x3B
+#define LORARegTimingInvert                        0x3B // bit2 in 0x3b set low when bit6 in 0x33 set hi (RX invert)
 #define FSKRegTemp                                 0x3C
 #define FSKRegLowBat                               0x3D
 #define FSKRegIrqFlags1                            0x3E
@@ -397,7 +397,7 @@
     writeReg(RegFrfLsb, (u1_t)(frf>> 0));
 }
 
-
+DigitalOut pd2(PD_2);   // power amplifier voltage control pin
 
 static void configPower () {
 #ifdef CFG_sx1276_radio
@@ -425,8 +425,12 @@
         // use RFO with external amplifier
         PaSelect = 0x00;    // use RFO
         writeReg(RegPaConfig, (u1_t)(PaSelect|(pw-25)));
+        if (pw > 26)
+            pd2 = 1;
+        else
+            pd2 = 0;
     } else {
-        // use PA_BOOST directo to antenna
+        // use PA_BOOST direct to antenna
         PaSelect = 0x80;    // use PA_BOOST 
         if (pw > 17)
             pw = 17;