Helmut Tschemernjak / SX1276GenericLib

Dependents:   DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_PingPong DISCO-L072CZ-LRWAN1_LoRa_USB_Rx ... more

Fork of SX1276Lib by Semtech

Files at this revision

API Documentation at this revision

Comitter:
Helmut Tschemernjak
Date:
Wed Aug 30 12:02:09 2017 +0200
Parent:
88:d120930aeb13
Child:
90:d98572047c9c
Commit message:
Fixed calculation of the frequency error with negative numbers

Changed in this revision

LoRa_TODO.txt 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/LoRa_TODO.txt	Wed Aug 30 09:48:34 2017 +0200
+++ b/LoRa_TODO.txt	Wed Aug 30 12:02:09 2017 +0200
@@ -48,3 +48,4 @@
   The Murata’s Frequency shift using an TCXO us about 58 Hz
   The RFM95 against Murata is about 3300 Hz
   RFM95 against RFM95 testing will follow.
+- Fixed calculation of the frequency error with negative numbers
--- a/sx1276/sx1276.cpp	Wed Aug 30 09:48:34 2017 +0200
+++ b/sx1276/sx1276.cpp	Wed Aug 30 12:02:09 2017 +0200
@@ -1121,8 +1121,8 @@
         return 0;
     
     val = (Read(REG_LR_FEIMSB) & 0b1111) << 16; // high word, 4 valid bits only
-    val |= (Read(REG_LR_FEIMID) << 8) | Read(REG_LR_FEILSB); // high byte, low byte
-    if (val & 0x8000) //sconvert ign bit
+    val |= ((Read(REG_LR_FEIMID) << 8) | Read(REG_LR_FEILSB)); // high byte, low byte
+    if (val & 0x80000) //convert sign bit
         val |= 0xfff00000;
     
     int32_t bandwidth = 0;