Prototype RF driver for STM Sub-1 GHz RF expansion board based on the SPSGRF-868 module for STM32 Nucleo.

Prototype RF Driver for STM Sub-1 GHz RF Expansion Boards based on the SPSGRF-868 and SPSGRF-915 Modules for STM32 Nucleo

Currently supported boards:

Note, in order to use expansion board X-NUCLEO-IDS01A4 in mbed you need to perform the following HW modifications on the board:

  • Unmount resistor R4
  • Mount resistor R7

Furthermore, on some Nucleo development boards (e.g. the NUCLEO_F429ZI), in order to be able to use Ethernet together with these Sub-1 GHz RF expansion boards, you need to compile this driver with macro SPIRIT1_SPI_MOSI=PB_5 defined, while the development board typically requires some HW modification as e.g. described here!

This driver can be used together with the 6LoWPAN stack (a.k.a. Nanostack).

Committer:
Wolfgang Betz
Date:
Tue Nov 22 11:40:10 2016 +0100
Revision:
34:edda6a7238ec
Child:
67:93bec0baf1de
Perform re-naming

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 34:edda6a7238ec 1 /**
Wolfgang Betz 34:edda6a7238ec 2 ******************************************************************************
Wolfgang Betz 34:edda6a7238ec 3 * @file SPIRIT_Radio.h
Wolfgang Betz 34:edda6a7238ec 4 * @author VMA division - AMS
Wolfgang Betz 34:edda6a7238ec 5 * @version 3.2.2
Wolfgang Betz 34:edda6a7238ec 6 * @date 08-July-2015
Wolfgang Betz 34:edda6a7238ec 7 * @brief This file provides all the low level API to manage Analog and Digital
Wolfgang Betz 34:edda6a7238ec 8 * radio part of SPIRIT.
Wolfgang Betz 34:edda6a7238ec 9 * @details
Wolfgang Betz 34:edda6a7238ec 10 *
Wolfgang Betz 34:edda6a7238ec 11 * In order to configure the Radio main parameters, the user can
Wolfgang Betz 34:edda6a7238ec 12 * fit <i>SRadioInit</i> structure the and call the <i>SpiritRadioInit()</i>
Wolfgang Betz 34:edda6a7238ec 13 * function passing its pointer as an argument.
Wolfgang Betz 34:edda6a7238ec 14 *
Wolfgang Betz 34:edda6a7238ec 15 * <b>Example:</b>
Wolfgang Betz 34:edda6a7238ec 16 * @code
Wolfgang Betz 34:edda6a7238ec 17 *
Wolfgang Betz 34:edda6a7238ec 18 * SRadioInit radioInit = {
Wolfgang Betz 34:edda6a7238ec 19 * 0, // Xtal offset in ppm
Wolfgang Betz 34:edda6a7238ec 20 * 433.4e6, // base frequency
Wolfgang Betz 34:edda6a7238ec 21 * 20e3, // channel space
Wolfgang Betz 34:edda6a7238ec 22 * 0, // channel number
Wolfgang Betz 34:edda6a7238ec 23 * FSK, // modulation select
Wolfgang Betz 34:edda6a7238ec 24 * 38400, // datarate
Wolfgang Betz 34:edda6a7238ec 25 * 20e3, // frequency deviation
Wolfgang Betz 34:edda6a7238ec 26 * 100.5e3 // channel filter bandwidth
Wolfgang Betz 34:edda6a7238ec 27 * };
Wolfgang Betz 34:edda6a7238ec 28 *
Wolfgang Betz 34:edda6a7238ec 29 * ...
Wolfgang Betz 34:edda6a7238ec 30 *
Wolfgang Betz 34:edda6a7238ec 31 * SpiritRadioInit(&radioInit);
Wolfgang Betz 34:edda6a7238ec 32 * @endcode
Wolfgang Betz 34:edda6a7238ec 33 *
Wolfgang Betz 34:edda6a7238ec 34 * Another important parameter for the radio configuration is the
Wolfgang Betz 34:edda6a7238ec 35 * transmission power.
Wolfgang Betz 34:edda6a7238ec 36 * The user is allowed to configure it using the function <i>SpiritRadioSetPALeveldBm()</i>
Wolfgang Betz 34:edda6a7238ec 37 * which sets the PA LEVEL specified by the first argument to the
Wolfgang Betz 34:edda6a7238ec 38 * power expressed in dBm by the second parameter.
Wolfgang Betz 34:edda6a7238ec 39 *
Wolfgang Betz 34:edda6a7238ec 40 * <b>Example:</b>
Wolfgang Betz 34:edda6a7238ec 41 * @code
Wolfgang Betz 34:edda6a7238ec 42 *
Wolfgang Betz 34:edda6a7238ec 43 * SpiritRadioSetPALeveldBm(0 , 10.0);
Wolfgang Betz 34:edda6a7238ec 44 *
Wolfgang Betz 34:edda6a7238ec 45 * @endcode
Wolfgang Betz 34:edda6a7238ec 46 *
Wolfgang Betz 34:edda6a7238ec 47 *
Wolfgang Betz 34:edda6a7238ec 48 * @note The effective power that is set can be a little different from the
Wolfgang Betz 34:edda6a7238ec 49 * passed argument in dBm because the function performs an approximation.
Wolfgang Betz 34:edda6a7238ec 50 *
Wolfgang Betz 34:edda6a7238ec 51
Wolfgang Betz 34:edda6a7238ec 52 * @attention
Wolfgang Betz 34:edda6a7238ec 53 *
Wolfgang Betz 34:edda6a7238ec 54 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Wolfgang Betz 34:edda6a7238ec 55 *
Wolfgang Betz 34:edda6a7238ec 56 * Redistribution and use in source and binary forms, with or without modification,
Wolfgang Betz 34:edda6a7238ec 57 * are permitted provided that the following conditions are met:
Wolfgang Betz 34:edda6a7238ec 58 * 1. Redistributions of source code must retain the above copyright notice,
Wolfgang Betz 34:edda6a7238ec 59 * this list of conditions and the following disclaimer.
Wolfgang Betz 34:edda6a7238ec 60 * 2. Redistributions in binary form must reproduce the above copyright notice,
Wolfgang Betz 34:edda6a7238ec 61 * this list of conditions and the following disclaimer in the documentation
Wolfgang Betz 34:edda6a7238ec 62 * and/or other materials provided with the distribution.
Wolfgang Betz 34:edda6a7238ec 63 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Wolfgang Betz 34:edda6a7238ec 64 * may be used to endorse or promote products derived from this software
Wolfgang Betz 34:edda6a7238ec 65 * without specific prior written permission.
Wolfgang Betz 34:edda6a7238ec 66 *
Wolfgang Betz 34:edda6a7238ec 67 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Wolfgang Betz 34:edda6a7238ec 68 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wolfgang Betz 34:edda6a7238ec 69 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Wolfgang Betz 34:edda6a7238ec 70 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Wolfgang Betz 34:edda6a7238ec 71 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wolfgang Betz 34:edda6a7238ec 72 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Wolfgang Betz 34:edda6a7238ec 73 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Wolfgang Betz 34:edda6a7238ec 74 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Wolfgang Betz 34:edda6a7238ec 75 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Wolfgang Betz 34:edda6a7238ec 76 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wolfgang Betz 34:edda6a7238ec 77 *
Wolfgang Betz 34:edda6a7238ec 78 ******************************************************************************
Wolfgang Betz 34:edda6a7238ec 79 */
Wolfgang Betz 34:edda6a7238ec 80
Wolfgang Betz 34:edda6a7238ec 81 /* Define to prevent recursive inclusion -------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 82 #ifndef __SPIRIT_RADIO_H
Wolfgang Betz 34:edda6a7238ec 83 #define __SPIRIT_RADIO_H
Wolfgang Betz 34:edda6a7238ec 84
Wolfgang Betz 34:edda6a7238ec 85
Wolfgang Betz 34:edda6a7238ec 86 /* Includes ------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 87
Wolfgang Betz 34:edda6a7238ec 88 #include "SPIRIT_Regs.h"
Wolfgang Betz 34:edda6a7238ec 89 #include "SPIRIT_Types.h"
Wolfgang Betz 34:edda6a7238ec 90 #include "SPIRIT_Config.h"
Wolfgang Betz 34:edda6a7238ec 91
Wolfgang Betz 34:edda6a7238ec 92
Wolfgang Betz 34:edda6a7238ec 93 #ifdef __cplusplus
Wolfgang Betz 34:edda6a7238ec 94 extern "C" {
Wolfgang Betz 34:edda6a7238ec 95 #endif
Wolfgang Betz 34:edda6a7238ec 96
Wolfgang Betz 34:edda6a7238ec 97
Wolfgang Betz 34:edda6a7238ec 98 /** @addtogroup SPIRIT_Libraries
Wolfgang Betz 34:edda6a7238ec 99 * @{
Wolfgang Betz 34:edda6a7238ec 100 */
Wolfgang Betz 34:edda6a7238ec 101
Wolfgang Betz 34:edda6a7238ec 102
Wolfgang Betz 34:edda6a7238ec 103 /** @defgroup SPIRIT_Radio Radio
Wolfgang Betz 34:edda6a7238ec 104 * @brief Configuration and management of SPIRIT RF Analog and Digital part.
Wolfgang Betz 34:edda6a7238ec 105 * @details See the file <i>@ref SPIRIT_Radio.h</i> for more details.
Wolfgang Betz 34:edda6a7238ec 106 * @{
Wolfgang Betz 34:edda6a7238ec 107 */
Wolfgang Betz 34:edda6a7238ec 108
Wolfgang Betz 34:edda6a7238ec 109
Wolfgang Betz 34:edda6a7238ec 110
Wolfgang Betz 34:edda6a7238ec 111 /** @defgroup Radio_Exported_Types Radio Exported Types
Wolfgang Betz 34:edda6a7238ec 112 * @{
Wolfgang Betz 34:edda6a7238ec 113 */
Wolfgang Betz 34:edda6a7238ec 114
Wolfgang Betz 34:edda6a7238ec 115
Wolfgang Betz 34:edda6a7238ec 116 /**
Wolfgang Betz 34:edda6a7238ec 117 * @brief SPIRIT XTAL frequency enumeration
Wolfgang Betz 34:edda6a7238ec 118 */
Wolfgang Betz 34:edda6a7238ec 119 typedef enum
Wolfgang Betz 34:edda6a7238ec 120 {
Wolfgang Betz 34:edda6a7238ec 121 XTAL_FLAG_24_MHz = 0x00, /*!< 24 MHz Xtal selected */
Wolfgang Betz 34:edda6a7238ec 122 XTAL_FLAG_26_MHz = 0x01 /*!< 26 MHz Xtal selected */
Wolfgang Betz 34:edda6a7238ec 123
Wolfgang Betz 34:edda6a7238ec 124 }XtalFlag;
Wolfgang Betz 34:edda6a7238ec 125
Wolfgang Betz 34:edda6a7238ec 126
Wolfgang Betz 34:edda6a7238ec 127 #define IS_XTAL_FLAG(FLAG) (((FLAG) == XTAL_FLAG_24_MHz) || \
Wolfgang Betz 34:edda6a7238ec 128 ((FLAG) == XTAL_FLAG_26_MHz))
Wolfgang Betz 34:edda6a7238ec 129
Wolfgang Betz 34:edda6a7238ec 130 /**
Wolfgang Betz 34:edda6a7238ec 131 * @brief SPIRIT Band enumeration
Wolfgang Betz 34:edda6a7238ec 132 */
Wolfgang Betz 34:edda6a7238ec 133 typedef enum
Wolfgang Betz 34:edda6a7238ec 134 {
Wolfgang Betz 34:edda6a7238ec 135 HIGH_BAND = 0x00, /*!< High_Band selected: from 779 MHz to 915 MHz */
Wolfgang Betz 34:edda6a7238ec 136 MIDDLE_BAND = 0x01, /*!< Middle Band selected: from 387 MHz to 470 MHz */
Wolfgang Betz 34:edda6a7238ec 137 LOW_BAND = 0x02, /*!< Low Band selected: from 300 MHz to 348 MHz */
Wolfgang Betz 34:edda6a7238ec 138 VERY_LOW_BAND = 0x03 /*!< Vary low Band selected: from 150 MHz to 174 MHz */
Wolfgang Betz 34:edda6a7238ec 139 }BandSelect;
Wolfgang Betz 34:edda6a7238ec 140
Wolfgang Betz 34:edda6a7238ec 141
Wolfgang Betz 34:edda6a7238ec 142 #define IS_BAND_SELECTED(BAND) ((BAND == HIGH_BAND) || \
Wolfgang Betz 34:edda6a7238ec 143 (BAND == MIDDLE_BAND) || \
Wolfgang Betz 34:edda6a7238ec 144 (BAND == LOW_BAND) || \
Wolfgang Betz 34:edda6a7238ec 145 (BAND == VERY_LOW_BAND))
Wolfgang Betz 34:edda6a7238ec 146
Wolfgang Betz 34:edda6a7238ec 147 /**
Wolfgang Betz 34:edda6a7238ec 148 * @brief SPIRIT Modulation enumeration
Wolfgang Betz 34:edda6a7238ec 149 */
Wolfgang Betz 34:edda6a7238ec 150 typedef enum
Wolfgang Betz 34:edda6a7238ec 151 {
Wolfgang Betz 34:edda6a7238ec 152 FSK = 0x00, /*!< 2-FSK modulation selected */
Wolfgang Betz 34:edda6a7238ec 153 GFSK_BT05 = 0x50, /*!< GFSK modulation selected with BT=0.5 */
Wolfgang Betz 34:edda6a7238ec 154 GFSK_BT1 = 0x10, /*!< GFSK modulation selected with BT=1 */
Wolfgang Betz 34:edda6a7238ec 155 ASK_OOK = 0x20, /*!< ASK or OOK modulation selected. ASK will use power ramping */
Wolfgang Betz 34:edda6a7238ec 156 MSK = 0x30 /*!< MSK modulation selected */
Wolfgang Betz 34:edda6a7238ec 157
Wolfgang Betz 34:edda6a7238ec 158 }ModulationSelect;
Wolfgang Betz 34:edda6a7238ec 159
Wolfgang Betz 34:edda6a7238ec 160
Wolfgang Betz 34:edda6a7238ec 161 #define IS_MODULATION_SELECTED(MOD) (((MOD) == FSK) || \
Wolfgang Betz 34:edda6a7238ec 162 ((MOD) == GFSK_BT05) || \
Wolfgang Betz 34:edda6a7238ec 163 ((MOD) == GFSK_BT1) || \
Wolfgang Betz 34:edda6a7238ec 164 ((MOD) == ASK_OOK) || \
Wolfgang Betz 34:edda6a7238ec 165 ((MOD) == MSK))
Wolfgang Betz 34:edda6a7238ec 166
Wolfgang Betz 34:edda6a7238ec 167
Wolfgang Betz 34:edda6a7238ec 168 /**
Wolfgang Betz 34:edda6a7238ec 169 * @brief SPIRIT PA additional load capacitors bank enumeration
Wolfgang Betz 34:edda6a7238ec 170 */
Wolfgang Betz 34:edda6a7238ec 171 typedef enum
Wolfgang Betz 34:edda6a7238ec 172 {
Wolfgang Betz 34:edda6a7238ec 173 LOAD_0_PF = PA_POWER0_CWC_0, /*!< No additional PA load capacitor */
Wolfgang Betz 34:edda6a7238ec 174 LOAD_1_2_PF = PA_POWER0_CWC_1_2P, /*!< 1.2pF additional PA load capacitor */
Wolfgang Betz 34:edda6a7238ec 175 LOAD_2_4_PF = PA_POWER0_CWC_2_4P, /*!< 2.4pF additional PA load capacitor */
Wolfgang Betz 34:edda6a7238ec 176 LOAD_3_6_PF = PA_POWER0_CWC_3_6P /*!< 3.6pF additional PA load capacitor */
Wolfgang Betz 34:edda6a7238ec 177
Wolfgang Betz 34:edda6a7238ec 178 }PALoadCapacitor;
Wolfgang Betz 34:edda6a7238ec 179
Wolfgang Betz 34:edda6a7238ec 180 #define IS_PA_LOAD_CAP(CWC) (((CWC) == LOAD_0_PF) || \
Wolfgang Betz 34:edda6a7238ec 181 ((CWC) == LOAD_1_2_PF) || \
Wolfgang Betz 34:edda6a7238ec 182 ((CWC) == LOAD_2_4_PF) || \
Wolfgang Betz 34:edda6a7238ec 183 ((CWC) == LOAD_3_6_PF))
Wolfgang Betz 34:edda6a7238ec 184
Wolfgang Betz 34:edda6a7238ec 185
Wolfgang Betz 34:edda6a7238ec 186 /**
Wolfgang Betz 34:edda6a7238ec 187 * @brief SPIRIT AFC Mode selection
Wolfgang Betz 34:edda6a7238ec 188 */
Wolfgang Betz 34:edda6a7238ec 189 typedef enum
Wolfgang Betz 34:edda6a7238ec 190 {
Wolfgang Betz 34:edda6a7238ec 191 AFC_SLICER_CORRECTION = AFC2_AFC_MODE_SLICER, /*!< AFC loop closed on slicer */
Wolfgang Betz 34:edda6a7238ec 192 AFC_2ND_IF_CORRECTION = AFC2_AFC_MODE_MIXER /*!< AFC loop closed on 2nd conversion stage */
Wolfgang Betz 34:edda6a7238ec 193
Wolfgang Betz 34:edda6a7238ec 194 }AFCMode;
Wolfgang Betz 34:edda6a7238ec 195
Wolfgang Betz 34:edda6a7238ec 196 #define IS_AFC_MODE(MODE) ((MODE) == AFC_SLICER_CORRECTION || (MODE) == AFC_2ND_IF_CORRECTION)
Wolfgang Betz 34:edda6a7238ec 197
Wolfgang Betz 34:edda6a7238ec 198
Wolfgang Betz 34:edda6a7238ec 199 /**
Wolfgang Betz 34:edda6a7238ec 200 * @brief SPIRIT AGC Mode selection
Wolfgang Betz 34:edda6a7238ec 201 */
Wolfgang Betz 34:edda6a7238ec 202 typedef enum
Wolfgang Betz 34:edda6a7238ec 203 {
Wolfgang Betz 34:edda6a7238ec 204 AGC_LINEAR_MODE = AGCCTRL0_AGC_MODE_LINEAR, /*!< AGC works in linear mode */
Wolfgang Betz 34:edda6a7238ec 205 AGC_BINARY_MODE = AGCCTRL0_AGC_MODE_BINARY /*!< AGC works in binary mode */
Wolfgang Betz 34:edda6a7238ec 206
Wolfgang Betz 34:edda6a7238ec 207 }AGCMode;
Wolfgang Betz 34:edda6a7238ec 208
Wolfgang Betz 34:edda6a7238ec 209 #define IS_AGC_MODE(MODE) ((MODE) == AGC_LINEAR_MODE || (MODE) == AGC_BINARY_MODE)
Wolfgang Betz 34:edda6a7238ec 210
Wolfgang Betz 34:edda6a7238ec 211
Wolfgang Betz 34:edda6a7238ec 212 /**
Wolfgang Betz 34:edda6a7238ec 213 * @brief SPIRIT Clock Recovery Mode selection
Wolfgang Betz 34:edda6a7238ec 214 */
Wolfgang Betz 34:edda6a7238ec 215 typedef enum
Wolfgang Betz 34:edda6a7238ec 216 {
Wolfgang Betz 34:edda6a7238ec 217 CLK_REC_PLL = FDEV0_CLOCK_REG_ALGO_SEL_PLL, /*!< PLL alogrithm for clock recovery */
Wolfgang Betz 34:edda6a7238ec 218 CLK_REC_DLL = FDEV0_CLOCK_REG_ALGO_SEL_DLL /*!< DLL alogrithm for clock recovery */
Wolfgang Betz 34:edda6a7238ec 219
Wolfgang Betz 34:edda6a7238ec 220 }ClkRecMode;
Wolfgang Betz 34:edda6a7238ec 221
Wolfgang Betz 34:edda6a7238ec 222 #define IS_CLK_REC_MODE(MODE) ((MODE) == CLK_REC_PLL || (MODE) == CLK_REC_DLL)
Wolfgang Betz 34:edda6a7238ec 223
Wolfgang Betz 34:edda6a7238ec 224
Wolfgang Betz 34:edda6a7238ec 225 /**
Wolfgang Betz 34:edda6a7238ec 226 * @brief SPIRIT Postfilter length
Wolfgang Betz 34:edda6a7238ec 227 */
Wolfgang Betz 34:edda6a7238ec 228 typedef enum
Wolfgang Betz 34:edda6a7238ec 229 {
Wolfgang Betz 34:edda6a7238ec 230 PSTFLT_LENGTH_8 = 0x00, /*!< Postfilter length is 8 symbols */
Wolfgang Betz 34:edda6a7238ec 231 PSTFLT_LENGTH_16 = 0x10 /*!< Postfilter length is 16 symbols */
Wolfgang Betz 34:edda6a7238ec 232
Wolfgang Betz 34:edda6a7238ec 233 }PstFltLength;
Wolfgang Betz 34:edda6a7238ec 234
Wolfgang Betz 34:edda6a7238ec 235 #define IS_PST_FLT_LENGTH(LENGTH) ((LENGTH) == PSTFLT_LENGTH_8 || (LENGTH) == PSTFLT_LENGTH_16)
Wolfgang Betz 34:edda6a7238ec 236
Wolfgang Betz 34:edda6a7238ec 237
Wolfgang Betz 34:edda6a7238ec 238 /**
Wolfgang Betz 34:edda6a7238ec 239 * @brief SPIRIT OOK Peak Decay
Wolfgang Betz 34:edda6a7238ec 240 */
Wolfgang Betz 34:edda6a7238ec 241 typedef enum
Wolfgang Betz 34:edda6a7238ec 242 {
Wolfgang Betz 34:edda6a7238ec 243 FAST_DECAY = 0x00, /*!< Peak decay control for OOK: fast decay */
Wolfgang Betz 34:edda6a7238ec 244 MEDIUM_FAST_DECAY = 0x01, /*!< Peak decay control for OOK: medium_fast decay */
Wolfgang Betz 34:edda6a7238ec 245 MEDIUM_SLOW_DECAY = 0x02, /*!< Peak decay control for OOK: medium_fast decay */
Wolfgang Betz 34:edda6a7238ec 246 SLOW_DECAY = 0x03 /*!< Peak decay control for OOK: slow decay */
Wolfgang Betz 34:edda6a7238ec 247
Wolfgang Betz 34:edda6a7238ec 248 }OokPeakDecay;
Wolfgang Betz 34:edda6a7238ec 249
Wolfgang Betz 34:edda6a7238ec 250 #define IS_OOK_PEAK_DECAY(DECAY) (((DECAY) == FAST_DECAY) ||\
Wolfgang Betz 34:edda6a7238ec 251 ((DECAY) == MEDIUM_FAST_DECAY) ||\
Wolfgang Betz 34:edda6a7238ec 252 ((DECAY) == MEDIUM_SLOW_DECAY) ||\
Wolfgang Betz 34:edda6a7238ec 253 ((DECAY) == SLOW_DECAY))
Wolfgang Betz 34:edda6a7238ec 254
Wolfgang Betz 34:edda6a7238ec 255
Wolfgang Betz 34:edda6a7238ec 256 /**
Wolfgang Betz 34:edda6a7238ec 257 * @brief SPIRIT Radio Init structure definition
Wolfgang Betz 34:edda6a7238ec 258 */
Wolfgang Betz 34:edda6a7238ec 259 typedef struct
Wolfgang Betz 34:edda6a7238ec 260 {
Wolfgang Betz 34:edda6a7238ec 261 int16_t nXtalOffsetPpm; /*!< Specifies the offset frequency (in ppm)
Wolfgang Betz 34:edda6a7238ec 262 to compensate crystal inaccuracy expressed
Wolfgang Betz 34:edda6a7238ec 263 as signed value.*/
Wolfgang Betz 34:edda6a7238ec 264
Wolfgang Betz 34:edda6a7238ec 265 uint32_t lFrequencyBase; /*!< Specifies the base carrier frequency (in Hz),
Wolfgang Betz 34:edda6a7238ec 266 i.e. the carrier frequency of channel #0.
Wolfgang Betz 34:edda6a7238ec 267 This parameter can be in one of the following ranges:
Wolfgang Betz 34:edda6a7238ec 268 High_Band: from 779 MHz to 915 MHz
Wolfgang Betz 34:edda6a7238ec 269 Middle Band: from 387 MHz to 470 MHz
Wolfgang Betz 34:edda6a7238ec 270 Low Band: from 300 MHz to 348 MHz */
Wolfgang Betz 34:edda6a7238ec 271 uint32_t nChannelSpace; /*!< Specifies the channel spacing expressed in Hz.
Wolfgang Betz 34:edda6a7238ec 272 The channel spacing is expressed as:
Wolfgang Betz 34:edda6a7238ec 273 NxFREQUENCY_STEPS, where FREQUENCY STEPS
Wolfgang Betz 34:edda6a7238ec 274 is F_Xo/2^15.
Wolfgang Betz 34:edda6a7238ec 275 This parameter can be in the range: [0, F_Xo/2^15*255] Hz */
Wolfgang Betz 34:edda6a7238ec 276 uint8_t cChannelNumber; /*!< Specifies the channel number. This value
Wolfgang Betz 34:edda6a7238ec 277 is multiplied by the channel spacing and
Wolfgang Betz 34:edda6a7238ec 278 added to synthesizer base frequency to
Wolfgang Betz 34:edda6a7238ec 279 generate the actual RF carrier frequency */
Wolfgang Betz 34:edda6a7238ec 280 ModulationSelect xModulationSelect; /*!< Specifies the modulation. This
Wolfgang Betz 34:edda6a7238ec 281 parameter can be any value of
Wolfgang Betz 34:edda6a7238ec 282 @ref ModulationSelect */
Wolfgang Betz 34:edda6a7238ec 283 uint32_t lDatarate; /*!< Specifies the datarate expressed in bps.
Wolfgang Betz 34:edda6a7238ec 284 This parameter can be in the range between
Wolfgang Betz 34:edda6a7238ec 285 100 bps and 500 kbps */
Wolfgang Betz 34:edda6a7238ec 286 uint32_t lFreqDev; /*!< Specifies the frequency deviation expressed in Hz.
Wolfgang Betz 34:edda6a7238ec 287 This parameter can be in the range: [F_Xo*8/2^18, F_Xo*7680/2^18] Hz */
Wolfgang Betz 34:edda6a7238ec 288 uint32_t lBandwidth; /*!< Specifies the channel filter bandwidth
Wolfgang Betz 34:edda6a7238ec 289 expressed in Hz. This parameter can be
Wolfgang Betz 34:edda6a7238ec 290 in the range between 1100 and 800100 Hz */
Wolfgang Betz 34:edda6a7238ec 291
Wolfgang Betz 34:edda6a7238ec 292 }SRadioInit;
Wolfgang Betz 34:edda6a7238ec 293
Wolfgang Betz 34:edda6a7238ec 294 /**
Wolfgang Betz 34:edda6a7238ec 295 * @}
Wolfgang Betz 34:edda6a7238ec 296 */
Wolfgang Betz 34:edda6a7238ec 297
Wolfgang Betz 34:edda6a7238ec 298
Wolfgang Betz 34:edda6a7238ec 299
Wolfgang Betz 34:edda6a7238ec 300 /** @defgroup Radio_Exported_Constants Radio Exported Constants
Wolfgang Betz 34:edda6a7238ec 301 * @{
Wolfgang Betz 34:edda6a7238ec 302 */
Wolfgang Betz 34:edda6a7238ec 303
Wolfgang Betz 34:edda6a7238ec 304 /** @defgroup Radio_Band
Wolfgang Betz 34:edda6a7238ec 305 * @{
Wolfgang Betz 34:edda6a7238ec 306 */
Wolfgang Betz 34:edda6a7238ec 307
Wolfgang Betz 34:edda6a7238ec 308 #define FBASE_DIVIDER 262144 /*!< 2^18 factor dividing fxo in fbase formula */
Wolfgang Betz 34:edda6a7238ec 309
Wolfgang Betz 34:edda6a7238ec 310 #define HIGH_BAND_FACTOR 6 /*!< Band select factor for high band. Factor B in the equation 2 */
Wolfgang Betz 34:edda6a7238ec 311 #define MIDDLE_BAND_FACTOR 12 /*!< Band select factor for middle band. Factor B in the equation 2 */
Wolfgang Betz 34:edda6a7238ec 312 #define LOW_BAND_FACTOR 16 /*!< Band select factor for low band. Factor B in the equation 2 */
Wolfgang Betz 34:edda6a7238ec 313 #define VERY_LOW_BAND_FACTOR 32 /*!< Band select factor for very low band. Factor B in the equation 2 */
Wolfgang Betz 34:edda6a7238ec 314
Wolfgang Betz 34:edda6a7238ec 315 #define HIGH_BAND_LOWER_LIMIT 778000000 /*!< Lower limit of the high band: 779 MHz */
Wolfgang Betz 34:edda6a7238ec 316 #define HIGH_BAND_UPPER_LIMIT 957100000 /*!< Upper limit of the high band: 956 MHz */
Wolfgang Betz 34:edda6a7238ec 317 #define MIDDLE_BAND_LOWER_LIMIT 386000000 /*!< Lower limit of the middle band: 387 MHz */
Wolfgang Betz 34:edda6a7238ec 318 #define MIDDLE_BAND_UPPER_LIMIT 471100000 /*!< Upper limit of the middle band: 470 MHz */
Wolfgang Betz 34:edda6a7238ec 319 #define LOW_BAND_LOWER_LIMIT 299000000 /*!< Lower limit of the low band: 300 MHz */
Wolfgang Betz 34:edda6a7238ec 320 #define LOW_BAND_UPPER_LIMIT 349100000 /*!< Upper limit of the low band: 348 MHz */
Wolfgang Betz 34:edda6a7238ec 321 #define VERY_LOW_BAND_LOWER_LIMIT 149000000 /*!< Lower limit of the very low band: 150 MHz */
Wolfgang Betz 34:edda6a7238ec 322 #define VERY_LOW_BAND_UPPER_LIMIT 175100000 /*!< Upper limit of the very low band: 174 MHz */
Wolfgang Betz 34:edda6a7238ec 323
Wolfgang Betz 34:edda6a7238ec 324 #define IS_FREQUENCY_BAND_HIGH(FREQUENCY) ((FREQUENCY)>=HIGH_BAND_LOWER_LIMIT && \
Wolfgang Betz 34:edda6a7238ec 325 (FREQUENCY)<=HIGH_BAND_UPPER_LIMIT)
Wolfgang Betz 34:edda6a7238ec 326
Wolfgang Betz 34:edda6a7238ec 327 #define IS_FREQUENCY_BAND_MIDDLE(FREQUENCY) ((FREQUENCY)>=MIDDLE_BAND_LOWER_LIMIT && \
Wolfgang Betz 34:edda6a7238ec 328 (FREQUENCY)<=MIDDLE_BAND_UPPER_LIMIT)
Wolfgang Betz 34:edda6a7238ec 329
Wolfgang Betz 34:edda6a7238ec 330 #define IS_FREQUENCY_BAND_LOW(FREQUENCY) ((FREQUENCY)>=LOW_BAND_LOWER_LIMIT && \
Wolfgang Betz 34:edda6a7238ec 331 (FREQUENCY)<=LOW_BAND_UPPER_LIMIT)
Wolfgang Betz 34:edda6a7238ec 332
Wolfgang Betz 34:edda6a7238ec 333 #define IS_FREQUENCY_BAND_VERY_LOW(FREQUENCY) ((FREQUENCY)>=VERY_LOW_BAND_LOWER_LIMIT && \
Wolfgang Betz 34:edda6a7238ec 334 (FREQUENCY)<=VERY_LOW_BAND_UPPER_LIMIT)
Wolfgang Betz 34:edda6a7238ec 335
Wolfgang Betz 34:edda6a7238ec 336 #define IS_FREQUENCY_BAND(FREQUENCY) (IS_FREQUENCY_BAND_HIGH(FREQUENCY)|| \
Wolfgang Betz 34:edda6a7238ec 337 IS_FREQUENCY_BAND_MIDDLE(FREQUENCY)|| \
Wolfgang Betz 34:edda6a7238ec 338 IS_FREQUENCY_BAND_LOW(FREQUENCY)|| \
Wolfgang Betz 34:edda6a7238ec 339 IS_FREQUENCY_BAND_VERY_LOW(FREQUENCY))
Wolfgang Betz 34:edda6a7238ec 340
Wolfgang Betz 34:edda6a7238ec 341 /**
Wolfgang Betz 34:edda6a7238ec 342 * @}
Wolfgang Betz 34:edda6a7238ec 343 */
Wolfgang Betz 34:edda6a7238ec 344
Wolfgang Betz 34:edda6a7238ec 345
Wolfgang Betz 34:edda6a7238ec 346 /** @defgroup Radio_IF_Offset Radio IF Offset
Wolfgang Betz 34:edda6a7238ec 347 * @{
Wolfgang Betz 34:edda6a7238ec 348 */
Wolfgang Betz 34:edda6a7238ec 349 #define IF_OFFSET_ANA(F_Xo) (lroundf(480140.0/(F_Xo)*12288-64.0)) /*!< It represents the IF_OFFSET_ANA in order
Wolfgang Betz 34:edda6a7238ec 350 to have an intermediate frequency of 480 kHz */
Wolfgang Betz 34:edda6a7238ec 351 /**
Wolfgang Betz 34:edda6a7238ec 352 * @}
Wolfgang Betz 34:edda6a7238ec 353 */
Wolfgang Betz 34:edda6a7238ec 354
Wolfgang Betz 34:edda6a7238ec 355
Wolfgang Betz 34:edda6a7238ec 356 /** @defgroup Radio_FC_Offset Radio FC Offset
Wolfgang Betz 34:edda6a7238ec 357 * @{
Wolfgang Betz 34:edda6a7238ec 358 */
Wolfgang Betz 34:edda6a7238ec 359 #define F_OFFSET_DIVIDER 262144 /*!< 2^18 factor dividing fxo in foffset formula */
Wolfgang Betz 34:edda6a7238ec 360 #define PPM_FACTOR 1000000 /*!< 10^6 factor to use with Xtal_offset_ppm */
Wolfgang Betz 34:edda6a7238ec 361
Wolfgang Betz 34:edda6a7238ec 362
Wolfgang Betz 34:edda6a7238ec 363 #define F_OFFSET_LOWER_LIMIT(F_Xo) ((-(int32_t)F_Xo)/F_OFFSET_DIVIDER*2048)
Wolfgang Betz 34:edda6a7238ec 364 #define F_OFFSET_UPPER_LIMIT(F_Xo) ((int32_t)(F_Xo/F_OFFSET_DIVIDER*2047))
Wolfgang Betz 34:edda6a7238ec 365
Wolfgang Betz 34:edda6a7238ec 366 #define IS_FREQUENCY_OFFSET(OFFSET, F_Xo) (OFFSET>=F_OFFSET_LOWER_LIMIT(F_Xo) && OFFSET<=F_OFFSET_UPPER_LIMIT(F_Xo))
Wolfgang Betz 34:edda6a7238ec 367
Wolfgang Betz 34:edda6a7238ec 368
Wolfgang Betz 34:edda6a7238ec 369 /**
Wolfgang Betz 34:edda6a7238ec 370 * @}
Wolfgang Betz 34:edda6a7238ec 371 */
Wolfgang Betz 34:edda6a7238ec 372
Wolfgang Betz 34:edda6a7238ec 373
Wolfgang Betz 34:edda6a7238ec 374 /** @defgroup Radio_Channel_Space Radio Channel Space
Wolfgang Betz 34:edda6a7238ec 375 * @{
Wolfgang Betz 34:edda6a7238ec 376 */
Wolfgang Betz 34:edda6a7238ec 377
Wolfgang Betz 34:edda6a7238ec 378
Wolfgang Betz 34:edda6a7238ec 379 #define CHSPACE_DIVIDER 32768 /*!< 2^15 factor dividing fxo in channel space formula */
Wolfgang Betz 34:edda6a7238ec 380
Wolfgang Betz 34:edda6a7238ec 381 #define IS_CHANNEL_SPACE(CHANNELSPACE, F_Xo) (CHANNELSPACE<=(F_Xo/32768*255))
Wolfgang Betz 34:edda6a7238ec 382
Wolfgang Betz 34:edda6a7238ec 383
Wolfgang Betz 34:edda6a7238ec 384
Wolfgang Betz 34:edda6a7238ec 385
Wolfgang Betz 34:edda6a7238ec 386
Wolfgang Betz 34:edda6a7238ec 387 /**
Wolfgang Betz 34:edda6a7238ec 388 * @}
Wolfgang Betz 34:edda6a7238ec 389 */
Wolfgang Betz 34:edda6a7238ec 390
Wolfgang Betz 34:edda6a7238ec 391
Wolfgang Betz 34:edda6a7238ec 392 /** @defgroup Radio_Datarate Radio Datarate
Wolfgang Betz 34:edda6a7238ec 393 * @{
Wolfgang Betz 34:edda6a7238ec 394 */
Wolfgang Betz 34:edda6a7238ec 395 #define MINIMUM_DATARATE 100 /*!< Minimum datarate supported by SPIRIT1 100 bps */
Wolfgang Betz 34:edda6a7238ec 396 #define MAXIMUM_DATARATE 510000 /*!< Maximum datarate supported by SPIRIT1 500 kbps */
Wolfgang Betz 34:edda6a7238ec 397
Wolfgang Betz 34:edda6a7238ec 398 #define IS_DATARATE(DATARATE) (DATARATE>=MINIMUM_DATARATE && DATARATE<=MAXIMUM_DATARATE)
Wolfgang Betz 34:edda6a7238ec 399
Wolfgang Betz 34:edda6a7238ec 400 /**
Wolfgang Betz 34:edda6a7238ec 401 * @}
Wolfgang Betz 34:edda6a7238ec 402 */
Wolfgang Betz 34:edda6a7238ec 403
Wolfgang Betz 34:edda6a7238ec 404
Wolfgang Betz 34:edda6a7238ec 405 /** @defgroup Radio_Frequency_Deviation Radio Frequency Deviation
Wolfgang Betz 34:edda6a7238ec 406 * @{
Wolfgang Betz 34:edda6a7238ec 407 */
Wolfgang Betz 34:edda6a7238ec 408 #define F_DEV_MANTISSA_UPPER_LIMIT 7 /*!< Maximum value for the mantissa in frequency deviation formula */
Wolfgang Betz 34:edda6a7238ec 409 #define F_DEV_EXPONENT_UPPER_LIMIT 9 /*!< Maximum value for the exponent in frequency deviation formula */
Wolfgang Betz 34:edda6a7238ec 410
Wolfgang Betz 34:edda6a7238ec 411 #define F_DEV_LOWER_LIMIT(F_Xo) (F_Xo>>16)
Wolfgang Betz 34:edda6a7238ec 412 #define F_DEV_UPPER_LIMIT(F_Xo) ((F_Xo*15)>>10)
Wolfgang Betz 34:edda6a7238ec 413
Wolfgang Betz 34:edda6a7238ec 414 #define IS_F_DEV(FDEV,F_Xo) (FDEV>=F_DEV_LOWER_LIMIT(F_Xo) && FDEV<=F_DEV_UPPER_LIMIT(F_Xo))
Wolfgang Betz 34:edda6a7238ec 415
Wolfgang Betz 34:edda6a7238ec 416
Wolfgang Betz 34:edda6a7238ec 417 /**
Wolfgang Betz 34:edda6a7238ec 418 * @}
Wolfgang Betz 34:edda6a7238ec 419 */
Wolfgang Betz 34:edda6a7238ec 420
Wolfgang Betz 34:edda6a7238ec 421
Wolfgang Betz 34:edda6a7238ec 422 /** @defgroup Radio_Channel_Bandwidth Radio Channel Bandwidth
Wolfgang Betz 34:edda6a7238ec 423 * @{
Wolfgang Betz 34:edda6a7238ec 424 */
Wolfgang Betz 34:edda6a7238ec 425 #define CH_BW_LOWER_LIMIT(F_Xo) 1100*(F_Xo/1000000)/26 /*!< Minimum value of the channel filter bandwidth */
Wolfgang Betz 34:edda6a7238ec 426 #define CH_BW_UPPER_LIMIT(F_Xo) 800100*(F_Xo/1000000)/26 /*!< Maximum value of the channel filter bandwidth */
Wolfgang Betz 34:edda6a7238ec 427
Wolfgang Betz 34:edda6a7238ec 428 #define IS_CH_BW(BW,F_Xo) ((BW)>=CH_BW_LOWER_LIMIT(F_Xo) && (BW)<=CH_BW_UPPER_LIMIT(F_Xo))
Wolfgang Betz 34:edda6a7238ec 429
Wolfgang Betz 34:edda6a7238ec 430 /**
Wolfgang Betz 34:edda6a7238ec 431 * @}
Wolfgang Betz 34:edda6a7238ec 432 */
Wolfgang Betz 34:edda6a7238ec 433
Wolfgang Betz 34:edda6a7238ec 434
Wolfgang Betz 34:edda6a7238ec 435 /** @defgroup Radio_Power_Amplifier Radio Power Amplifier
Wolfgang Betz 34:edda6a7238ec 436 * @{
Wolfgang Betz 34:edda6a7238ec 437 */
Wolfgang Betz 34:edda6a7238ec 438
Wolfgang Betz 34:edda6a7238ec 439 #define IS_PA_MAX_INDEX(INDEX) ((INDEX)<=7)
Wolfgang Betz 34:edda6a7238ec 440 #define IS_PAPOWER_DBM(PATABLE) ((PATABLE)>= (-31) && (PATABLE)<=(12))
Wolfgang Betz 34:edda6a7238ec 441 #define IS_PAPOWER(PATABLE) ((PATABLE)<=90)
Wolfgang Betz 34:edda6a7238ec 442 #define IS_PA_STEP_WIDTH(WIDTH) ((WIDTH)>=1 && (WIDTH)<=4)
Wolfgang Betz 34:edda6a7238ec 443
Wolfgang Betz 34:edda6a7238ec 444 /**
Wolfgang Betz 34:edda6a7238ec 445 * @}
Wolfgang Betz 34:edda6a7238ec 446 */
Wolfgang Betz 34:edda6a7238ec 447
Wolfgang Betz 34:edda6a7238ec 448
Wolfgang Betz 34:edda6a7238ec 449 /** @defgroup Radio_Automatic_Frequency_Correction Radio Automatic Frequency Correction
Wolfgang Betz 34:edda6a7238ec 450 * @{
Wolfgang Betz 34:edda6a7238ec 451 */
Wolfgang Betz 34:edda6a7238ec 452
Wolfgang Betz 34:edda6a7238ec 453 #define IS_AFC_FAST_GAIN(GAIN) ((GAIN)<=15)
Wolfgang Betz 34:edda6a7238ec 454 #define IS_AFC_SLOW_GAIN(GAIN) ((GAIN)<=15)
Wolfgang Betz 34:edda6a7238ec 455 #define IS_AFC_PD_LEAKAGE(LEAKAGE) ((LEAKAGE)<=31)
Wolfgang Betz 34:edda6a7238ec 456
Wolfgang Betz 34:edda6a7238ec 457 /**
Wolfgang Betz 34:edda6a7238ec 458 * @}
Wolfgang Betz 34:edda6a7238ec 459 */
Wolfgang Betz 34:edda6a7238ec 460
Wolfgang Betz 34:edda6a7238ec 461 /** @defgroup Radio_Automatic_Gain_Control Radio Automatic Gain Control
Wolfgang Betz 34:edda6a7238ec 462 * @{
Wolfgang Betz 34:edda6a7238ec 463 */
Wolfgang Betz 34:edda6a7238ec 464
Wolfgang Betz 34:edda6a7238ec 465 #define AGC_MEASURE_TIME_UPPER_LIMIT_US(F_Xo) (393216.0/F_Xo)
Wolfgang Betz 34:edda6a7238ec 466
Wolfgang Betz 34:edda6a7238ec 467 #define IS_AGC_MEASURE_TIME_US(TIME, F_Xo) (TIME<=AGC_MEASURE_TIME_UPPER_LIMIT_US(F_Xo))
Wolfgang Betz 34:edda6a7238ec 468
Wolfgang Betz 34:edda6a7238ec 469 #define IS_AGC_MEASURE_TIME(TIME) (TIME<=15)
Wolfgang Betz 34:edda6a7238ec 470
Wolfgang Betz 34:edda6a7238ec 471 #define AGC_HOLD_TIME_UPPER_LIMIT_US(F_Xo) (756.0/F_Xo)
Wolfgang Betz 34:edda6a7238ec 472
Wolfgang Betz 34:edda6a7238ec 473 #define IS_AGC_HOLD_TIME_US(TIME,F_Xo) (TIME<=AGC_HOLD_TIME_UPPER_LIMIT_US(F_Xo))
Wolfgang Betz 34:edda6a7238ec 474
Wolfgang Betz 34:edda6a7238ec 475
Wolfgang Betz 34:edda6a7238ec 476 #define IS_AGC_HOLD_TIME(TIME) (TIME<=63)
Wolfgang Betz 34:edda6a7238ec 477
Wolfgang Betz 34:edda6a7238ec 478 #define IS_AGC_THRESHOLD(THRESHOLD) (THRESHOLD<=15)
Wolfgang Betz 34:edda6a7238ec 479
Wolfgang Betz 34:edda6a7238ec 480 /**
Wolfgang Betz 34:edda6a7238ec 481 * @}
Wolfgang Betz 34:edda6a7238ec 482 */
Wolfgang Betz 34:edda6a7238ec 483
Wolfgang Betz 34:edda6a7238ec 484
Wolfgang Betz 34:edda6a7238ec 485 /** @defgroup Radio_Clock_Recovery Radio Clock Recovery
Wolfgang Betz 34:edda6a7238ec 486 * @{
Wolfgang Betz 34:edda6a7238ec 487 */
Wolfgang Betz 34:edda6a7238ec 488
Wolfgang Betz 34:edda6a7238ec 489 #define IS_CLK_REC_P_GAIN(GAIN) ((GAIN)<=7)
Wolfgang Betz 34:edda6a7238ec 490 #define IS_CLK_REC_I_GAIN(GAIN) ((GAIN)<=15)
Wolfgang Betz 34:edda6a7238ec 491
Wolfgang Betz 34:edda6a7238ec 492 /**
Wolfgang Betz 34:edda6a7238ec 493 * @}
Wolfgang Betz 34:edda6a7238ec 494 */
Wolfgang Betz 34:edda6a7238ec 495
Wolfgang Betz 34:edda6a7238ec 496 /**
Wolfgang Betz 34:edda6a7238ec 497 * @}
Wolfgang Betz 34:edda6a7238ec 498 */
Wolfgang Betz 34:edda6a7238ec 499
Wolfgang Betz 34:edda6a7238ec 500
Wolfgang Betz 34:edda6a7238ec 501
Wolfgang Betz 34:edda6a7238ec 502 /** @defgroup Radio_Exported_Macros Radio Exported Macros
Wolfgang Betz 34:edda6a7238ec 503 * @{
Wolfgang Betz 34:edda6a7238ec 504 */
Wolfgang Betz 34:edda6a7238ec 505
Wolfgang Betz 34:edda6a7238ec 506
Wolfgang Betz 34:edda6a7238ec 507 /**
Wolfgang Betz 34:edda6a7238ec 508 * @}
Wolfgang Betz 34:edda6a7238ec 509 */
Wolfgang Betz 34:edda6a7238ec 510
Wolfgang Betz 34:edda6a7238ec 511 /** @defgroup Radio_Exported_Functions Radio Exported Functions
Wolfgang Betz 34:edda6a7238ec 512 * @{
Wolfgang Betz 34:edda6a7238ec 513 */
Wolfgang Betz 34:edda6a7238ec 514
Wolfgang Betz 34:edda6a7238ec 515 uint8_t SpiritRadioInit(SRadioInit* pxSRadioInitStruct);
Wolfgang Betz 34:edda6a7238ec 516 void SpiritRadioGetInfo(SRadioInit* pxSRadioInitStruct);
Wolfgang Betz 34:edda6a7238ec 517 void SpiritRadioSetXtalFlag(XtalFlag xXtal);
Wolfgang Betz 34:edda6a7238ec 518 XtalFlag SpiritRadioGetXtalFlag(void);
Wolfgang Betz 34:edda6a7238ec 519 uint8_t SpiritRadioSearchWCP(uint32_t lFc);
Wolfgang Betz 34:edda6a7238ec 520 void SpiritRadioSetSynthWord(uint32_t lSynthWord);
Wolfgang Betz 34:edda6a7238ec 521 uint32_t SpiritRadioGetSynthWord(void);
Wolfgang Betz 34:edda6a7238ec 522 void SpiritRadioSetBand(BandSelect xBand);
Wolfgang Betz 34:edda6a7238ec 523 BandSelect SpiritRadioGetBand(void);
Wolfgang Betz 34:edda6a7238ec 524 void SpiritRadioSetChannel(uint8_t cChannel);
Wolfgang Betz 34:edda6a7238ec 525 uint8_t SpiritRadioGetChannel(void);
Wolfgang Betz 34:edda6a7238ec 526 void SpiritRadioSetChannelSpace(uint32_t lChannelSpace);
Wolfgang Betz 34:edda6a7238ec 527 uint32_t SpiritRadioGetChannelSpace(void);
Wolfgang Betz 34:edda6a7238ec 528 void SpiritRadioSetFrequencyOffsetPpm(int16_t nXtalPpm);
Wolfgang Betz 34:edda6a7238ec 529 void SpiritRadioSetFrequencyOffset(int32_t lFOffset);
Wolfgang Betz 34:edda6a7238ec 530 int32_t SpiritRadioGetFrequencyOffset(void);
Wolfgang Betz 34:edda6a7238ec 531 void SpiritRadioVcoCalibrationWAFB(SpiritFunctionalState xNewstate);
Wolfgang Betz 34:edda6a7238ec 532 uint8_t SpiritRadioSetFrequencyBase(uint32_t lFBase);
Wolfgang Betz 34:edda6a7238ec 533 uint32_t SpiritRadioGetFrequencyBase(void);
Wolfgang Betz 34:edda6a7238ec 534 uint32_t SpiritRadioGetCenterFrequency(void);
Wolfgang Betz 34:edda6a7238ec 535 void SpiritRadioSearchDatarateME(uint32_t lDatarate, uint8_t* pcM, uint8_t* pcE);
Wolfgang Betz 34:edda6a7238ec 536 void SpiritRadioSearchFreqDevME(uint32_t lFDev, uint8_t* pcM, uint8_t* pcE);
Wolfgang Betz 34:edda6a7238ec 537 void SpiritRadioSearchChannelBwME(uint32_t lBandwidth, uint8_t* pcM, uint8_t* pcE);
Wolfgang Betz 34:edda6a7238ec 538 void SpiritRadioSetDatarate(uint32_t lDatarate);
Wolfgang Betz 34:edda6a7238ec 539 uint32_t SpiritRadioGetDatarate(void);
Wolfgang Betz 34:edda6a7238ec 540 void SpiritRadioSetFrequencyDev(uint32_t lFDev);
Wolfgang Betz 34:edda6a7238ec 541 uint32_t SpiritRadioGetFrequencyDev(void);
Wolfgang Betz 34:edda6a7238ec 542 void SpiritRadioSetChannelBW(uint32_t lBandwidth);
Wolfgang Betz 34:edda6a7238ec 543 uint32_t SpiritRadioGetChannelBW(void);
Wolfgang Betz 34:edda6a7238ec 544 void SpiritRadioSetModulation(ModulationSelect xModulation);
Wolfgang Betz 34:edda6a7238ec 545 ModulationSelect SpiritRadioGetModulation(void);
Wolfgang Betz 34:edda6a7238ec 546 void SpiritRadioCWTransmitMode(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 547 void SpiritRadioSetOokPeakDecay(OokPeakDecay xOokDecay);
Wolfgang Betz 34:edda6a7238ec 548 OokPeakDecay SpiritRadioGetOokPeakDecay(void);
Wolfgang Betz 34:edda6a7238ec 549 uint8_t SpiritRadioGetdBm2Reg(uint32_t lFBase, float fPowerdBm);
Wolfgang Betz 34:edda6a7238ec 550 float SpiritRadioGetReg2dBm(uint32_t lFBase, uint8_t cPowerReg);
Wolfgang Betz 34:edda6a7238ec 551 void SpiritRadioSetPATabledBm(uint8_t cPALevelMaxIndex, uint8_t cWidth, PALoadCapacitor xCLoad, float* pfPAtabledBm);
Wolfgang Betz 34:edda6a7238ec 552 void SpiritRadioGetPATabledBm(uint8_t* pcPALevelMaxIndex, float* pfPAtabledBm);
Wolfgang Betz 34:edda6a7238ec 553 void SpiritRadioSetPATable(uint8_t cPALevelMaxIndex, uint8_t cWidth, PALoadCapacitor xCLoad, uint8_t* pcPAtable);
Wolfgang Betz 34:edda6a7238ec 554 void SpiritRadioGetPATable(uint8_t* pcPALevelMaxIndex, uint8_t* pcPAtable);
Wolfgang Betz 34:edda6a7238ec 555 void SpiritRadioSetPALeveldBm(uint8_t cIndex, float fPowerdBm);
Wolfgang Betz 34:edda6a7238ec 556 float SpiritRadioGetPALeveldBm(uint8_t cIndex);
Wolfgang Betz 34:edda6a7238ec 557 void SpiritRadioSetPALevel(uint8_t cIndex, uint8_t cPower);
Wolfgang Betz 34:edda6a7238ec 558 uint8_t SpiritRadioGetPALevel(uint8_t cIndex);
Wolfgang Betz 34:edda6a7238ec 559 void SpiritRadioSetPACwc(PALoadCapacitor xCLoad);
Wolfgang Betz 34:edda6a7238ec 560 PALoadCapacitor SpiritRadioGetPACwc(void);
Wolfgang Betz 34:edda6a7238ec 561 void SpiritRadioSetPALevelMaxIndex(uint8_t cIndex);
Wolfgang Betz 34:edda6a7238ec 562 uint8_t SpiritRadioGetPALevelMaxIndex(void);
Wolfgang Betz 34:edda6a7238ec 563 void SpiritRadioSetPAStepWidth(uint8_t cWidth);
Wolfgang Betz 34:edda6a7238ec 564 uint8_t SpiritRadioGetPAStepWidth(void);
Wolfgang Betz 34:edda6a7238ec 565 void SpiritRadioPARamping(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 566 SpiritFunctionalState SpiritRadioGetPARamping(void);
Wolfgang Betz 34:edda6a7238ec 567 void SpiritRadioAFC(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 568 void SpiritRadioAFCFreezeOnSync(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 569 void SpiritRadioSetAFCMode(AFCMode xMode);
Wolfgang Betz 34:edda6a7238ec 570 AFCMode SpiritRadioGetAFCMode(void);
Wolfgang Betz 34:edda6a7238ec 571 void SpiritRadioSetAFCPDLeakage(uint8_t cLeakage);
Wolfgang Betz 34:edda6a7238ec 572 uint8_t SpiritRadioGetAFCPDLeakage(void);
Wolfgang Betz 34:edda6a7238ec 573 void SpiritRadioSetAFCFastPeriod(uint8_t cLength);
Wolfgang Betz 34:edda6a7238ec 574 uint8_t SpiritRadioGetAFCFastPeriod(void);
Wolfgang Betz 34:edda6a7238ec 575 void SpiritRadioSetAFCFastGain(uint8_t cGain);
Wolfgang Betz 34:edda6a7238ec 576 uint8_t SpiritRadioGetAFCFastGain(void);
Wolfgang Betz 34:edda6a7238ec 577 void SpiritRadioSetAFCSlowGain(uint8_t cGain);
Wolfgang Betz 34:edda6a7238ec 578 uint8_t SpiritRadioGetAFCSlowGain(void);
Wolfgang Betz 34:edda6a7238ec 579 int8_t SpiritRadioGetAFCCorrectionReg(void);
Wolfgang Betz 34:edda6a7238ec 580 int32_t SpiritRadioGetAFCCorrectionHz(void);
Wolfgang Betz 34:edda6a7238ec 581 void SpiritRadioAGC(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 582 void SpiritRadioSetAGCMode(AGCMode xMode);
Wolfgang Betz 34:edda6a7238ec 583 AGCMode SpiritRadioGetAGCMode(void);
Wolfgang Betz 34:edda6a7238ec 584 void SpiritRadioAGCFreezeOnSteady(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 585 void SpiritRadioAGCFreezeOnSync(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 586 void SpiritRadioAGCStartMaxAttenuation(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 587 void SpiritRadioSetAGCMeasureTimeUs(uint16_t nTime);
Wolfgang Betz 34:edda6a7238ec 588 uint16_t SpiritRadioGetAGCMeasureTimeUs(void);
Wolfgang Betz 34:edda6a7238ec 589 void SpiritRadioSetAGCMeasureTime(uint8_t cTime);
Wolfgang Betz 34:edda6a7238ec 590 uint8_t SpiritRadioGetAGCMeasureTime(void);
Wolfgang Betz 34:edda6a7238ec 591 void SpiritRadioSetAGCHoldTimeUs(uint8_t cTime);
Wolfgang Betz 34:edda6a7238ec 592 uint8_t SpiritRadioGetAGCHoldTimeUs(void);
Wolfgang Betz 34:edda6a7238ec 593 void SpiritRadioSetAGCHoldTime(uint8_t cTime);
Wolfgang Betz 34:edda6a7238ec 594 uint8_t SpiritRadioGetAGCHoldTime(void);
Wolfgang Betz 34:edda6a7238ec 595 void SpiritRadioSetAGCHighThreshold(uint8_t cHighThreshold);
Wolfgang Betz 34:edda6a7238ec 596 uint8_t SpiritRadioGetAGCHighThreshold(void);
Wolfgang Betz 34:edda6a7238ec 597 void SpiritRadioSetAGCLowThreshold(uint8_t cLowThreshold);
Wolfgang Betz 34:edda6a7238ec 598 uint8_t SpiritRadioGetAGCLowThreshold(void);
Wolfgang Betz 34:edda6a7238ec 599 void SpiritRadioSetClkRecMode(ClkRecMode xMode);
Wolfgang Betz 34:edda6a7238ec 600 ClkRecMode SpiritRadioGetClkRecMode(void);
Wolfgang Betz 34:edda6a7238ec 601 void SpiritRadioSetClkRecPGain(uint8_t cPGain);
Wolfgang Betz 34:edda6a7238ec 602 uint8_t SpiritRadioGetClkRecPGain(void);
Wolfgang Betz 34:edda6a7238ec 603 void SpiritRadioSetClkRecIGain(uint8_t cIGain);
Wolfgang Betz 34:edda6a7238ec 604 uint8_t SpiritRadioGetClkRecIGain(void);
Wolfgang Betz 34:edda6a7238ec 605 void SpiritRadioSetClkRecPstFltLength(PstFltLength xLength);
Wolfgang Betz 34:edda6a7238ec 606 PstFltLength SpiritRadioGetClkRecPstFltLength(void);
Wolfgang Betz 34:edda6a7238ec 607 void SpiritRadioCsBlanking(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 608 void SpiritRadioPersistenRx(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 609 uint32_t SpiritRadioGetXtalFrequency(void);
Wolfgang Betz 34:edda6a7238ec 610 void SpiritRadioSetXtalFrequency(uint32_t lXtalFrequency);
Wolfgang Betz 34:edda6a7238ec 611 void SpiritRadioSetRefDiv(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 612 SpiritFunctionalState SpiritRadioGetRefDiv(void);
Wolfgang Betz 34:edda6a7238ec 613 void SpiritRadioSetDigDiv(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 614 SpiritFunctionalState SpiritRadioGetDigDiv(void);
Wolfgang Betz 34:edda6a7238ec 615 /**
Wolfgang Betz 34:edda6a7238ec 616 * @}
Wolfgang Betz 34:edda6a7238ec 617 */
Wolfgang Betz 34:edda6a7238ec 618
Wolfgang Betz 34:edda6a7238ec 619 /**
Wolfgang Betz 34:edda6a7238ec 620 * @}
Wolfgang Betz 34:edda6a7238ec 621 */
Wolfgang Betz 34:edda6a7238ec 622
Wolfgang Betz 34:edda6a7238ec 623
Wolfgang Betz 34:edda6a7238ec 624 /**
Wolfgang Betz 34:edda6a7238ec 625 * @}
Wolfgang Betz 34:edda6a7238ec 626 */
Wolfgang Betz 34:edda6a7238ec 627
Wolfgang Betz 34:edda6a7238ec 628
Wolfgang Betz 34:edda6a7238ec 629
Wolfgang Betz 34:edda6a7238ec 630 #ifdef __cplusplus
Wolfgang Betz 34:edda6a7238ec 631 }
Wolfgang Betz 34:edda6a7238ec 632 #endif
Wolfgang Betz 34:edda6a7238ec 633
Wolfgang Betz 34:edda6a7238ec 634 #endif
Wolfgang Betz 34:edda6a7238ec 635
Wolfgang Betz 34:edda6a7238ec 636 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/