Team Walter / SX1276GenericLib

Fork of SX1276GenericLib by Walter Luu

Files at this revision

API Documentation at this revision

Comitter:
walterluu
Date:
Mon Oct 12 21:54:55 2020 +0000
Parent:
111:ccfb6ca5f5e0
Commit message:
Modify for the demo project

Changed in this revision

sx1276/sx1276-mbed-hal.cpp Show annotated file Show diff for this revision Revisions of this file
sx1276/sx1276-mbed-hal.h Show annotated file Show diff for this revision Revisions of this file
sx1276/sx1276.h Show annotated file Show diff for this revision Revisions of this file
--- a/sx1276/sx1276-mbed-hal.cpp	Fri Jun 01 21:37:06 2018 +0000
+++ b/sx1276/sx1276-mbed-hal.cpp	Mon Oct 12 21:54:55 2020 +0000
@@ -31,7 +31,7 @@
                             PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset,
                             PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5,
                             PinName antSwitch, PinName antSwitchTX, PinName antSwitchTXBoost, PinName tcxo)
-                            : SX1276( events)
+                            : SX1276( events)				// SX1276Generic is a derived class of SX1276
 {
     Sleep_ms( 10 );
     this->RadioEvents = events;
@@ -60,10 +60,10 @@
         default:
             break;
     }
-    _spi = new XSPI(mosi, miso, sclk );
-    _nss = new DigitalOut(nss);
+    _spi = new XSPI(mosi, miso, sclk );				// constructor for SPI pins
+    _nss = new DigitalOut(nss);						// constructor for the ns pin
     
-    _reset = new DigitalInOut(reset);
+    _reset = new DigitalInOut(reset);				// constructor for the reset pin
     
     _dio0 = NULL;
     _dio1 = NULL;
@@ -157,7 +157,7 @@
 {
     *_nss = 1;
     _spi->format( 8,0 );
-    uint32_t frequencyToSet = 8000000;
+    uint32_t frequencyToSet = 8000000;				// SPI frequency is 8MHz
 #ifdef TARGET_KL25Z	//busclock frequency is halved -> double the spi frequency to compensate
     _spi->frequency( frequencyToSet * 2 );
 #else
--- a/sx1276/sx1276-mbed-hal.h	Fri Jun 01 21:37:06 2018 +0000
+++ b/sx1276/sx1276-mbed-hal.h	Mon Oct 12 21:54:55 2020 +0000
@@ -42,46 +42,46 @@
  */
 class SX1276Generic : public SX1276
 {
-protected:
+protected:			// can be accessible by derived class or inheritance
     /*!
      * Antenna switch GPIO pins objects
      */
-    DigitalOut *_antSwitch;
-    DigitalOut *_antSwitchTX;
-    DigitalOut *_antSwitchTXBoost;
+    DigitalOut *_antSwitch;					// declaration of _antSwitch pin
+    DigitalOut *_antSwitchTX;				// declaration of _antSwitchTX pin
+    DigitalOut *_antSwitchTXBoost;			// declaration of _antSwitchTXBoost pin
 
     /*!
      * SX1276 Reset pin
      */
-    DigitalInOut *_reset;
+    DigitalInOut *_reset;					// declaration of _reset pin
     
     /*!
      * TCXO being used with the Murata Module
      */
-    DigitalOut *_tcxo;
+    DigitalOut *_tcxo;						// declaration of _tcxo pin, only for Murata module
 
     /*!
      * SPI Interface
      */
-    XSPI *_spi; // mosi, miso, sclk
-    DigitalOut *_nss;
+    XSPI *_spi; // mosi, miso, sclk		// declaration of SPI pins
+    DigitalOut *_nss;					// declaration of _nss pin
     
     /*!
      * SX1276 DIO pins
      */
-    InterruptIn *_dio0;
-    InterruptIn *_dio1;
-    InterruptIn *_dio2;
-    InterruptIn *_dio3;
-    InterruptIn *_dio4;
-    DigitalIn *_dio5;
+    InterruptIn *_dio0;					// declaration of interrupt in _dio0
+    InterruptIn *_dio1;					// declaration of interrupt in _dio1
+    InterruptIn *_dio2;					// declaration of interrupt in _dio2
+    InterruptIn *_dio3;					// declaration of interrupt in _dio3
+    InterruptIn *_dio4;					// declaration of interrupt in _dio4
+    DigitalIn *_dio5;					// declaration of digital input _dio5
     
     /*!
      * Tx and Rx timers
      */
-    MyTimeout txTimeoutTimer;
-    MyTimeout rxTimeoutTimer;
-    MyTimeout rxTimeoutSyncWord;
+    MyTimeout txTimeoutTimer;			// declaration of txTimeoutTimer
+    MyTimeout rxTimeoutTimer;			// declaration of rxTimeoutTimer
+    MyTimeout rxTimeoutSyncWord;		// declaration of rxTimeoutSyncWord
     
     
 private:
--- a/sx1276/sx1276.h	Fri Jun 01 21:37:06 2018 +0000
+++ b/sx1276/sx1276.h	Mon Oct 12 21:54:55 2020 +0000
@@ -111,7 +111,7 @@
 /*!
  * Actual implementation of a SX1276 radio, inherits Radio
  */
-class SX1276 : public Radio
+class SX1276 : public Radio                 // derived from the Radio class
 {
 protected: