Skip to content
Snippets Groups Projects
Select Git revision
  • master
1 result

sx126x.c

Blame
  • sx126x.c 22.17 KiB
    /*!
     * \file      sx126x.c
     *
     * \brief     SX126x driver implementation
     *
     * \copyright Revised BSD License, see section \ref LICENSE.
     *
     * \code
     *                ______                              _
     *               / _____)             _              | |
     *              ( (____  _____ ____ _| |_ _____  ____| |__
     *               \____ \| ___ |    (_   _) ___ |/ ___)  _ \
     *               _____) ) ____| | | || |_| ____( (___| | | |
     *              (______/|_____)_|_|_| \__)_____)\____)_| |_|
     *              (C)2013-2017 Semtech
     *
     * \endcode
     *
     * \author    Miguel Luis ( Semtech )
     *
     * \author    Gregory Cristian ( Semtech )
     */
    #include <math.h>
    #include <string.h>
    #include "../../board.h"
    #include "../radio.h"
    #include "sx126x.h"
    #include "sx126x-board.h"
    /*!
     * \brief Radio registers definition
     */
    typedef struct
    {
        uint16_t      Addr;                             //!< The address of the register
        uint8_t       Value;                            //!< The value of the register
    }RadioRegisters_t;
    
    /*!
     * \brief Holds the internal operating mode of the radio
     */
    static RadioOperatingModes_t OperatingMode;
    
    /*!
     * \brief Stores the current packet type set in the radio
     */
    static RadioPacketTypes_t PacketType;
    
    /*!
     * \brief Stores the current packet header type set in the radio
     */
    static volatile RadioLoRaPacketLengthsMode_t LoRaHeaderType;
    
    /*!
     * \brief Stores the last frequency error measured on LoRa received packet
     */
    volatile uint32_t FrequencyError = 0;
    
    /*!
     * \brief Hold the status of the Image calibration
     */
    static bool ImageCalibrated = false;
    
    /*
     * SX126x DIO IRQ callback functions prototype
     */
    
    /*!
     * \brief DIO 0 IRQ callback
     */
    void SX126xOnDioIrq( void );