/* / _____) _ | | ( (____ _____ ____ _| |_ _____ ____| |__ \____ \| ___ | (_ _) ___ |/ ___) _ \ _____) ) ____| | | || |_| ____( (___| | | | (______/|_____)_|_|_| \__)_____)\____)_| |_| (C)2019 Semtech Description: Functions used to handle LoRa concentrator SX1255/SX1257 radios. License: Revised BSD License, see LICENSE.TXT file include in the project */ #ifndef _LORAGW_SX125X_H #define _LORAGW_SX125X_H /* -------------------------------------------------------------------------- */ /* --- DEPENDANCIES --------------------------------------------------------- */ #include /* C99 types */ #include /* bool type */ /* -------------------------------------------------------------------------- */ /* --- INTERNAL SHARED TYPES ------------------------------------------------ */ struct radio_reg_s { uint8_t addr; /* base address of the register */ uint8_t offs; /* position of the register LSB (between 0 to 7) */ uint8_t leng; /* number of bits in the register */ }; /* -------------------------------------------------------------------------- */ /* --- PUBLIC MACROS -------------------------------------------------------- */ #define SX1257_FREQ_TO_REG(f) (uint32_t)((uint64_t)f * (1 << 19) / 32000000U) #define SX1255_FREQ_TO_REG(f) (uint32_t)((uint64_t)f * (1 << 20) / 32000000U) /* -------------------------------------------------------------------------- */ /* --- PUBLIC CONSTANTS ----------------------------------------------------- */ #define LGW_REG_SUCCESS 0 #define LGW_REG_ERROR -1 #define SX125x_32MHz_FRAC 15625 /* irreductible fraction for PLL register caculation */ #define SX125x_TX_DAC_CLK_SEL 0 /* 0:int, 1:ext */ #define SX125x_TX_DAC_GAIN 2 /* 3:0, 2:-3, 1:-6, 0:-9 dBFS (default 2) */ #define SX125x_TX_MIX_GAIN 14 /* -38 + 2*TxMixGain dB (default 14) */ #define SX125x_TX_PLL_BW 1 /* 0:75, 1:150, 2:225, 3:300 kHz (default 3) */ #define SX125x_TX_ANA_BW 0 /* 17.5 / 2*(41-TxAnaBw) MHz (default 0) */ #define SX125x_TX_DAC_BW 5 /* 24 + 8*TxDacBw Nb FIR taps (default 2) */ #define SX125x_RX_LNA_GAIN 1 /* 1 to 6, 1 highest gain */ #define SX125x_RX_BB_GAIN 15 /* 0 to 15 , 15 highest gain */ #define SX125x_LNA_ZIN 0 /* 0:50, 1:200 Ohms (default 1) */ #define SX125x_RX_ADC_BW 7 /* 0 to 7, 2:100