Driver for the SX1276 RF Transceiver(Updated to work with nucleo, tested with L073RZ)

Fork of SX1276Lib by Semtech

Files at this revision

API Documentation at this revision

Comitter:
mluis
Date:
Tue Dec 16 10:02:45 2014 +0000
Parent:
12:aa5b3bf7fdf4
Child:
14:8552d0b840be
Commit message:
Cosmetics; Added LICENSE text.; Added the possibility to specify the payload length for receiving fixed length frames.; Added SetModem function to radio interface.; Added LoRa syncword register definition

Changed in this revision

LICENSE.txt Show annotated file Show diff for this revision Revisions of this file
enums/enums.h Show annotated file Show diff for this revision Revisions of this file
radio/radio.cpp Show annotated file Show diff for this revision Revisions of this file
radio/radio.h Show annotated file Show diff for this revision Revisions of this file
registers/sx1276Regs-LoRa.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
typedefs/typedefs.h Show annotated file Show diff for this revision Revisions of this file
--- a/LICENSE.txt	Mon Oct 13 07:33:11 2014 +0000
+++ b/LICENSE.txt	Tue Dec 16 10:02:45 2014 +0000
@@ -0,0 +1,25 @@
+--- Revised BSD License ---
+Copyright (c) 2013, SEMTECH S.A.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of the Semtech corporation nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL SEMTECH S.A. BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
--- a/enums/enums.h	Mon Oct 13 07:33:11 2014 +0000
+++ b/enums/enums.h	Tue Dec 16 10:02:45 2014 +0000
@@ -16,45 +16,45 @@
 #define __ENUMS_H__
 
 /*!
- *	State of the radio:
- *	[IDLE,
- *	 RX_RUNNING, RX_TIMEOUT, RX_ERROR,
- * 	 TX_RUNNING, TX_TIMEOUT,
- 	 CAD]
+ *    State of the radio:
+ *    [IDLE,
+ *     RX_RUNNING, RX_TIMEOUT, RX_ERROR,
+ *     TX_RUNNING, TX_TIMEOUT,
+       CAD]
  */
 enum RadioState
 {
-	LOWPOWER = 0,
-	IDLE,
-	
-	RX,
-	RX_TIMEOUT,
-	RX_ERROR,
-	
-	TX,
-	TX_TIMEOUT,
+    LOWPOWER = 0,
+    IDLE,
+    
+    RX,
+    RX_TIMEOUT,
+    RX_ERROR,
+    
+    TX,
+    TX_TIMEOUT,
     
     CAD,
     CAD_DONE
 };
 
 /*!
- *	Type of the modem. [LORA / FSK]
+ *    Type of the modem. [LORA / FSK]
  */
 enum ModemType
 {
-	MODEM_FSK = 0,
-	MODEM_LORA
+    MODEM_FSK = 0,
+    MODEM_LORA
 };
 
 /*!
- *	Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS]
+ *    Type of the supported board. [SX1276MB1MAS / SX1276MB1LAS]
  */
 enum BoardType
 {
-	SX1276MB1MAS = 0,
-	SX1276MB1LAS,
-	UNKNOWN
+    SX1276MB1MAS = 0,
+    SX1276MB1LAS,
+    UNKNOWN
 };
 /*!
  * Radio FSK modem parameters
@@ -68,6 +68,7 @@
     uint32_t Datarate;
     uint16_t PreambleLen;
     bool     FixLen;
+    uint8_t  PayloadLen;
     bool     CrcOn;
     bool     IqInverted;
     bool     RxContinuous;
@@ -102,8 +103,9 @@
     uint8_t  Coderate;
     uint16_t PreambleLen;
     bool     FixLen;
+    uint8_t  PayloadLen;
     bool     CrcOn;
-    bool 	 FreqHopOn;
+    bool     FreqHopOn;
     uint8_t  HopPeriod;
     bool     IqInverted;
     bool     RxContinuous;
@@ -125,8 +127,8 @@
  */
 typedef struct
 {
-    RadioState				 State;
-    ModemType		         Modem;
+    RadioState               State;
+    ModemType                Modem;
     uint32_t                 Channel;
     RadioFskSettings_t       Fsk;
     RadioFskPacketHandler_t  FskPacketHandler;
--- a/radio/radio.cpp	Mon Oct 13 07:33:11 2014 +0000
+++ b/radio/radio.cpp	Tue Dec 16 10:02:45 2014 +0000
@@ -15,14 +15,14 @@
 #include "radio.h"
 
 Radio::Radio( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), 
-			  void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ) )
+              void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool channelActivityDetected ) )
 {
-	this->txDone = txDone;
-	this->txTimeout = txTimeout;
-	this->rxDone = rxDone;
-	this->rxTimeout = rxTimeout;
-	this->rxError = rxError;
-	this->fhssChangeChannel = fhssChangeChannel;
+    this->txDone = txDone;
+    this->txTimeout = txTimeout;
+    this->rxDone = rxDone;
+    this->rxTimeout = rxTimeout;
+    this->rxError = rxError;
+    this->fhssChangeChannel = fhssChangeChannel;
     this->cadDone = cadDone;
 }
 
--- a/radio/radio.h	Mon Oct 13 07:33:11 2014 +0000
+++ b/radio/radio.h	Tue Dec 16 10:02:45 2014 +0000
@@ -20,27 +20,27 @@
 #include "./enums/enums.h"
 
 /*!
- *	Interface for the radios, contains the main functions that a radio needs, and 5 callback functions
+ *    Interface for the radios, contains the main functions that a radio needs, and 5 callback functions
  */
 class Radio
 {
 protected:
 
-	//-------------------------------------------------------------------------
-	//						Callback functions pointers
-	//-------------------------------------------------------------------------
-	
-	/*!
+    //-------------------------------------------------------------------------
+    //                        Callback functions pointers
+    //-------------------------------------------------------------------------
+    
+    /*!
      * @brief  Tx Done callback prototype.
      */
-	void ( *txDone )( );
+    void ( *txDone )( );
 
-	/*!
+    /*!
      * @brief  Tx Timeout callback prototype.
      */
-	void ( *txTimeout ) ( );
+    void ( *txTimeout ) ( );
 
-	/*!
+    /*!
      * @brief Rx Done callback prototype.
      *
      * @param [IN] payload Received buffer pointer
@@ -50,19 +50,19 @@
      *                     FSK : N/A ( set to 0 )
      *                     LoRa: SNR value in dB
      */
-	void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );
+    void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr );
 
     /*!
      * @brief  Rx Timeout callback prototype.
      */
-	void ( *rxTimeout ) ( );
-	
+    void ( *rxTimeout ) ( );
+    
     /*!
      * @brief Rx Error callback prototype.
      */
-	void ( *rxError ) ( );
-	
-	/*!
+    void ( *rxError ) ( );
+    
+    /*!
      * \brief  FHSS Change Channel callback prototype.
      *
      * \param [IN] CurrentChannel   Index number of the current channel
@@ -74,43 +74,50 @@
      *
      * @param [IN] ChannelDetected    Channel Activity detected during the CAD
      */
-    void ( *cadDone ) ( bool ChannelActivityDetected );
-	
+    void ( *cadDone ) ( bool channelActivityDetected );
+    
 public:
-	//-------------------------------------------------------------------------
-	//						Constructor
-	//-------------------------------------------------------------------------
-	/*!
-	 * @brief Constructor of the radio object, the parameters are the callback functions described in the header.
-	 * @param [IN]	txDone
-	 * @param [IN]	txTimeout
-	 * @param [IN]	rxDone
-	 * @param [IN]	rxTimeout
-	 * @param [IN]	rxError
-	 */
-	Radio( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), 
-		   void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ) );
-	virtual ~Radio( ) {};
+    //-------------------------------------------------------------------------
+    //                        Constructor
+    //-------------------------------------------------------------------------
+    /*!
+     * @brief Constructor of the radio object, the parameters are the callback functions described in the header.
+     * @param [IN]    txDone
+     * @param [IN]    txTimeout
+     * @param [IN]    rxDone
+     * @param [IN]    rxTimeout
+     * @param [IN]    rxError
+     */
+    Radio( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), 
+           void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool channelActivityDetected ) );
+    virtual ~Radio( ) {};
 
-	//-------------------------------------------------------------------------
-	//						Pure virtual functions
-	//-------------------------------------------------------------------------
+    //-------------------------------------------------------------------------
+    //                        Pure virtual functions
+    //-------------------------------------------------------------------------
 
-	/*!
+    /*!
      * Return current radio status
      *
      * @param status Radio status.[RF_IDLE, RF_RX_RUNNING, RF_TX_RUNNING]
      */
     virtual RadioState GetState( void ) = 0; 
-    
-	/*!
+
+    /*!
+     * \brief Configures the radio with the given modem
+     *
+     * \param [IN] modem Modem to be used [0: FSK, 1: LoRa] 
+     */
+    virtual void SetModem( ModemType modem ) = 0;
+
+    /*!
      * @brief Sets the channel frequency
      *
      * @param [IN] freq         Channel RF frequency
      */
     virtual void SetChannel( uint32_t freq ) = 0;
     
-	/*!
+    /*!
      * @brief Sets the channels configuration
      *
      * @param [IN] modem      Radio modem to be used [0: FSK, 1: LoRa]
@@ -121,7 +128,7 @@
      */
     virtual bool IsChannelFree( ModemType modem, uint32_t freq, int8_t rssiThresh ) = 0;
     
-	/*!
+    /*!
      * @brief Generates a 32 bits random value based on the RSSI readings
      *
      * \remark This function sets the radio in LoRa modem mode and disables
@@ -133,7 +140,7 @@
      */
     virtual uint32_t Random( void )= 0;
     
-	/*!
+    /*!
      * @brief Sets the reception parameters
      *
      * @param [IN] modem        Radio modem to be used [0: FSK, 1: LoRa]
@@ -158,9 +165,10 @@
      *                          FSK : N/A ( set to 0 )
      *                          LoRa: timeout in symbols
      * @param [IN] fixLen       Fixed length packets [0: variable, 1: fixed]
+     * @param [IN] payloadLen   Sets payload length when fixed lenght is used
      * @param [IN] crcOn        Enables/Disables the CRC [0: OFF, 1: ON]
-     * @param [IN] FreqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
- 	 * @param [IN] HopPeriod    Number of symbols bewteen each hop (LoRa only)
+     * @param [IN] freqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
+     * @param [IN] hopPeriod    Number of symbols bewteen each hop (LoRa only)
      * @param [IN] iqInverted   Inverts IQ signals ( LoRa only )
      *                          FSK : N/A ( set to 0 )
      *                          LoRa: [0: not inverted, 1: inverted]
@@ -171,10 +179,11 @@
                                uint32_t datarate, uint8_t coderate,
                                uint32_t bandwidthAfc, uint16_t preambleLen,
                                uint16_t symbTimeout, bool fixLen,
-                               bool crcOn, bool FreqHopOn, uint8_t HopPeriod,
+                               uint8_t payloadLen,
+                               bool crcOn, bool freqHopOn, uint8_t hopPeriod,
                                bool iqInverted, bool rxContinuous ) = 0;
     
-	/*!
+    /*!
      * @brief Sets the transmission parameters
      *
      * @param [IN] modem        Radio modem to be used [0: FSK, 1: LoRa]
@@ -196,8 +205,8 @@
      * @param [IN] preambleLen  Sets the preamble length
      * @param [IN] fixLen       Fixed length packets [0: variable, 1: fixed]
      * @param [IN] crcOn        Enables disables the CRC [0: OFF, 1: ON]
-     * @param [IN] FreqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
- 	 * @param [IN] HopPeriod    Number of symbols bewteen each hop (LoRa only)
+     * @param [IN] freqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
+     * @param [IN] hopPeriod    Number of symbols bewteen each hop (LoRa only)
      * @param [IN] iqInverted   Inverts IQ signals ( LoRa only )
      *                          FSK : N/A ( set to 0 )
      *                          LoRa: [0: not inverted, 1: inverted]
@@ -206,10 +215,10 @@
     virtual void SetTxConfig( ModemType modem, int8_t power, uint32_t fdev,
                               uint32_t bandwidth, uint32_t datarate,
                               uint8_t coderate, uint16_t preambleLen,
-                              bool fixLen, bool crcOn, bool FreqHopOn,
-                              uint8_t HopPeriod, bool iqInverted, uint32_t timeout ) = 0;
+                              bool fixLen, bool crcOn, bool freqHopOn,
+                              uint8_t hopPeriod, bool iqInverted, uint32_t timeout ) = 0;
     
-	/*!
+    /*!
      * @brief Checks if the given RF frequency is supported by the hardware
      *
      * @param [IN] frequency RF frequency to be checked
@@ -217,7 +226,7 @@
      */
     virtual bool CheckRfFrequency( uint32_t frequency ) = 0;
     
-	/*!
+    /*!
      * @brief Computes the packet time on air for the given payload
      *
      * \Remark Can only be called once SetRxConfig or SetTxConfig have been called
@@ -229,7 +238,7 @@
      */
     virtual double TimeOnAir ( ModemType modem, uint8_t pktLen ) = 0;
     
-	/*!
+    /*!
      * @brief Sends the buffer of size. Prepares the packet to be sent and sets
      *        the radio in transmission
      *
@@ -238,43 +247,43 @@
      */
     virtual void Send( uint8_t *buffer, uint8_t size ) = 0;
     
-	/*!
+    /*!
      * @brief Sets the radio in sleep mode
      */
     virtual void Sleep( void ) = 0;
     
-	/*!
+    /*!
      * @brief Sets the radio in standby mode
      */
     virtual void Standby( void ) = 0;
     
-	/*!
+    /*!
      * @brief Sets the radio in CAD mode
      */
     virtual void StartCad( void ) = 0;
     
-	/*!
+    /*!
      * @brief Sets the radio in reception mode for the given time
      * @param [IN] timeout Reception timeout [us]
      *                     [0: continuous, others timeout]
      */
     virtual void Rx( uint32_t timeout ) = 0;
     
-	/*!
+    /*!
      * @brief Sets the radio in transmission mode for the given time
      * @param [IN] timeout Transmission timeout [us]
      *                     [0: continuous, others timeout]
      */
     virtual void Tx( uint32_t timeout ) = 0;
     
-	/*!
+    /*!
      * @brief Reads the current RSSI value
      *
      * @retval rssiValue Current RSSI value in [dBm]
      */
     virtual int16_t GetRssi ( ModemType modem ) = 0;
     
-	/*!
+    /*!
      * @brief Writes the radio register at the specified address
      *
      * @param [IN]: addr Register address
@@ -282,7 +291,7 @@
      */
     virtual void Write ( uint8_t addr, uint8_t data ) = 0;
     
-	/*!
+    /*!
      * @brief Reads the radio register at the specified address
      *
      * @param [IN]: addr Register address
@@ -290,7 +299,7 @@
      */
     virtual uint8_t Read ( uint8_t addr ) = 0;
     
-	/*!
+    /*!
      * @brief Writes multiple radio registers starting at address
      *
      * @param [IN] addr   First Radio register address
@@ -299,7 +308,7 @@
      */
     virtual void Write( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0;
     
-	/*!
+    /*!
      * @brief Reads multiple radio registers starting at address
      *
      * @param [IN] addr First Radio register address
@@ -307,22 +316,22 @@
      * @param [IN] size Number of registers to be read
      */
     virtual void Read ( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0;
-	
-	/*!
-	 * @brief Writes the buffer contents to the SX1276 FIFO
-	 *
-	 * @param [IN] buffer Buffer containing data to be put on the FIFO.
-	 * @param [IN] size Number of bytes to be written to the FIFO
-	 */
-	virtual void WriteFifo( uint8_t *buffer, uint8_t size ) = 0;
+    
+    /*!
+     * @brief Writes the buffer contents to the SX1276 FIFO
+     *
+     * @param [IN] buffer Buffer containing data to be put on the FIFO.
+     * @param [IN] size Number of bytes to be written to the FIFO
+     */
+    virtual void WriteFifo( uint8_t *buffer, uint8_t size ) = 0;
 
-	/*!
-	 * @brief Reads the contents of the SX1276 FIFO
-	 *
-	 * @param [OUT] buffer Buffer where to copy the FIFO read data.
-	 * @param [IN] size Number of bytes to be read from the FIFO
-	 */
-	virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0;
+    /*!
+     * @brief Reads the contents of the SX1276 FIFO
+     *
+     * @param [OUT] buffer Buffer where to copy the FIFO read data.
+     * @param [IN] size Number of bytes to be read from the FIFO
+     */
+    virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0;
 };
 
 #endif // __RADIO_H__
--- a/registers/sx1276Regs-LoRa.h	Mon Oct 13 07:33:11 2014 +0000
+++ b/registers/sx1276Regs-LoRa.h	Tue Dec 16 10:02:45 2014 +0000
@@ -66,6 +66,8 @@
 #define REG_LR_DETECTOPTIMIZE                       0x31
 #define REG_LR_INVERTIQ                             0x33
 #define REG_LR_DETECTIONTHRESHOLD                   0x37
+#define REG_LR_SYNCWORD                             0x39
+
 // end of documented register in datasheet
 // I/O settings
 #define REG_LR_DIOMAPPING1                          0x40
--- a/sx1276/sx1276.cpp	Mon Oct 13 07:33:11 2014 +0000
+++ b/sx1276/sx1276.cpp	Tue Dec 16 10:02:45 2014 +0000
@@ -41,37 +41,37 @@
 
 
 SX1276::SX1276( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), 
-				void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ),
-			    PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset,
+                void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool channelActivityDetected ),
+                PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset,
                 PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5 )
-			:   Radio( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone ),
-				spi( mosi, miso, sclk ),
-				nss( nss ),
-				reset( reset ),
-				dio0( dio0 ), dio1( dio1 ), dio2( dio2 ), dio3( dio3 ), dio4( dio4 ), dio5( dio5 ),
-				isRadioActive( false )
+            :   Radio( txDone, txTimeout, rxDone, rxTimeout, rxError, fhssChangeChannel, cadDone ),
+                spi( mosi, miso, sclk ),
+                nss( nss ),
+                reset( reset ),
+                dio0( dio0 ), dio1( dio1 ), dio2( dio2 ), dio3( dio3 ), dio4( dio4 ), dio5( dio5 ),
+                isRadioActive( false )
 {
-	wait_ms( 10 );
-	this->rxTx = 0;
-	this->rxBuffer = new uint8_t[RX_BUFFER_SIZE];
-	previousOpMode = RF_OPMODE_STANDBY;
-	
-	this->dioIrq = new DioIrqHandler[6];
+    wait_ms( 10 );
+    this->rxTx = 0;
+    this->rxBuffer = new uint8_t[RX_BUFFER_SIZE];
+    previousOpMode = RF_OPMODE_STANDBY;
+    
+    this->dioIrq = new DioIrqHandler[6];
 
-	this->dioIrq[0] = &SX1276::OnDio0Irq;
-	this->dioIrq[1] = &SX1276::OnDio1Irq;
-	this->dioIrq[2] = &SX1276::OnDio2Irq;
-	this->dioIrq[3] = &SX1276::OnDio3Irq;
-	this->dioIrq[4] = &SX1276::OnDio4Irq;
-	this->dioIrq[5] = NULL;
-	
-	this->settings.State = IDLE;
+    this->dioIrq[0] = &SX1276::OnDio0Irq;
+    this->dioIrq[1] = &SX1276::OnDio1Irq;
+    this->dioIrq[2] = &SX1276::OnDio2Irq;
+    this->dioIrq[3] = &SX1276::OnDio3Irq;
+    this->dioIrq[4] = &SX1276::OnDio4Irq;
+    this->dioIrq[5] = NULL;
+    
+    this->settings.State = IDLE;
 }
 
 SX1276::~SX1276( )
 {
-	delete this->rxBuffer;
-	delete this->dioIrq;
+    delete this->rxBuffer;
+    delete this->dioIrq;
 }
 
 void SX1276::RxChainCalibration( void )
@@ -206,7 +206,8 @@
                          uint32_t datarate, uint8_t coderate,
                          uint32_t bandwidthAfc, uint16_t preambleLen,
                          uint16_t symbTimeout, bool fixLen,
-                         bool crcOn, bool FreqHopOn, uint8_t HopPeriod,
+                         uint8_t payloadLen,
+                         bool crcOn, bool freqHopOn, uint8_t hopPeriod,
                          bool iqInverted, bool rxContinuous )
 {
     SetModem( modem );
@@ -219,6 +220,7 @@
             this->settings.Fsk.Datarate = datarate;
             this->settings.Fsk.BandwidthAfc = bandwidthAfc;
             this->settings.Fsk.FixLen = fixLen;
+            this->settings.Fsk.PayloadLen = payloadLen;
             this->settings.Fsk.CrcOn = crcOn;
             this->settings.Fsk.IqInverted = iqInverted;
             this->settings.Fsk.RxContinuous = rxContinuous;
@@ -240,6 +242,10 @@
                            RF_PACKETCONFIG1_PACKETFORMAT_MASK ) |
                            ( ( fixLen == 1 ) ? RF_PACKETCONFIG1_PACKETFORMAT_FIXED : RF_PACKETCONFIG1_PACKETFORMAT_VARIABLE ) |
                            ( crcOn << 4 ) );
+            if( fixLen == 1 )
+            {
+                Write( REG_PAYLOADLENGTH, payloadLen );
+            }
         }
         break;
     case MODEM_LORA:
@@ -254,12 +260,13 @@
             this->settings.LoRa.Datarate = datarate;
             this->settings.LoRa.Coderate = coderate;
             this->settings.LoRa.FixLen = fixLen;
+            this->settings.LoRa.PayloadLen = payloadLen;
             this->settings.LoRa.CrcOn = crcOn;
-            this->settings.LoRa.FreqHopOn = FreqHopOn;
-            this->settings.LoRa.HopPeriod = HopPeriod;
+            this->settings.LoRa.FreqHopOn = freqHopOn;
+            this->settings.LoRa.HopPeriod = hopPeriod;
             this->settings.LoRa.IqInverted = iqInverted;
             this->settings.LoRa.RxContinuous = rxContinuous;
-
+            
             if( datarate > 12 )
             {
                 datarate = 12;
@@ -305,6 +312,11 @@
             Write( REG_LR_PREAMBLEMSB, ( uint8_t )( ( preambleLen >> 8 ) & 0xFF ) );
             Write( REG_LR_PREAMBLELSB, ( uint8_t )( preambleLen & 0xFF ) );
 
+            if( fixLen == 1 )
+            {
+                Write( REG_LR_PAYLOADLENGTH, payloadLen );
+            }
+
             if( this->settings.LoRa.FreqHopOn == true )
             {
                 Write( REG_LR_PLLHOP, ( Read( REG_LR_PLLHOP ) & RFLR_PLLHOP_FASTHOP_MASK ) | RFLR_PLLHOP_FASTHOP_ON );
@@ -337,8 +349,8 @@
 void SX1276::SetTxConfig( ModemType modem, int8_t power, uint32_t fdev, 
                         uint32_t bandwidth, uint32_t datarate,
                         uint8_t coderate, uint16_t preambleLen,
-                        bool fixLen, bool crcOn, bool FreqHopOn, 
-                        uint8_t HopPeriod, bool iqInverted, uint32_t timeout )
+                        bool fixLen, bool crcOn, bool freqHopOn, 
+                        uint8_t hopPeriod, bool iqInverted, uint32_t timeout )
 {
     uint8_t paConfig = 0;
     uint8_t paDac = 0;
@@ -432,7 +444,6 @@
                            RF_PACKETCONFIG1_PACKETFORMAT_MASK ) |
                            ( ( fixLen == 1 ) ? RF_PACKETCONFIG1_PACKETFORMAT_FIXED : RF_PACKETCONFIG1_PACKETFORMAT_VARIABLE ) |
                            ( crcOn << 4 ) );
-        
         }
         break;
     case MODEM_LORA:
@@ -450,8 +461,8 @@
             this->settings.LoRa.PreambleLen = preambleLen;
             this->settings.LoRa.FixLen = fixLen;
             this->settings.LoRa.CrcOn = crcOn;
-            this->settings.LoRa.FreqHopOn = FreqHopOn;
-            this->settings.LoRa.HopPeriod = HopPeriod;
+            this->settings.LoRa.FreqHopOn = freqHopOn;
+            this->settings.LoRa.HopPeriod = hopPeriod;
             this->settings.LoRa.IqInverted = iqInverted;
             this->settings.LoRa.TxTimeout = timeout;
 
@@ -678,8 +689,8 @@
 
 void SX1276::Sleep( void )
 {
-        // Initialize driver timeout timers
-   	txTimeoutTimer.detach(  );
+    // Initialize driver timeout timers
+    txTimeoutTimer.detach(  );
     rxTimeoutTimer.detach( );
     SetOpMode( RF_OPMODE_SLEEP );
 }
@@ -749,10 +760,8 @@
                                               //RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL |
                                               RFLR_IRQFLAGS_CADDETECTED );
                                               
-                // DIO0=RxDone
-                Write( REG_DIOMAPPING1, ( Read( REG_DIOMAPPING1 ) & RFLR_DIOMAPPING1_DIO0_MASK ) | RFLR_DIOMAPPING1_DIO0_00 );
-                // DIO2=FhssChangeChannel
-                Write( REG_DIOMAPPING1, ( Read( REG_DIOMAPPING1 ) & RFLR_DIOMAPPING1_DIO2_MASK ) | RFLR_DIOMAPPING1_DIO2_00 );  
+                // DIO0=RxDone, DIO2=FhssChangeChannel
+                Write( REG_DIOMAPPING1, ( Read( REG_DIOMAPPING1 ) & RFLR_DIOMAPPING1_DIO0_MASK & RFLR_DIOMAPPING1_DIO2_MASK  ) | RFLR_DIOMAPPING1_DIO0_00 | RFLR_DIOMAPPING1_DIO2_00 );
             }
             else
             {
@@ -867,7 +876,7 @@
     }
 
     this->settings.State = TX;
-	txTimeoutTimer.attach_us( this, &SX1276::OnTimeoutIrq, timeout );
+    txTimeoutTimer.attach_us( this, &SX1276::OnTimeoutIrq, timeout );
     SetOpMode( RF_OPMODE_TRANSMITTER );
 }
 
@@ -959,26 +968,26 @@
 {
     if( this->settings.Modem != modem )
     {
-	    this->settings.Modem = modem;
-	    switch( this->settings.Modem )
-	    {
-	    default:
-	    case MODEM_FSK:
-	        SetOpMode( RF_OPMODE_SLEEP );
-	        Write( REG_OPMODE, ( Read( REG_OPMODE ) & RFLR_OPMODE_LONGRANGEMODE_MASK ) | RFLR_OPMODE_LONGRANGEMODE_OFF );
-	    
-	        Write( REG_DIOMAPPING1, 0x00 );
-	        Write( REG_DIOMAPPING2, 0x30 ); // DIO5=ModeReady
-	        break;
-	    case MODEM_LORA:
-	        SetOpMode( RF_OPMODE_SLEEP );
-	        Write( REG_OPMODE, ( Read( REG_OPMODE ) & RFLR_OPMODE_LONGRANGEMODE_MASK ) | RFLR_OPMODE_LONGRANGEMODE_ON );
-			Write( 0x30, 0x00 ); //  IF = 0
-	        Write( REG_LR_DETECTOPTIMIZE, ( Read( REG_LR_DETECTOPTIMIZE ) & 0x7F ) ); // Manual IF
-	        Write( REG_DIOMAPPING1, 0x00 );
-	        Write( REG_DIOMAPPING2, 0x00 );
-	        break;
-	    }
+        this->settings.Modem = modem;
+        switch( this->settings.Modem )
+        {
+        default:
+        case MODEM_FSK:
+            SetOpMode( RF_OPMODE_SLEEP );
+            Write( REG_OPMODE, ( Read( REG_OPMODE ) & RFLR_OPMODE_LONGRANGEMODE_MASK ) | RFLR_OPMODE_LONGRANGEMODE_OFF );
+        
+            Write( REG_DIOMAPPING1, 0x00 );
+            Write( REG_DIOMAPPING2, 0x30 ); // DIO5=ModeReady
+            break;
+        case MODEM_LORA:
+            SetOpMode( RF_OPMODE_SLEEP );
+            Write( REG_OPMODE, ( Read( REG_OPMODE ) & RFLR_OPMODE_LONGRANGEMODE_MASK ) | RFLR_OPMODE_LONGRANGEMODE_ON );
+            Write( 0x30, 0x00 ); //  IF = 0
+            Write( REG_LR_DETECTOPTIMIZE, ( Read( REG_LR_DETECTOPTIMIZE ) & 0x7F ) ); // Manual IF
+            Write( REG_DIOMAPPING1, 0x00 );
+            Write( REG_DIOMAPPING2, 0x00 );
+            break;
+        }
     }
 }
 
@@ -1017,7 +1026,7 @@
         }
         break;
     case TX:
-    	this->settings.State = IDLE;
+        this->settings.State = IDLE;
         if( ( txTimeout != NULL ) )
         {
             txTimeout( );
@@ -1331,10 +1340,10 @@
                     // Clear Irq
                     Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL );
                     
-	                if( ( fhssChangeChannel != NULL ) )
-	                {
-	                    fhssChangeChannel( ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
-	                }
+                    if( ( fhssChangeChannel != NULL ) )
+                    {
+                        fhssChangeChannel( ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
+                    }
                 }    
                 break;
             default:
@@ -1352,10 +1361,10 @@
                     // Clear Irq
                     Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_FHSSCHANGEDCHANNEL );
                     
-	                if( ( fhssChangeChannel != NULL ) )
-	                {
-	                    fhssChangeChannel( ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
-	                }
+                    if( ( fhssChangeChannel != NULL ) )
+                    {
+                        fhssChangeChannel( ( Read( REG_LR_HOPCHANNEL ) & RFLR_HOPCHANNEL_CHANNEL_MASK ) );
+                    }
                 }    
                 break;
             default:
@@ -1374,23 +1383,23 @@
     case MODEM_FSK:
         break;
     case MODEM_LORA:
-    	if( ( Read( REG_LR_IRQFLAGS ) & 0x01 ) == 0x01 )
-    	{
-	        // Clear Irq
-    		Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDETECTED_MASK | RFLR_IRQFLAGS_CADDONE);
-	        if( ( cadDone != NULL ) )
-	        {
-	            cadDone( true );
-	        }
+        if( ( Read( REG_LR_IRQFLAGS ) & 0x01 ) == 0x01 )
+        {
+            // Clear Irq
+            Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDETECTED_MASK | RFLR_IRQFLAGS_CADDONE);
+            if( ( cadDone != NULL ) )
+            {
+                cadDone( true );
+            }
         }
         else
-        {		
-	        // Clear Irq
-	        Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDONE );
-	        if( ( cadDone != NULL ) )
-	        {
-	            cadDone( false );
-	        }
+        {        
+            // Clear Irq
+            Write( REG_LR_IRQFLAGS, RFLR_IRQFLAGS_CADDONE );
+            if( ( cadDone != NULL ) )
+            {
+                cadDone( false );
+            }
         }
         break;
     default:
@@ -1428,4 +1437,4 @@
     default:
         break;
     }
-}
\ No newline at end of file
+}
--- a/sx1276/sx1276.h	Mon Oct 13 07:33:11 2014 +0000
+++ b/sx1276/sx1276.h	Tue Dec 16 10:02:45 2014 +0000
@@ -25,7 +25,7 @@
 
 #define RX_BUFFER_SIZE                              256
 
-#define DEFAULT_TIMEOUT								200 //usec
+#define DEFAULT_TIMEOUT                             200 //usec
 #define RSSI_OFFSET                                 -139.0
 
 
@@ -57,77 +57,84 @@
     /*!
      * SX1276 DIO pins
      */
-	InterruptIn dio0;
-	InterruptIn dio1;
-	InterruptIn dio2; 
-	InterruptIn dio3;
-	InterruptIn dio4;
-	DigitalIn dio5;
-	
-	bool isRadioActive;
-	
-	uint8_t boardConnected; //1 = SX1276MB1LAS; 0 = SX1276MB1MAS
-	
-	uint8_t *rxBuffer;
-	
-	uint8_t previousOpMode;
-	
-	/*!
-	 * Hardware DIO IRQ functions
-	 */
-	DioIrqHandler *dioIrq;
-	
-	/*!
-	 * Tx and Rx timers
-	 */
-	Timeout txTimeoutTimer;
-	Timeout rxTimeoutTimer;
-	Timeout rxTimeoutSyncWord;
-	
-	/*!
-	 *  rxTx: [1: Tx, 0: Rx]
-	 */
-	uint8_t rxTx;
-	
-	RadioSettings_t settings;
-	
-	static const FskBandwidth_t FskBandwidths[] ;
+    InterruptIn dio0;
+    InterruptIn dio1;
+    InterruptIn dio2; 
+    InterruptIn dio3;
+    InterruptIn dio4;
+    DigitalIn dio5;
+    
+    bool isRadioActive;
+    
+    uint8_t boardConnected; //1 = SX1276MB1LAS; 0 = SX1276MB1MAS
+    
+    uint8_t *rxBuffer;
+    
+    uint8_t previousOpMode;
+    
+    /*!
+     * Hardware DIO IRQ functions
+     */
+    DioIrqHandler *dioIrq;
+    
+    /*!
+     * Tx and Rx timers
+     */
+    Timeout txTimeoutTimer;
+    Timeout rxTimeoutTimer;
+    Timeout rxTimeoutSyncWord;
+    
+    /*!
+     *  rxTx: [1: Tx, 0: Rx]
+     */
+    uint8_t rxTx;
+    
+    RadioSettings_t settings;
+    
+    static const FskBandwidth_t FskBandwidths[] ;
 protected:
 
-	/*!
-	* Performs the Rx chain calibration for LF and HF bands
-	* \remark Must be called just after the reset so all registers are at their
-	*         default values
-	*/
-	void RxChainCalibration( void );
+    /*!
+    * Performs the Rx chain calibration for LF and HF bands
+    * \remark Must be called just after the reset so all registers are at their
+    *         default values
+    */
+    void RxChainCalibration( void );
 
 public:
-	SX1276( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), 
-			void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ),
-			PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset,
+    SX1276( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), 
+            void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool channelActivityDetected ),
+            PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset,
             PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5 ); 
     SX1276( void ( *txDone )( ), void ( *txTimeout ) ( ), void ( *rxDone ) ( uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr ), 
-            void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool ChannelActivityDetected ) );
-	virtual ~SX1276( );
-	
-	//-------------------------------------------------------------------------
-	//						Redefined Radio functions
-	//-------------------------------------------------------------------------
-	/*!
+            void ( *rxTimeout ) ( ), void ( *rxError ) ( ), void ( *fhssChangeChannel ) ( uint8_t channelIndex ), void ( *cadDone ) ( bool channelActivityDetected ) );
+    virtual ~SX1276( );
+    
+    //-------------------------------------------------------------------------
+    //                        Redefined Radio functions
+    //-------------------------------------------------------------------------
+    /*!
      * Return current radio status
      *
      * @param status Radio status. [IDLE, RX_RUNNING, TX_RUNNING]
      */
     virtual RadioState GetState( void ); 
     
-	/*!
+    /*!
+     * @brief Configures the SX1276 with the given modem
+     *
+     * @param [IN] modem Modem to be used [0: FSK, 1: LoRa] 
+     */
+    virtual void SetModem( ModemType modem );
+
+    /*!
      * @brief Sets the channel frequency
      *
      * @param [IN] freq         Channel RF frequency
      */
     virtual void SetChannel( uint32_t freq );
     
-	/*!
+    /*!
      * @brief Sets the channels configuration
      *
      * @param [IN] modem      Radio modem to be used [0: FSK, 1: LoRa]
@@ -138,7 +145,7 @@
      */
     virtual bool IsChannelFree( ModemType modem, uint32_t freq, int8_t rssiThresh );
     
-	/*!
+    /*!
      * @brief Generates a 32 bits random value based on the RSSI readings
      *
      * \remark This function sets the radio in LoRa modem mode and disables
@@ -150,7 +157,7 @@
      */
     virtual uint32_t Random( void );
     
-	/*!
+    /*!
      * @brief Sets the reception parameters
      *
      * @param [IN] modem        Radio modem to be used [0: FSK, 1: LoRa]
@@ -175,9 +182,10 @@
      *                          FSK : N/A ( set to 0 )
      *                          LoRa: timeout in symbols
      * @param [IN] fixLen       Fixed length packets [0: variable, 1: fixed]
+     * @param [IN] payloadLen   Sets payload length when fixed lenght is used
      * @param [IN] crcOn        Enables/Disables the CRC [0: OFF, 1: ON]
-     * @param [IN] FreqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
- 	 * @param [IN] HopPeriod    Number of symbols bewteen each hop (LoRa only)
+     * @param [IN] freqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
+     * @param [IN] hopPeriod    Number of symbols bewteen each hop (LoRa only)
      * @param [IN] iqInverted   Inverts IQ signals ( LoRa only )
      *                          FSK : N/A ( set to 0 )
      *                          LoRa: [0: not inverted, 1: inverted]
@@ -188,10 +196,11 @@
                                uint32_t datarate, uint8_t coderate,
                                uint32_t bandwidthAfc, uint16_t preambleLen,
                                uint16_t symbTimeout, bool fixLen,
-                               bool crcOn, bool FreqHopOn, uint8_t HopPeriod,
+                               uint8_t payloadLen,
+                               bool crcOn, bool freqHopOn, uint8_t hopPeriod,
                                bool iqInverted, bool rxContinuous );
     
-	/*!
+    /*!
      * @brief Sets the transmission parameters
      *
      * @param [IN] modem        Radio modem to be used [0: FSK, 1: LoRa]
@@ -213,8 +222,8 @@
      * @param [IN] preambleLen  Sets the preamble length
      * @param [IN] fixLen       Fixed length packets [0: variable, 1: fixed]
      * @param [IN] crcOn        Enables disables the CRC [0: OFF, 1: ON]
-     * @param [IN] FreqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
- 	 * @param [IN] HopPeriod    Number of symbols bewteen each hop (LoRa only)
+     * @param [IN] freqHopOn    Enables disables the intra-packet frequency hopping  [0: OFF, 1: ON] (LoRa only)
+     * @param [IN] hopPeriod    Number of symbols bewteen each hop (LoRa only)
      * @param [IN] iqInverted   Inverts IQ signals ( LoRa only )
      *                          FSK : N/A ( set to 0 )
      *                          LoRa: [0: not inverted, 1: inverted]
@@ -223,10 +232,10 @@
     virtual void SetTxConfig( ModemType modem, int8_t power, uint32_t fdev,
                               uint32_t bandwidth, uint32_t datarate,
                               uint8_t coderate, uint16_t preambleLen,
-                              bool fixLen, bool crcOn, bool FreqHopOn,
-                              uint8_t HopPeriod, bool iqInverted, uint32_t timeout );
+                              bool fixLen, bool crcOn, bool freqHopOn,
+                              uint8_t hopPeriod, bool iqInverted, uint32_t timeout );
     
-	/*!
+    /*!
      * @brief Computes the packet time on air for the given payload
      *
      * \Remark Can only be called once SetRxConfig or SetTxConfig have been called
@@ -238,7 +247,7 @@
      */
     virtual double TimeOnAir ( ModemType modem, uint8_t pktLen );
     
-	/*!
+    /*!
      * @brief Sends the buffer of size. Prepares the packet to be sent and sets
      *        the radio in transmission
      *
@@ -247,43 +256,43 @@
      */
     virtual void Send( uint8_t *buffer, uint8_t size );
     
-	/*!
+    /*!
      * @brief Sets the radio in sleep mode
      */
     virtual void Sleep( void );
     
-	/*!
+    /*!
      * @brief Sets the radio in standby mode
      */
     virtual void Standby( void );
     
-	/*!
+    /*!
      * @brief Sets the radio in reception mode for the given time
      * @param [IN] timeout Reception timeout [us]
      *                     [0: continuous, others timeout]
      */
     virtual void Rx( uint32_t timeout );
     
-	/*!
+    /*!
      * @brief Sets the radio in transmission mode for the given time
      * @param [IN] timeout Transmission timeout [us]
      *                     [0: continuous, others timeout]
      */
     virtual void Tx( uint32_t timeout );
     
-	/*!
+    /*!
      * @brief Start a Channel Activity Detection
      */
-    virtual void StartCad( void );	
-	
-	/*!
+    virtual void StartCad( void );    
+    
+    /*!
      * @brief Reads the current RSSI value
      *
      * @retval rssiValue Current RSSI value in [dBm]
      */
     virtual int16_t GetRssi ( ModemType modem );
     
-	/*!
+    /*!
      * @brief Writes the radio register at the specified address
      *
      * @param [IN]: addr Register address
@@ -291,7 +300,7 @@
      */
     virtual void Write ( uint8_t addr, uint8_t data ) = 0;
     
-	/*!
+    /*!
      * @brief Reads the radio register at the specified address
      *
      * @param [IN]: addr Register address
@@ -299,7 +308,7 @@
      */
     virtual uint8_t Read ( uint8_t addr ) = 0;
     
-	/*!
+    /*!
      * @brief Writes multiple radio registers starting at address
      *
      * @param [IN] addr   First Radio register address
@@ -308,7 +317,7 @@
      */
     virtual void Write( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0;
     
-	/*!
+    /*!
      * @brief Reads multiple radio registers starting at address
      *
      * @param [IN] addr First Radio register address
@@ -316,98 +325,98 @@
      * @param [IN] size Number of registers to be read
      */
     virtual void Read ( uint8_t addr, uint8_t *buffer, uint8_t size ) = 0;
-	
-	/*!
-	 * @brief Writes the buffer contents to the SX1276 FIFO
-	 *
-	 * @param [IN] buffer Buffer containing data to be put on the FIFO.
-	 * @param [IN] size Number of bytes to be written to the FIFO
-	 */
-	virtual void WriteFifo( uint8_t *buffer, uint8_t size ) = 0;
+    
+    /*!
+     * @brief Writes the buffer contents to the SX1276 FIFO
+     *
+     * @param [IN] buffer Buffer containing data to be put on the FIFO.
+     * @param [IN] size Number of bytes to be written to the FIFO
+     */
+    virtual void WriteFifo( uint8_t *buffer, uint8_t size ) = 0;
 
-	/*!
-	 * @brief Reads the contents of the SX1276 FIFO
-	 *
-	 * @param [OUT] buffer Buffer where to copy the FIFO read data.
-	 * @param [IN] size Number of bytes to be read from the FIFO
-	 */
-	virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0;
-	/*!
-	 * @brief Resets the SX1276
-	 */
-	virtual void Reset( void ) = 0;
-	
-	//-------------------------------------------------------------------------
-	//						Board relative functions
-	//-------------------------------------------------------------------------
-	
+    /*!
+     * @brief Reads the contents of the SX1276 FIFO
+     *
+     * @param [OUT] buffer Buffer where to copy the FIFO read data.
+     * @param [IN] size Number of bytes to be read from the FIFO
+     */
+    virtual void ReadFifo( uint8_t *buffer, uint8_t size ) = 0;
+    /*!
+     * @brief Resets the SX1276
+     */
+    virtual void Reset( void ) = 0;
+    
+    //-------------------------------------------------------------------------
+    //                        Board relative functions
+    //-------------------------------------------------------------------------
+    
 protected:
-	/*!
-	 * @brief Initializes the radio I/Os pins interface
-	 */
-	virtual void IoInit( void ) = 0;
-	
-	/*!
-	 *	@brief Initializes the radio registers
-	 */
-	virtual void RadioRegistersInit( ) = 0;
-	
-	/*!
-	 * @brief Initializes the radio SPI
-	 */
-	virtual void SpiInit( void ) = 0;
-	
-	/*!
-	 * @brief Initializes DIO IRQ handlers
-	 *
-	 * @param [IN] irqHandlers Array containing the IRQ callback functions
-	 */
-	virtual void IoIrqInit( DioIrqHandler *irqHandlers ) = 0;
+    /*!
+     * @brief Initializes the radio I/Os pins interface
+     */
+    virtual void IoInit( void ) = 0;
+    
+    /*!
+     *    @brief Initializes the radio registers
+     */
+    virtual void RadioRegistersInit( ) = 0;
+    
+    /*!
+     * @brief Initializes the radio SPI
+     */
+    virtual void SpiInit( void ) = 0;
+    
+    /*!
+     * @brief Initializes DIO IRQ handlers
+     *
+     * @param [IN] irqHandlers Array containing the IRQ callback functions
+     */
+    virtual void IoIrqInit( DioIrqHandler *irqHandlers ) = 0;
 
-	/*!
-	 * @brief De-initializes the radio I/Os pins interface. 
-	 *
-	 * \remark Useful when going in MCU lowpower modes
-	 */
-	virtual void IoDeInit( void ) = 0;
+    /*!
+     * @brief De-initializes the radio I/Os pins interface. 
+     *
+     * \remark Useful when going in MCU lowpower modes
+     */
+    virtual void IoDeInit( void ) = 0;
 
-	/*!
-	 * @brief Gets the board PA selection configuration
-	 *
-	 * @param [IN] channel Channel frequency in Hz
-	 * @retval PaSelect RegPaConfig PaSelect value
-	 */
-	virtual uint8_t GetPaSelect( uint32_t channel ) = 0;
+    /*!
+     * @brief Gets the board PA selection configuration
+     *
+     * @param [IN] channel Channel frequency in Hz
+     * @retval PaSelect RegPaConfig PaSelect value
+     */
+    virtual uint8_t GetPaSelect( uint32_t channel ) = 0;
 
-	/*!
-	 * @brief Set the RF Switch I/Os pins in Low Power mode
-	 *
-	 * @param [IN] status enable or disable
-	 */
-	virtual void SetAntSwLowPower( bool status ) = 0;
+    /*!
+     * @brief Set the RF Switch I/Os pins in Low Power mode
+     *
+     * @param [IN] status enable or disable
+     */
+    virtual void SetAntSwLowPower( bool status ) = 0;
 
-	/*!
-	 * @brief Initializes the RF Switch I/Os pins interface
-	 */
-	virtual void AntSwInit( void ) = 0;
+    /*!
+     * @brief Initializes the RF Switch I/Os pins interface
+     */
+    virtual void AntSwInit( void ) = 0;
 
-	/*!
-	 * @brief De-initializes the RF Switch I/Os pins interface 
-	 *
-	 * \remark Needed to decrease the power consumption in MCU lowpower modes
-	 */
-	virtual void AntSwDeInit( void ) = 0;
+    /*!
+     * @brief De-initializes the RF Switch I/Os pins interface 
+     *
+     * \remark Needed to decrease the power consumption in MCU lowpower modes
+     */
+    virtual void AntSwDeInit( void ) = 0;
 
-	/*!
-	 * @brief Controls the antena switch if necessary.
-	 *
-	 * \remark see errata note
-	 *
-	 * @param [IN] rxTx [1: Tx, 0: Rx]
-	 */
-	virtual void SetAntSw( uint8_t rxTx ) = 0;
-	
-	/*!
+    /*!
+     * @brief Controls the antena switch if necessary.
+     *
+     * \remark see errata note
+     *
+     * @param [IN] rxTx [1: Tx, 0: Rx]
+     */
+    virtual void SetAntSw( uint8_t rxTx ) = 0;
+    
+    /*!
      * @brief Checks if the given RF frequency is supported by the hardware
      *
      * @param [IN] frequency RF frequency to be checked
@@ -416,66 +425,59 @@
     virtual bool CheckRfFrequency( uint32_t frequency ) = 0;
 protected:
 
-	/*!
-	 * @brief Sets the SX1276 operating mode
-	 *
-	 * @param [IN] opMode New operating mode
-	 */
-	virtual void SetOpMode( uint8_t opMode );
+    /*!
+     * @brief Sets the SX1276 operating mode
+     *
+     * @param [IN] opMode New operating mode
+     */
+    virtual void SetOpMode( uint8_t opMode );
 
-	/*!
-	 * @brief Configures the SX1276 with the given modem
-	 *
-	 * @param [IN] modem Modem to be used [0: FSK, 1: LoRa] 
-	 */
-	virtual void SetModem( ModemType modem );
+    /*
+     * SX1276 DIO IRQ callback functions prototype
+     */
 
-	/*
-	 * SX1276 DIO IRQ callback functions prototype
-	 */
+    /*!
+     * @brief DIO 0 IRQ callback
+     */
+    virtual void OnDio0Irq( void );
 
-	/*!
-	 * @brief DIO 0 IRQ callback
-	 */
-	virtual void OnDio0Irq( void );
+    /*!
+     * @brief DIO 1 IRQ callback
+     */
+    virtual void OnDio1Irq( void );
 
-	/*!
-	 * @brief DIO 1 IRQ callback
-	 */
-	virtual void OnDio1Irq( void );
+    /*!
+     * @brief DIO 2 IRQ callback
+     */
+    virtual void OnDio2Irq( void );
 
-	/*!
-	 * @brief DIO 2 IRQ callback
-	 */
-	virtual void OnDio2Irq( void );
+    /*!
+     * @brief DIO 3 IRQ callback
+     */
+    virtual void OnDio3Irq( void );
 
-	/*!
-	 * @brief DIO 3 IRQ callback
-	 */
-	virtual void OnDio3Irq( void );
-
-	/*!
-	 * @brief DIO 4 IRQ callback
-	 */
-	virtual void OnDio4Irq( void );
+    /*!
+     * @brief DIO 4 IRQ callback
+     */
+    virtual void OnDio4Irq( void );
 
-	/*!
-	 * @brief DIO 5 IRQ callback
-	 */
-	virtual void OnDio5Irq( void );
+    /*!
+     * @brief DIO 5 IRQ callback
+     */
+    virtual void OnDio5Irq( void );
 
-	/*!
-	 * @brief Tx & Rx timeout timer callback
-	 */
-	virtual void OnTimeoutIrq( void );
-	
-	/*!
-	 * Returns the known FSK bandwidth registers value
-	 *
-	 * \param [IN] bandwidth Bandwidth value in Hz
-	 * \retval regValue Bandwidth register value.
-	 */
-	static uint8_t GetFskBandwidthRegValue( uint32_t bandwidth );
+    /*!
+     * @brief Tx & Rx timeout timer callback
+     */
+    virtual void OnTimeoutIrq( void );
+    
+    /*!
+     * Returns the known FSK bandwidth registers value
+     *
+     * \param [IN] bandwidth Bandwidth value in Hz
+     * \retval regValue Bandwidth register value.
+     */
+    static uint8_t GetFskBandwidthRegValue( uint32_t bandwidth );
 };
 
 #endif //__SX1276_H__
--- a/typedefs/typedefs.h	Mon Oct 13 07:33:11 2014 +0000
+++ b/typedefs/typedefs.h	Tue Dec 16 10:02:45 2014 +0000
@@ -45,7 +45,7 @@
  */
 typedef struct
 {
-    ModemType	Modem;
+    ModemType   Modem;
     uint8_t     Addr;
     uint8_t     Value;
 }RadioRegisters_t;