SX1276Lib updated in order to be RTOS aware

Fork of SX1276Lib by Semtech

Files at this revision

API Documentation at this revision

Comitter:
mluis
Date:
Tue Oct 20 12:58:58 2015 +0000
Parent:
19:71a47bb03fbb
Child:
21:2e496deb7858
Commit message:
Addded SetMaxPayloadLength API to the driver

Changed in this revision

radio/radio.h Show annotated file Show diff for this revision Revisions of this file
sx1276/sx1276-hal.cpp 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/radio/radio.h	Wed Aug 12 14:34:03 2015 +0000
+++ b/radio/radio.h	Tue Oct 20 12:58:58 2015 +0000
@@ -332,6 +332,14 @@
      * @param [IN] size Number of bytes to be read from the FIFO
      */
     virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0;
+    
+    /*!
+     * @brief Sets the maximum payload length.
+     *
+     * @param [IN] modem      Radio modem to be used [0: FSK, 1: LoRa]
+     * @param [IN] max        Maximum payload length in bytes
+     */
+    virtual void SetMaxPayloadLength( ModemType modem, uint8_t max ) = 0;
 };
 
 #endif // __RADIO_H__
--- a/sx1276/sx1276-hal.cpp	Wed Aug 12 14:34:03 2015 +0000
+++ b/sx1276/sx1276-hal.cpp	Tue Oct 20 12:58:58 2015 +0000
@@ -69,6 +69,10 @@
                         :   SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5, A3, D9 ), // For NUCLEO L152RE dio4 is on port A3
                             antSwitch( A4 ),
                             fake( D8 )
+                        #elif defined( TARGET_LPC11U6X )
+                        :   SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ),
+                            antSwitch( P0_23 ), 
+                            fake( A3 )
                         #else
                         :   SX1276( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone, D11, D12, D13, D10, A0, D2, D3, D4, D5, D8, D9 ),
                             antSwitch( A4 ), 
--- a/sx1276/sx1276.cpp	Wed Aug 12 14:34:03 2015 +0000
+++ b/sx1276/sx1276.cpp	Tue Oct 20 12:58:58 2015 +0000
@@ -992,6 +992,24 @@
     }
 }
 
+void SX1276::SetMaxPayloadLength( ModemType modem, uint8_t max )
+{
+    this->SetModem( modem );
+
+    switch( modem )
+    {
+    case MODEM_FSK:
+        if( this->settings.Fsk.FixLen == false )
+        {
+            this->Write( REG_PAYLOADLENGTH, max );
+        }
+        break;
+    case MODEM_LORA:
+        this->Write( REG_LR_PAYLOADMAXLENGTH, max );
+        break;
+    }
+}
+
 void SX1276::OnTimeoutIrq( void )
 {
     switch( this->settings.State )
@@ -1040,7 +1058,7 @@
 
 void SX1276::OnDio0Irq( void )
 {
-    __IO uint8_t irqFlags = 0;
+    volatile uint8_t irqFlags = 0;
   
     switch( this->settings.State )
     {                
--- a/sx1276/sx1276.h	Wed Aug 12 14:34:03 2015 +0000
+++ b/sx1276/sx1276.h	Tue Oct 20 12:58:58 2015 +0000
@@ -354,6 +354,14 @@
      */
     virtual void Reset( void ) = 0;
     
+    /*!
+     * @brief Sets the maximum payload length.
+     *
+     * @param [IN] modem      Radio modem to be used [0: FSK, 1: LoRa]
+     * @param [IN] max        Maximum payload length in bytes
+     */
+    virtual void SetMaxPayloadLength( ModemType modem, uint8_t max );
+    
     //-------------------------------------------------------------------------
     //                        Board relative functions
     //-------------------------------------------------------------------------