Hexmodal SX1276lib
Dependents: LoRaWAN-hello-world_Class_C_Anish
Diff: sx1276/sx1276-hal.h
- Revision:
- 26:d09a8ef807e2
- Parent:
- 22:7f3aab69cca9
diff -r 7f3aab69cca9 -r d09a8ef807e2 sx1276/sx1276-hal.h --- a/sx1276/sx1276-hal.h Thu Nov 26 16:55:15 2015 +0000 +++ b/sx1276/sx1276-hal.h Mon Apr 24 09:26:23 2017 +0000 @@ -17,15 +17,16 @@ #include "sx1276.h" /*! - * \brief Radio hardware registers initialization definition + * @brief Radio hardware registers initialization definition * - * \remark Can be automatically generated by the SX1276 GUI (not yet implemented) + * @remark Can be automatically generated by the SX1276 GUI (not yet implemented) */ #define RADIO_INIT_REGISTERS_VALUE \ { \ { MODEM_FSK , REG_LNA , 0x23 },\ { MODEM_FSK , REG_RXCONFIG , 0x1E },\ { MODEM_FSK , REG_RSSICONFIG , 0xD2 },\ + { MODEM_FSK , REG_AFCFEI , 0x01 },\ { MODEM_FSK , REG_PREAMBLEDETECT , 0xAA },\ { MODEM_FSK , REG_OSC , 0x07 },\ { MODEM_FSK , REG_SYNCCONFIG , 0x12 },\ @@ -49,29 +50,28 @@ /*! * Antenna switch GPIO pins objects */ - DigitalInOut antSwitch; - - DigitalIn fake; - + DigitalInOut AntSwitch; + DigitalIn Fake; + private: static const RadioRegisters_t RadioRegsInit[]; - + public: SX1276MB1xAS( RadioEvents_t *events, PinName mosi, PinName miso, PinName sclk, PinName nss, PinName reset, PinName dio0, PinName dio1, PinName dio2, PinName dio3, PinName dio4, PinName dio5, PinName antSwitch ); - + SX1276MB1xAS( RadioEvents_t *events ); - + virtual ~SX1276MB1xAS( ) { }; - - protected: + +protected: /*! * @brief Initializes the radio I/Os pins interface */ virtual void IoInit( void ); - + /*! * @brief Initializes the radio registers */ @@ -81,7 +81,7 @@ * @brief Initializes the radio SPI */ virtual void SpiInit( void ); - + /*! * @brief Initializes DIO IRQ handlers * @@ -97,6 +97,13 @@ virtual void IoDeInit( void ); /*! + * \brief Sets the radio output power. + * + * @param [IN] power Sets the RF output power + */ + virtual void SetRfTxPower( int8_t power ); + + /*! * @brief Gets the board PA selection configuration * * @param [IN] channel Channel frequency in Hz @@ -119,25 +126,25 @@ /*! * @brief De-initializes the RF Switch I/Os pins interface * - * \remark Needed to decrease the power consumption in MCU lowpower modes + * @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 + * @remark see errata note * - * @param [IN] rxTx [1: Tx, 0: Rx] + * @param [IN] opMode Current radio operating mode */ - virtual void SetAntSw( uint8_t rxTx ); - - public: + virtual void SetAntSw( uint8_t opMode ); + +public: /*! * @brief Detect the board connected by reading the value of the antenna switch pin */ - virtual uint8_t DetectBoardType( void ); - + virtual uint8_t DetectBoardType( void ); + /*! * @brief Checks if the given RF frequency is supported by the hardware * @@ -145,15 +152,15 @@ * @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 * @@ -161,7 +168,7 @@ * @retval data Register value */ virtual uint8_t Read ( uint8_t addr ) ; - + /*! * @brief Writes multiple radio registers starting at address * @@ -170,7 +177,7 @@ * @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 * @@ -179,7 +186,7 @@ * @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 SX1276 FIFO * @@ -195,7 +202,7 @@ * @param [IN] size Number of bytes to be read from the FIFO */ virtual void ReadFifo( uint8_t *buffer, uint8_t size ) ; - + /*! * @brief Reset the SX1276 */