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:
Fri Jun 30 16:08:05 2017 +0200
Parent:
63:5b9d391244dc
Child:
65:b2d98328fcba
Commit message:
Moved mbed wait_ms into a HAL function Sleep_ms to keep it
independent of mbed.

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.cpp 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	Thu Jun 29 19:30:24 2017 +0200
+++ b/sx1276/sx1276-mbed-hal.cpp	Fri Jun 30 16:08:05 2017 +0200
@@ -29,6 +29,7 @@
                             PinName antSwitch, PinName antSwitchTX, PinName antSwitchTXBoost, PinName tcxo)
                             : SX1276( events)
 {
+    Sleep_ms( 10 );
     this->RadioEvents = events;
     boardConnected = board;
     
@@ -362,6 +363,12 @@
     }
 }
 
+void
+SX1276Generic::Sleep_ms(int ms)
+{
+    wait_ms(ms);
+}
+
 bool SX1276Generic::CheckRfFrequency( uint32_t frequency )
 {
     // Implement check. Currently all frequencies are supported
--- a/sx1276/sx1276-mbed-hal.h	Thu Jun 29 19:30:24 2017 +0200
+++ b/sx1276/sx1276-mbed-hal.h	Fri Jun 30 16:08:05 2017 +0200
@@ -156,6 +156,12 @@
      */
 	virtual void SetTimeout(TimeoutTimer_t timer, timeoutFuncPtr, int timeout_ms = 0);
 
+    /*
+     * A simple ms sleep
+     */
+    virtual void Sleep_ms(int ms);
+
+
 public:
     
     /*!
--- a/sx1276/sx1276.cpp	Thu Jun 29 19:30:24 2017 +0200
+++ b/sx1276/sx1276.cpp	Fri Jun 30 16:08:05 2017 +0200
@@ -95,7 +95,6 @@
 
 SX1276::SX1276( RadioEvents_t *events) : Radio( events ), isRadioActive( false )
 {
-    wait_ms( 10 );
     this->rxtxBuffer = new uint8_t[RX_BUFFER_SIZE];
     
     this->RadioEvents = events;
@@ -163,7 +162,7 @@
 
     SetOpMode( RF_OPMODE_RECEIVER );
 
-    wait_ms( 1 );
+    Sleep_ms( 1 );
 
     rssi = GetRssi( modem );
 
@@ -202,7 +201,7 @@
 
     for( i = 0; i < 32; i++ )
     {
-        wait_ms( 1 );
+        Sleep_ms( 1 );
         // Unfiltered RSSI value reading. Only takes the LSB value
         rnd |= ( ( uint32_t )Read( REG_LR_RSSIWIDEBAND ) & 0x01 ) << i;
     }
@@ -746,7 +745,7 @@
             if( ( Read( REG_OPMODE ) & ~RF_OPMODE_MASK ) == RF_OPMODE_SLEEP )
             {
                 Standby( );
-                wait_ms( 1 );
+                Sleep_ms( 1 );
             }
             // Write payload buffer
             if (header)
--- a/sx1276/sx1276.h	Thu Jun 29 19:30:24 2017 +0200
+++ b/sx1276/sx1276.h	Fri Jun 30 16:08:05 2017 +0200
@@ -553,6 +553,11 @@
      * The the Timeout for a given Timer.
      */
     virtual void SetTimeout(TimeoutTimer_t timer, timeoutFuncPtr, int timeout_ms = 0) = 0;
+    
+    /*
+     * A simple ms sleep
+     */
+    virtual void Sleep_ms(int ms) = 0;
 
 protected: