This library update contains changes according to the HW-modification.

Dependents:   LoRaWAN_Serial_port_driven_and_configurable_ELMO_based_on_TxRx_Template

Fork of SX1272lib by Espotel

Changes compared to original SX1272lib:

HW modification was made to remove RFO-output and replaced with PABOOST-output. PASELECT changed accordingly.

Revision:
0:669f3b0e91c8
Child:
1:51fd7a5843e5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sx1272/sx1272-hal.h	Thu Sep 17 14:42:20 2015 +0200
@@ -0,0 +1,184 @@
+/*
+/ _____)             _              | |
+( (____  _____ ____ _| |_ _____  ____| |__
+\____ \| ___ |    (_   _) ___ |/ ___)  _ \
+_____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+    ( C ) Semtech
+
+Description: Port of Semtech SX1276 C++ library to support SX1272 chipset performed by Espotel
+
+License: Revised BSD License, see LICENSE.TXT file include in the project
+
+Maintainers: www.espotel.com
+
+*/
+#ifndef __SX1272_HAL_H__
+#define __SX1272_HAL_H__
+#include "sx1272.h"
+
+/*! 
+ * Actual implementation of a SX1272 radio, includes some modifications to make it compatible with the MB1 LAS board
+ */
+class SX1272MB1xAS : public SX1272
+{
+protected:
+    /*!
+     * Antenna switch GPIO pins objects
+     */
+    DigitalInOut antSwitch;
+    
+private:
+    static const RadioRegisters_t RadioRegsInit[];
+    
+public:
+    SX1272MB1xAS( 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,
+            PinName antSwitch );
+
+    virtual ~SX1272MB1xAS( );
+    
+    protected:
+    /*!
+     * @brief Initializes the radio I/Os pins interface
+     */
+    virtual void IoInit( void );
+    
+    /*!
+     *  @brief Initializes the radio registers
+     */
+    virtual void RadioRegistersInit( );
+    
+    /*!
+     * @brief Initializes the radio SPI
+     */
+    virtual void SpiInit( void );
+    
+    /*!
+     * @brief Initializes DIO IRQ handlers
+     *
+     * @param [IN] irqHandlers Array containing the IRQ callback functions
+     */
+    virtual void IoIrqInit( DioIrqHandler *irqHandlers );
+
+    /*!
+     * @brief Deinitializes DIO IRQ handlers (switches off interrupts)
+     */
+    virtual void IoIrqDeInit( void );
+
+    /*!
+     * @brief De-initializes the radio I/Os pins interface. 
+     *
+     * \remark Useful when going in MCU lowpower modes
+     */
+    virtual void IoDeInit( void );
+
+    /*!
+     * @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 );
+
+    /*!
+     * @brief Set the RF Switch I/Os pins in Low Power mode
+     *
+     * @param [IN] status enable or disable
+     */
+    virtual void SetAntSwLowPower( bool status );
+
+    /*!
+     * @brief Initializes the RF Switch I/Os pins interface
+     */
+    virtual void AntSwInit( void );
+
+    /*!
+     * @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 );
+
+    /*!
+     * @brief Controls the antena switch if necessary.
+     *
+     * \remark see errata note
+     *
+     * @param [IN] rxTx [1: Tx, 0: Rx]
+     */
+    virtual void SetAntSw( uint8_t rxTx );
+    
+    public:
+    /*!
+     * @brief Detect the board connected by reading the value of the antenna switch pin
+     */
+    //virtual uint8_t DetectBoardType( void );
+    
+    /*!
+     * @brief Checks if the given RF frequency is supported by the hardware
+     *
+     * @param [IN] frequency RF frequency to be checked
+     * @retval isSupported [true: supported, false: unsupported]
+     */
+    virtual bool CheckRfFrequency( uint32_t frequency );
+    
+        /*!
+     * @brief Writes the radio register at the specified address
+     *
+     * @param [IN]: addr Register address
+     * @param [IN]: data New register value
+     */
+    virtual void Write ( uint8_t addr, uint8_t data ) ;
+    
+    /*!
+     * @brief Reads the radio register at the specified address
+     *
+     * @param [IN]: addr Register address
+     * @retval data Register value
+     */
+    virtual uint8_t Read ( uint8_t addr ) ;
+    
+    /*!
+     * @brief Writes multiple radio registers starting at address
+     *
+     * @param [IN] addr   First Radio register address
+     * @param [IN] buffer Buffer containing the new register's values
+     * @param [IN] size   Number of registers to be written
+     */
+    virtual void Write( uint8_t addr, uint8_t *buffer, uint8_t size ) ;
+    
+    /*!
+     * @brief Reads multiple radio registers starting at address
+     *
+     * @param [IN] addr First Radio register address
+     * @param [OUT] buffer Buffer where to copy the registers data
+     * @param [IN] size Number of registers to be read
+     */
+    virtual void Read ( uint8_t addr, uint8_t *buffer, uint8_t size ) ;
+    
+    /*!
+     * @brief Writes the buffer contents to the SX1272 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 ) ;
+
+    /*!
+     * @brief Reads the contents of the SX1272 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 ) ;
+    
+    /*!
+     * @brief Reset the SX1272
+     */
+    virtual void Reset( void );
+};
+
+#endif // __SX1272_HAL_H__