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_Gpio.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 SPIRIT GPIO.
Wolfgang Betz 34:edda6a7238ec 8 *
Wolfgang Betz 34:edda6a7238ec 9 * @details
Wolfgang Betz 34:edda6a7238ec 10 *
Wolfgang Betz 34:edda6a7238ec 11 * This module can be used to configure the Spirit GPIO pins to perform
Wolfgang Betz 34:edda6a7238ec 12 * specific functions.
Wolfgang Betz 34:edda6a7238ec 13 * The structure <i>@ref gpioIRQ</i> can be used to specify these features for
Wolfgang Betz 34:edda6a7238ec 14 * one of the four Spirit Gpio pin.
Wolfgang Betz 34:edda6a7238ec 15 * The following example shows how to configure a pin (GPIO 3) to be used as an IRQ source
Wolfgang Betz 34:edda6a7238ec 16 * for a microcontroller using the <i>@ref SpiritGpioInit()</i> function.
Wolfgang Betz 34:edda6a7238ec 17 *
Wolfgang Betz 34:edda6a7238ec 18 * <b>Example:</b>
Wolfgang Betz 34:edda6a7238ec 19 * @code
Wolfgang Betz 34:edda6a7238ec 20 *
Wolfgang Betz 34:edda6a7238ec 21 * SGpioInit gpioIRQ={
Wolfgang Betz 34:edda6a7238ec 22 * SPIRIT_GPIO_3,
Wolfgang Betz 34:edda6a7238ec 23 * SPIRIT_GPIO_MODE_DIGITAL_OUTPUT_LP,
Wolfgang Betz 34:edda6a7238ec 24 * SPIRIT_GPIO_DIG_OUT_IRQ
Wolfgang Betz 34:edda6a7238ec 25 * };
Wolfgang Betz 34:edda6a7238ec 26 *
Wolfgang Betz 34:edda6a7238ec 27 * ...
Wolfgang Betz 34:edda6a7238ec 28 *
Wolfgang Betz 34:edda6a7238ec 29 * SpiritGpioInit(&gpioIRQ);
Wolfgang Betz 34:edda6a7238ec 30 *
Wolfgang Betz 34:edda6a7238ec 31 * @endcode
Wolfgang Betz 34:edda6a7238ec 32 *
Wolfgang Betz 34:edda6a7238ec 33 * @note Please read the functions documentation for the other GPIO features.
Wolfgang Betz 34:edda6a7238ec 34 *
Wolfgang Betz 34:edda6a7238ec 35 *
Wolfgang Betz 34:edda6a7238ec 36 * @attention
Wolfgang Betz 34:edda6a7238ec 37 *
Wolfgang Betz 34:edda6a7238ec 38 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Wolfgang Betz 34:edda6a7238ec 39 *
Wolfgang Betz 34:edda6a7238ec 40 * Redistribution and use in source and binary forms, with or without modification,
Wolfgang Betz 34:edda6a7238ec 41 * are permitted provided that the following conditions are met:
Wolfgang Betz 34:edda6a7238ec 42 * 1. Redistributions of source code must retain the above copyright notice,
Wolfgang Betz 34:edda6a7238ec 43 * this list of conditions and the following disclaimer.
Wolfgang Betz 34:edda6a7238ec 44 * 2. Redistributions in binary form must reproduce the above copyright notice,
Wolfgang Betz 34:edda6a7238ec 45 * this list of conditions and the following disclaimer in the documentation
Wolfgang Betz 34:edda6a7238ec 46 * and/or other materials provided with the distribution.
Wolfgang Betz 34:edda6a7238ec 47 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Wolfgang Betz 34:edda6a7238ec 48 * may be used to endorse or promote products derived from this software
Wolfgang Betz 34:edda6a7238ec 49 * without specific prior written permission.
Wolfgang Betz 34:edda6a7238ec 50 *
Wolfgang Betz 34:edda6a7238ec 51 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Wolfgang Betz 34:edda6a7238ec 52 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Wolfgang Betz 34:edda6a7238ec 53 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Wolfgang Betz 34:edda6a7238ec 54 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Wolfgang Betz 34:edda6a7238ec 55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Wolfgang Betz 34:edda6a7238ec 56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Wolfgang Betz 34:edda6a7238ec 57 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Wolfgang Betz 34:edda6a7238ec 58 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Wolfgang Betz 34:edda6a7238ec 59 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Wolfgang Betz 34:edda6a7238ec 60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wolfgang Betz 34:edda6a7238ec 61 *
Wolfgang Betz 34:edda6a7238ec 62 ******************************************************************************
Wolfgang Betz 34:edda6a7238ec 63 */
Wolfgang Betz 34:edda6a7238ec 64
Wolfgang Betz 34:edda6a7238ec 65 /* Define to prevent recursive inclusion -------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 66 #ifndef __SPIRIT_GPIO_H
Wolfgang Betz 34:edda6a7238ec 67 #define __SPIRIT_GPIO_H
Wolfgang Betz 34:edda6a7238ec 68
Wolfgang Betz 34:edda6a7238ec 69
Wolfgang Betz 34:edda6a7238ec 70 /* Includes ------------------------------------------------------------------*/
Wolfgang Betz 34:edda6a7238ec 71
Wolfgang Betz 34:edda6a7238ec 72 #include "SPIRIT_Regs.h"
Wolfgang Betz 34:edda6a7238ec 73 #include "SPIRIT_Types.h"
Wolfgang Betz 34:edda6a7238ec 74
Wolfgang Betz 34:edda6a7238ec 75
Wolfgang Betz 34:edda6a7238ec 76 #ifdef __cplusplus
Wolfgang Betz 34:edda6a7238ec 77 extern "C" {
Wolfgang Betz 34:edda6a7238ec 78 #endif
Wolfgang Betz 34:edda6a7238ec 79
Wolfgang Betz 34:edda6a7238ec 80
Wolfgang Betz 34:edda6a7238ec 81 /** @addtogroup SPIRIT_Libraries
Wolfgang Betz 34:edda6a7238ec 82 * @{
Wolfgang Betz 34:edda6a7238ec 83 */
Wolfgang Betz 34:edda6a7238ec 84
Wolfgang Betz 34:edda6a7238ec 85
Wolfgang Betz 34:edda6a7238ec 86 /** @defgroup SPIRIT_Gpio GPIO
Wolfgang Betz 34:edda6a7238ec 87 * @brief Configuration and management of SPIRIT GPIO.
Wolfgang Betz 34:edda6a7238ec 88 * @details See the file <i>@ref SPIRIT_Gpio.h</i> for more details.
Wolfgang Betz 34:edda6a7238ec 89 * @{
Wolfgang Betz 34:edda6a7238ec 90 */
Wolfgang Betz 34:edda6a7238ec 91
Wolfgang Betz 34:edda6a7238ec 92
Wolfgang Betz 34:edda6a7238ec 93
Wolfgang Betz 34:edda6a7238ec 94 /** @defgroup Gpio_Exported_Types GPIO Exported Types
Wolfgang Betz 34:edda6a7238ec 95 * @{
Wolfgang Betz 34:edda6a7238ec 96 */
Wolfgang Betz 34:edda6a7238ec 97
Wolfgang Betz 34:edda6a7238ec 98 /**
Wolfgang Betz 34:edda6a7238ec 99 * @brief SPIRIT GPIO pin enumeration.
Wolfgang Betz 34:edda6a7238ec 100 */
Wolfgang Betz 34:edda6a7238ec 101 typedef enum
Wolfgang Betz 34:edda6a7238ec 102 {
Wolfgang Betz 34:edda6a7238ec 103 SPIRIT_GPIO_0 = GPIO0_CONF_BASE, /*!< GPIO_0 selected */
Wolfgang Betz 34:edda6a7238ec 104 SPIRIT_GPIO_1 = GPIO1_CONF_BASE, /*!< GPIO_1 selected */
Wolfgang Betz 34:edda6a7238ec 105 SPIRIT_GPIO_2 = GPIO2_CONF_BASE, /*!< GPIO_2 selected */
Wolfgang Betz 34:edda6a7238ec 106 SPIRIT_GPIO_3 = GPIO3_CONF_BASE /*!< GPIO_3 selected */
Wolfgang Betz 34:edda6a7238ec 107 }SpiritGpioPin;
Wolfgang Betz 34:edda6a7238ec 108
Wolfgang Betz 34:edda6a7238ec 109
Wolfgang Betz 34:edda6a7238ec 110 #define IS_SPIRIT_GPIO(PIN) ((PIN == SPIRIT_GPIO_0) || \
Wolfgang Betz 34:edda6a7238ec 111 (PIN == SPIRIT_GPIO_1) || \
Wolfgang Betz 34:edda6a7238ec 112 (PIN == SPIRIT_GPIO_2) || \
Wolfgang Betz 34:edda6a7238ec 113 (PIN == SPIRIT_GPIO_3))
Wolfgang Betz 34:edda6a7238ec 114
Wolfgang Betz 34:edda6a7238ec 115
Wolfgang Betz 34:edda6a7238ec 116 /**
Wolfgang Betz 34:edda6a7238ec 117 * @brief SPIRIT GPIO mode enumeration.
Wolfgang Betz 34:edda6a7238ec 118 */
Wolfgang Betz 34:edda6a7238ec 119 typedef enum
Wolfgang Betz 34:edda6a7238ec 120 {
Wolfgang Betz 34:edda6a7238ec 121 SPIRIT_GPIO_MODE_DIGITAL_INPUT = 0x01, /*!< Digital Input on GPIO */
Wolfgang Betz 34:edda6a7238ec 122 SPIRIT_GPIO_MODE_DIGITAL_OUTPUT_LP = 0x02, /*!< Digital Output on GPIO (low current) */
Wolfgang Betz 34:edda6a7238ec 123 SPIRIT_GPIO_MODE_DIGITAL_OUTPUT_HP = 0x03 /*!< Digital Output on GPIO (high current) */
Wolfgang Betz 34:edda6a7238ec 124 }SpiritGpioMode;
Wolfgang Betz 34:edda6a7238ec 125
Wolfgang Betz 34:edda6a7238ec 126 #define IS_SPIRIT_GPIO_MODE(MODE) ((MODE == SPIRIT_GPIO_MODE_DIGITAL_INPUT) || \
Wolfgang Betz 34:edda6a7238ec 127 (MODE == SPIRIT_GPIO_MODE_DIGITAL_OUTPUT_LP) || \
Wolfgang Betz 34:edda6a7238ec 128 (MODE == SPIRIT_GPIO_MODE_DIGITAL_OUTPUT_HP))
Wolfgang Betz 34:edda6a7238ec 129
Wolfgang Betz 34:edda6a7238ec 130
Wolfgang Betz 34:edda6a7238ec 131
Wolfgang Betz 34:edda6a7238ec 132 /**
Wolfgang Betz 34:edda6a7238ec 133 * @brief SPIRIT I/O selection enumeration.
Wolfgang Betz 34:edda6a7238ec 134 */
Wolfgang Betz 34:edda6a7238ec 135 typedef enum
Wolfgang Betz 34:edda6a7238ec 136 {
Wolfgang Betz 34:edda6a7238ec 137 SPIRIT_GPIO_DIG_OUT_IRQ = 0x00, /*!< nIRQ (Interrupt Request, active low) , default configuration after POR */
Wolfgang Betz 34:edda6a7238ec 138 SPIRIT_GPIO_DIG_OUT_POR_INV = 0x08, /*!< POR inverted (active low) */
Wolfgang Betz 34:edda6a7238ec 139 SPIRIT_GPIO_DIG_OUT_WUT_EXP = 0x10, /*!< Wake-Up Timer expiration: "1" when WUT has expired */
Wolfgang Betz 34:edda6a7238ec 140 SPIRIT_GPIO_DIG_OUT_LBD = 0x18, /*!< Low battery detection: "1" when battery is below threshold setting */
Wolfgang Betz 34:edda6a7238ec 141 SPIRIT_GPIO_DIG_OUT_TX_DATA = 0x20, /*!< TX data internal clock output (TX data are sampled on the rising edge of it) */
Wolfgang Betz 34:edda6a7238ec 142 SPIRIT_GPIO_DIG_OUT_TX_STATE = 0x28, /*!< TX state indication: "1" when Spirit1 is passing in the TX state */
Wolfgang Betz 34:edda6a7238ec 143 SPIRIT_GPIO_DIG_OUT_TX_FIFO_ALMOST_EMPTY = 0x30, /*!< TX FIFO Almost Empty Flag */
Wolfgang Betz 34:edda6a7238ec 144 SPIRIT_GPIO_DIG_OUT_TX_FIFO_ALMOST_FULL = 0x38, /*!< TX FIFO Almost Full Flag */
Wolfgang Betz 34:edda6a7238ec 145 SPIRIT_GPIO_DIG_OUT_RX_DATA = 0x40, /*!< RX data output */
Wolfgang Betz 34:edda6a7238ec 146 SPIRIT_GPIO_DIG_OUT_RX_CLOCK = 0x48, /*!< RX clock output (recovered from received data) */
Wolfgang Betz 34:edda6a7238ec 147 SPIRIT_GPIO_DIG_OUT_RX_STATE = 0x50, /*!< RX state indication: "1" when Spirit1 is passing in the RX state */
Wolfgang Betz 34:edda6a7238ec 148 SPIRIT_GPIO_DIG_OUT_RX_FIFO_ALMOST_FULL = 0x58, /*!< RX FIFO Almost Full Flag */
Wolfgang Betz 34:edda6a7238ec 149 SPIRIT_GPIO_DIG_OUT_RX_FIFO_ALMOST_EMPTY = 0x60, /*!< RX FIFO Almost Empty Flag */
Wolfgang Betz 34:edda6a7238ec 150 SPIRIT_GPIO_DIG_OUT_ANTENNA_SWITCH = 0x68, /*!< Antenna switch used for antenna diversity */
Wolfgang Betz 34:edda6a7238ec 151 SPIRIT_GPIO_DIG_OUT_VALID_PREAMBLE = 0x70, /*!< Valid Preamble Detected Flag */
Wolfgang Betz 34:edda6a7238ec 152 SPIRIT_GPIO_DIG_OUT_SYNC_DETECTED = 0x78, /*!< Sync WordSync Word Detected Flag */
Wolfgang Betz 34:edda6a7238ec 153 SPIRIT_GPIO_DIG_OUT_RSSI_THRESHOLD = 0x80, /*!< RSSI above threshold */
Wolfgang Betz 34:edda6a7238ec 154 SPIRIT_GPIO_DIG_OUT_MCU_CLOCK = 0x88, /*!< MCU Clock */
Wolfgang Betz 34:edda6a7238ec 155 SPIRIT_GPIO_DIG_OUT_TX_RX_MODE = 0x90, /*!< TX or RX mode indicator (to enable an external range extender) */
Wolfgang Betz 34:edda6a7238ec 156 SPIRIT_GPIO_DIG_OUT_VDD = 0x98, /*!< VDD (to emulate an additional GPIO of the MCU, programmable by SPI) */
Wolfgang Betz 34:edda6a7238ec 157 SPIRIT_GPIO_DIG_OUT_GND = 0xA0, /*!< GND (to emulate an additional GPIO of the MCU, programmable by SPI) */
Wolfgang Betz 34:edda6a7238ec 158 SPIRIT_GPIO_DIG_OUT_SMPS_EXT = 0xA8, /*!< External SMPS enable signal (active high) */
Wolfgang Betz 34:edda6a7238ec 159 SPIRIT_GPIO_DIG_OUT_SLEEP_OR_STANDBY = 0xB0,
Wolfgang Betz 34:edda6a7238ec 160 SPIRIT_GPIO_DIG_OUT_READY = 0xB8,
Wolfgang Betz 34:edda6a7238ec 161 SPIRIT_GPIO_DIG_OUT_LOCK = 0xC0,
Wolfgang Betz 34:edda6a7238ec 162 SPIRIT_GPIO_DIG_OUT_WAIT_FOR_LOCK_SIG = 0xC8,
Wolfgang Betz 34:edda6a7238ec 163 SPIRIT_GPIO_DIG_OUT_WAIT_FOR_TIMER_FOR_LOCK = 0xD0,
Wolfgang Betz 34:edda6a7238ec 164 SPIRIT_GPIO_DIG_OUT_WAIT_FOR_READY2_SIG = 0xD8,
Wolfgang Betz 34:edda6a7238ec 165 SPIRIT_GPIO_DIG_OUT_WAIT_FOR_TIMER_FOR_PM_SET = 0xE0,
Wolfgang Betz 34:edda6a7238ec 166 SPIRIT_GPIO_DIG_OUT_WAIT_VCO_CALIBRATION = 0xE8,
Wolfgang Betz 34:edda6a7238ec 167 SPIRIT_GPIO_DIG_OUT_ENABLE_SYNTH_FULL_CIRCUIT = 0xF0,
Wolfgang Betz 34:edda6a7238ec 168 SPIRIT_GPIO_DIG_OUT_WAIT_FOR_RCCAL_OK_SIG = 0xFF,
Wolfgang Betz 34:edda6a7238ec 169
Wolfgang Betz 34:edda6a7238ec 170 SPIRIT_GPIO_DIG_IN_TX_COMMAND = 0x00,
Wolfgang Betz 34:edda6a7238ec 171 SPIRIT_GPIO_DIG_IN_RX_COMMAND = 0x08,
Wolfgang Betz 34:edda6a7238ec 172 SPIRIT_GPIO_DIG_IN_TX_DATA_INPUT_FOR_DIRECTRF = 0x10,
Wolfgang Betz 34:edda6a7238ec 173 SPIRIT_GPIO_DIG_IN_DATA_WAKEUP = 0x18,
Wolfgang Betz 34:edda6a7238ec 174 SPIRIT_GPIO_DIG_IN_EXT_CLOCK_AT_34_7KHZ = 0x20
Wolfgang Betz 34:edda6a7238ec 175
Wolfgang Betz 34:edda6a7238ec 176 }SpiritGpioIO;
Wolfgang Betz 34:edda6a7238ec 177
Wolfgang Betz 34:edda6a7238ec 178 #define IS_SPIRIT_GPIO_IO(IO_SEL) ((IO_SEL == SPIRIT_GPIO_DIG_OUT_IRQ) || \
Wolfgang Betz 34:edda6a7238ec 179 (IO_SEL == SPIRIT_GPIO_DIG_OUT_POR_INV) || \
Wolfgang Betz 34:edda6a7238ec 180 (IO_SEL == SPIRIT_GPIO_DIG_OUT_WUT_EXP) || \
Wolfgang Betz 34:edda6a7238ec 181 (IO_SEL == SPIRIT_GPIO_DIG_OUT_LBD) || \
Wolfgang Betz 34:edda6a7238ec 182 (IO_SEL == SPIRIT_GPIO_DIG_OUT_TX_DATA) || \
Wolfgang Betz 34:edda6a7238ec 183 (IO_SEL == SPIRIT_GPIO_DIG_OUT_TX_STATE) || \
Wolfgang Betz 34:edda6a7238ec 184 (IO_SEL == SPIRIT_GPIO_DIG_OUT_TX_FIFO_ALMOST_EMPTY) || \
Wolfgang Betz 34:edda6a7238ec 185 (IO_SEL == SPIRIT_GPIO_DIG_OUT_TX_FIFO_ALMOST_FULL) || \
Wolfgang Betz 34:edda6a7238ec 186 (IO_SEL == SPIRIT_GPIO_DIG_OUT_RX_DATA) || \
Wolfgang Betz 34:edda6a7238ec 187 (IO_SEL == SPIRIT_GPIO_DIG_OUT_RX_CLOCK) || \
Wolfgang Betz 34:edda6a7238ec 188 (IO_SEL == SPIRIT_GPIO_DIG_OUT_RX_STATE) || \
Wolfgang Betz 34:edda6a7238ec 189 (IO_SEL == SPIRIT_GPIO_DIG_OUT_RX_FIFO_ALMOST_FULL) || \
Wolfgang Betz 34:edda6a7238ec 190 (IO_SEL == SPIRIT_GPIO_DIG_OUT_RX_FIFO_ALMOST_EMPTY) || \
Wolfgang Betz 34:edda6a7238ec 191 (IO_SEL == SPIRIT_GPIO_DIG_OUT_ANTENNA_SWITCH) || \
Wolfgang Betz 34:edda6a7238ec 192 (IO_SEL == SPIRIT_GPIO_DIG_OUT_VALID_PREAMBLE) || \
Wolfgang Betz 34:edda6a7238ec 193 (IO_SEL == SPIRIT_GPIO_DIG_OUT_SYNC_DETECTED) || \
Wolfgang Betz 34:edda6a7238ec 194 (IO_SEL == SPIRIT_GPIO_DIG_OUT_RSSI_THRESHOLD) || \
Wolfgang Betz 34:edda6a7238ec 195 (IO_SEL == SPIRIT_GPIO_DIG_OUT_MCU_CLOCK) || \
Wolfgang Betz 34:edda6a7238ec 196 (IO_SEL == SPIRIT_GPIO_DIG_OUT_TX_RX_MODE) || \
Wolfgang Betz 34:edda6a7238ec 197 (IO_SEL == SPIRIT_GPIO_DIG_OUT_VDD) || \
Wolfgang Betz 34:edda6a7238ec 198 (IO_SEL == SPIRIT_GPIO_DIG_OUT_GND) || \
Wolfgang Betz 34:edda6a7238ec 199 (IO_SEL == SPIRIT_GPIO_DIG_OUT_SMPS_EXT) ||\
Wolfgang Betz 34:edda6a7238ec 200 (IO_SEL == SPIRIT_GPIO_DIG_OUT_SLEEP_OR_STANDBY) ||\
Wolfgang Betz 34:edda6a7238ec 201 (IO_SEL == SPIRIT_GPIO_DIG_OUT_READY) ||\
Wolfgang Betz 34:edda6a7238ec 202 (IO_SEL == SPIRIT_GPIO_DIG_OUT_LOCK) ||\
Wolfgang Betz 34:edda6a7238ec 203 (IO_SEL == SPIRIT_GPIO_DIG_OUT_WAIT_FOR_LOCK_SIG) ||\
Wolfgang Betz 34:edda6a7238ec 204 (IO_SEL == SPIRIT_GPIO_DIG_OUT_WAIT_FOR_TIMER_FOR_LOCK) ||\
Wolfgang Betz 34:edda6a7238ec 205 (IO_SEL == SPIRIT_GPIO_DIG_OUT_WAIT_FOR_READY2_SIG) ||\
Wolfgang Betz 34:edda6a7238ec 206 (IO_SEL == SPIRIT_GPIO_DIG_OUT_WAIT_FOR_TIMER_FOR_PM_SET) ||\
Wolfgang Betz 34:edda6a7238ec 207 (IO_SEL == SPIRIT_GPIO_DIG_OUT_WAIT_VCO_CALIBRATION) ||\
Wolfgang Betz 34:edda6a7238ec 208 (IO_SEL == SPIRIT_GPIO_DIG_OUT_ENABLE_SYNTH_FULL_CIRCUIT) ||\
Wolfgang Betz 34:edda6a7238ec 209 (IO_SEL == SPIRIT_GPIO_DIG_OUT_WAIT_FOR_RCCAL_OK_SIG) ||\
Wolfgang Betz 34:edda6a7238ec 210 (IO_SEL == SPIRIT_GPIO_DIG_IN_TX_COMMAND) ||\
Wolfgang Betz 34:edda6a7238ec 211 (IO_SEL == SPIRIT_GPIO_DIG_IN_RX_COMMAND) ||\
Wolfgang Betz 34:edda6a7238ec 212 (IO_SEL == SPIRIT_GPIO_DIG_IN_TX_DATA_INPUT_FOR_DIRECTRF) ||\
Wolfgang Betz 34:edda6a7238ec 213 (IO_SEL == SPIRIT_GPIO_DIG_IN_DATA_WAKEUP) ||\
Wolfgang Betz 34:edda6a7238ec 214 (IO_SEL == SPIRIT_GPIO_DIG_IN_EXT_CLOCK_AT_34_7KHZ))
Wolfgang Betz 34:edda6a7238ec 215
Wolfgang Betz 34:edda6a7238ec 216 /**
Wolfgang Betz 34:edda6a7238ec 217 * @brief SPIRIT OutputLevel enumeration.
Wolfgang Betz 34:edda6a7238ec 218 */
Wolfgang Betz 34:edda6a7238ec 219
Wolfgang Betz 34:edda6a7238ec 220 typedef enum
Wolfgang Betz 34:edda6a7238ec 221 {
Wolfgang Betz 34:edda6a7238ec 222 LOW = 0,
Wolfgang Betz 34:edda6a7238ec 223 HIGH = !LOW
Wolfgang Betz 34:edda6a7238ec 224 }OutputLevel;
Wolfgang Betz 34:edda6a7238ec 225
Wolfgang Betz 34:edda6a7238ec 226 #define IS_SPIRIT_GPIO_LEVEL(LEVEL) ((LEVEL == LOW) || \
Wolfgang Betz 34:edda6a7238ec 227 (LEVEL == HIGH))
Wolfgang Betz 34:edda6a7238ec 228
Wolfgang Betz 34:edda6a7238ec 229
Wolfgang Betz 34:edda6a7238ec 230 /**
Wolfgang Betz 34:edda6a7238ec 231 * @brief SPIRIT GPIO Init structure definition.
Wolfgang Betz 34:edda6a7238ec 232 */
Wolfgang Betz 34:edda6a7238ec 233 typedef struct
Wolfgang Betz 34:edda6a7238ec 234 {
Wolfgang Betz 34:edda6a7238ec 235 SpiritGpioPin xSpiritGpioPin; /*!< Specifies the GPIO pins to be configured.
Wolfgang Betz 34:edda6a7238ec 236 This parameter can be any value of @ref SpiritGpioPin */
Wolfgang Betz 34:edda6a7238ec 237
Wolfgang Betz 34:edda6a7238ec 238 SpiritGpioMode xSpiritGpioMode; /*!< Specifies the operating mode for the selected pins.
Wolfgang Betz 34:edda6a7238ec 239 This parameter can be a value of @ref SpiritGpioMode */
Wolfgang Betz 34:edda6a7238ec 240
Wolfgang Betz 34:edda6a7238ec 241 SpiritGpioIO xSpiritGpioIO; /*!< Specifies the I/O selection for the selected pins.
Wolfgang Betz 34:edda6a7238ec 242 This parameter can be a value of @ref SpiritGpioIO */
Wolfgang Betz 34:edda6a7238ec 243
Wolfgang Betz 34:edda6a7238ec 244 }SGpioInit;
Wolfgang Betz 34:edda6a7238ec 245
Wolfgang Betz 34:edda6a7238ec 246
Wolfgang Betz 34:edda6a7238ec 247
Wolfgang Betz 34:edda6a7238ec 248 /**
Wolfgang Betz 34:edda6a7238ec 249 * @brief SPIRIT clock output XO prescaler enumeration.
Wolfgang Betz 34:edda6a7238ec 250 */
Wolfgang Betz 34:edda6a7238ec 251
Wolfgang Betz 34:edda6a7238ec 252 typedef enum
Wolfgang Betz 34:edda6a7238ec 253 {
Wolfgang Betz 34:edda6a7238ec 254 XO_RATIO_1 = 0x00, /*!< XO Clock signal available on the GPIO divided by 1 */
Wolfgang Betz 34:edda6a7238ec 255 XO_RATIO_2_3 = 0x02, /*!< XO Clock signal available on the GPIO divided by 2/3 */
Wolfgang Betz 34:edda6a7238ec 256 XO_RATIO_1_2 = 0x04, /*!< XO Clock signal available on the GPIO divided by 1/2 */
Wolfgang Betz 34:edda6a7238ec 257 XO_RATIO_1_3 = 0x06, /*!< XO Clock signal available on the GPIO divided by 1/3 */
Wolfgang Betz 34:edda6a7238ec 258 XO_RATIO_1_4 = 0x08, /*!< XO Clock signal available on the GPIO divided by 1/4 */
Wolfgang Betz 34:edda6a7238ec 259 XO_RATIO_1_6 = 0x0A, /*!< XO Clock signal available on the GPIO divided by 1/6 */
Wolfgang Betz 34:edda6a7238ec 260 XO_RATIO_1_8 = 0x0C, /*!< XO Clock signal available on the GPIO divided by 1/8 */
Wolfgang Betz 34:edda6a7238ec 261 XO_RATIO_1_12 = 0x0E, /*!< XO Clock signal available on the GPIO divided by 1/12 */
Wolfgang Betz 34:edda6a7238ec 262 XO_RATIO_1_16 = 0x10, /*!< XO Clock signal available on the GPIO divided by 1/16 */
Wolfgang Betz 34:edda6a7238ec 263 XO_RATIO_1_24 = 0x12, /*!< XO Clock signal available on the GPIO divided by 1/24 */
Wolfgang Betz 34:edda6a7238ec 264 XO_RATIO_1_36 = 0x14, /*!< XO Clock signal available on the GPIO divided by 1/36 */
Wolfgang Betz 34:edda6a7238ec 265 XO_RATIO_1_48 = 0x16, /*!< XO Clock signal available on the GPIO divided by 1/48 */
Wolfgang Betz 34:edda6a7238ec 266 XO_RATIO_1_64 = 0x18, /*!< XO Clock signal available on the GPIO divided by 1/64 */
Wolfgang Betz 34:edda6a7238ec 267 XO_RATIO_1_96 = 0x1A, /*!< XO Clock signal available on the GPIO divided by 1/96 */
Wolfgang Betz 34:edda6a7238ec 268 XO_RATIO_1_128 = 0x1C, /*!< XO Clock signal available on the GPIO divided by 1/128 */
Wolfgang Betz 34:edda6a7238ec 269 XO_RATIO_1_192 = 0x1E /*!< XO Clock signal available on the GPIO divided by 1/196 */
Wolfgang Betz 34:edda6a7238ec 270 }ClockOutputXOPrescaler;
Wolfgang Betz 34:edda6a7238ec 271
Wolfgang Betz 34:edda6a7238ec 272 #define IS_SPIRIT_CLOCK_OUTPUT_XO(RATIO) ((RATIO == XO_RATIO_1) || \
Wolfgang Betz 34:edda6a7238ec 273 (RATIO == XO_RATIO_2_3) || \
Wolfgang Betz 34:edda6a7238ec 274 (RATIO == XO_RATIO_1_2) || \
Wolfgang Betz 34:edda6a7238ec 275 (RATIO == XO_RATIO_1_3) || \
Wolfgang Betz 34:edda6a7238ec 276 (RATIO == XO_RATIO_1_4) || \
Wolfgang Betz 34:edda6a7238ec 277 (RATIO == XO_RATIO_1_6) || \
Wolfgang Betz 34:edda6a7238ec 278 (RATIO == XO_RATIO_1_8) || \
Wolfgang Betz 34:edda6a7238ec 279 (RATIO == XO_RATIO_1_12) || \
Wolfgang Betz 34:edda6a7238ec 280 (RATIO == XO_RATIO_1_16) || \
Wolfgang Betz 34:edda6a7238ec 281 (RATIO == XO_RATIO_1_24) || \
Wolfgang Betz 34:edda6a7238ec 282 (RATIO == XO_RATIO_1_36) || \
Wolfgang Betz 34:edda6a7238ec 283 (RATIO == XO_RATIO_1_48) || \
Wolfgang Betz 34:edda6a7238ec 284 (RATIO == XO_RATIO_1_64) || \
Wolfgang Betz 34:edda6a7238ec 285 (RATIO == XO_RATIO_1_96) || \
Wolfgang Betz 34:edda6a7238ec 286 (RATIO == XO_RATIO_1_128) || \
Wolfgang Betz 34:edda6a7238ec 287 (RATIO == XO_RATIO_1_192))
Wolfgang Betz 34:edda6a7238ec 288
Wolfgang Betz 34:edda6a7238ec 289 /**
Wolfgang Betz 34:edda6a7238ec 290 * @brief SPIRIT Clock Output RCO prescaler enumeration.
Wolfgang Betz 34:edda6a7238ec 291 */
Wolfgang Betz 34:edda6a7238ec 292
Wolfgang Betz 34:edda6a7238ec 293 typedef enum
Wolfgang Betz 34:edda6a7238ec 294 {
Wolfgang Betz 34:edda6a7238ec 295 RCO_RATIO_1 = 0x00, /*!< RCO Clock signal available on the GPIO divided by 1 */
Wolfgang Betz 34:edda6a7238ec 296 RCO_RATIO_1_128 = 0x01 /*!< RCO Clock signal available on the GPIO divided by 1/128 */
Wolfgang Betz 34:edda6a7238ec 297 }ClockOutputRCOPrescaler;
Wolfgang Betz 34:edda6a7238ec 298
Wolfgang Betz 34:edda6a7238ec 299 #define IS_SPIRIT_CLOCK_OUTPUT_RCO(RATIO) ((RATIO == RCO_RATIO_1) || \
Wolfgang Betz 34:edda6a7238ec 300 (RATIO == RCO_RATIO_1_128))
Wolfgang Betz 34:edda6a7238ec 301
Wolfgang Betz 34:edda6a7238ec 302 /**
Wolfgang Betz 34:edda6a7238ec 303 * @brief SPIRIT ExtraClockCycles enumeration.
Wolfgang Betz 34:edda6a7238ec 304 */
Wolfgang Betz 34:edda6a7238ec 305
Wolfgang Betz 34:edda6a7238ec 306 typedef enum
Wolfgang Betz 34:edda6a7238ec 307 {
Wolfgang Betz 34:edda6a7238ec 308 EXTRA_CLOCK_CYCLES_0 = 0x00, /*!< 0 extra clock cycles provided to the MCU before switching to STANDBY state */
Wolfgang Betz 34:edda6a7238ec 309 EXTRA_CLOCK_CYCLES_64 = 0x20, /*!< 64 extra clock cycles provided to the MCU before switching to STANDBY state */
Wolfgang Betz 34:edda6a7238ec 310 EXTRA_CLOCK_CYCLES_256 = 0x40, /*!< 256 extra clock cycles provided to the MCU before switching to STANDBY state */
Wolfgang Betz 34:edda6a7238ec 311 EXTRA_CLOCK_CYCLES_512 = 0x60 /*!< 512 extra clock cycles provided to the MCU before switching to STANDBY state */
Wolfgang Betz 34:edda6a7238ec 312 }ExtraClockCycles;
Wolfgang Betz 34:edda6a7238ec 313
Wolfgang Betz 34:edda6a7238ec 314 #define IS_SPIRIT_CLOCK_OUTPUT_EXTRA_CYCLES(CYCLES) ((CYCLES == EXTRA_CLOCK_CYCLES_0) || \
Wolfgang Betz 34:edda6a7238ec 315 (CYCLES == EXTRA_CLOCK_CYCLES_64) || \
Wolfgang Betz 34:edda6a7238ec 316 (CYCLES == EXTRA_CLOCK_CYCLES_256) || \
Wolfgang Betz 34:edda6a7238ec 317 (CYCLES == EXTRA_CLOCK_CYCLES_512))
Wolfgang Betz 34:edda6a7238ec 318
Wolfgang Betz 34:edda6a7238ec 319
Wolfgang Betz 34:edda6a7238ec 320 /**
Wolfgang Betz 34:edda6a7238ec 321 * @brief SPIRIT Clock Output initialization structure definition.
Wolfgang Betz 34:edda6a7238ec 322 */
Wolfgang Betz 34:edda6a7238ec 323 typedef struct
Wolfgang Betz 34:edda6a7238ec 324 {
Wolfgang Betz 34:edda6a7238ec 325 ClockOutputXOPrescaler xClockOutputXOPrescaler; /*!< Specifies the XO Ratio as clock output.
Wolfgang Betz 34:edda6a7238ec 326 This parameter can be any value of @ref ClockOutputXOPrescaler */
Wolfgang Betz 34:edda6a7238ec 327
Wolfgang Betz 34:edda6a7238ec 328 ClockOutputRCOPrescaler xClockOutputRCOPrescaler; /*!< Specifies the RCO Ratio as clock output.
Wolfgang Betz 34:edda6a7238ec 329 This parameter can be a value of @ref ClockOutputRCOPrescaler */
Wolfgang Betz 34:edda6a7238ec 330
Wolfgang Betz 34:edda6a7238ec 331 ExtraClockCycles xExtraClockCycles; /*!< Specifies the Extra Clock Cycles provided before entering in Standby State.
Wolfgang Betz 34:edda6a7238ec 332 This parameter can be a value of @ref ExtraClockCycles */
Wolfgang Betz 34:edda6a7238ec 333
Wolfgang Betz 34:edda6a7238ec 334 }ClockOutputInit;
Wolfgang Betz 34:edda6a7238ec 335
Wolfgang Betz 34:edda6a7238ec 336
Wolfgang Betz 34:edda6a7238ec 337
Wolfgang Betz 34:edda6a7238ec 338 /**
Wolfgang Betz 34:edda6a7238ec 339 * @}
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 /** @defgroup Gpio_Exported_Constants GPIO Exported Constants
Wolfgang Betz 34:edda6a7238ec 345 * @{
Wolfgang Betz 34:edda6a7238ec 346 */
Wolfgang Betz 34:edda6a7238ec 347
Wolfgang Betz 34:edda6a7238ec 348
Wolfgang Betz 34:edda6a7238ec 349 /**
Wolfgang Betz 34:edda6a7238ec 350 * @}
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 /** @defgroup Gpio_Exported_Macros GPIO Exported Macros
Wolfgang Betz 34:edda6a7238ec 356 * @{
Wolfgang Betz 34:edda6a7238ec 357 */
Wolfgang Betz 34:edda6a7238ec 358
Wolfgang Betz 34:edda6a7238ec 359
Wolfgang Betz 34:edda6a7238ec 360 /**
Wolfgang Betz 34:edda6a7238ec 361 * @}
Wolfgang Betz 34:edda6a7238ec 362 */
Wolfgang Betz 34:edda6a7238ec 363
Wolfgang Betz 34:edda6a7238ec 364
Wolfgang Betz 34:edda6a7238ec 365
Wolfgang Betz 34:edda6a7238ec 366 /** @defgroup Gpio_Exported_Functions GPIO Exported Functions
Wolfgang Betz 34:edda6a7238ec 367 * @{
Wolfgang Betz 34:edda6a7238ec 368 */
Wolfgang Betz 34:edda6a7238ec 369
Wolfgang Betz 34:edda6a7238ec 370 void SpiritGpioInit(SGpioInit* pxGpioInitStruct);
Wolfgang Betz 34:edda6a7238ec 371 void SpiritGpioTemperatureSensor(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 372 void SpiritGpioSetLevel(SpiritGpioPin xGpioX, OutputLevel xLevel);
Wolfgang Betz 34:edda6a7238ec 373 OutputLevel SpiritGpioGetLevel(SpiritGpioPin xGpioX);
Wolfgang Betz 34:edda6a7238ec 374 void SpiritGpioClockOutput(SpiritFunctionalState xNewState);
Wolfgang Betz 34:edda6a7238ec 375 void SpiritGpioClockOutputInit(ClockOutputInit* pxClockOutputInitStruct);
Wolfgang Betz 34:edda6a7238ec 376 void SpiritGpioSetXOPrescaler(ClockOutputXOPrescaler xXOPrescaler);
Wolfgang Betz 34:edda6a7238ec 377 ClockOutputXOPrescaler SpiritGpioGetXOPrescaler(void);
Wolfgang Betz 34:edda6a7238ec 378 void SpiritGpioSetRCOPrescaler(ClockOutputRCOPrescaler xRCOPrescaler);
Wolfgang Betz 34:edda6a7238ec 379 ClockOutputRCOPrescaler SpiritGpioGetRCOPrescaler(void);
Wolfgang Betz 34:edda6a7238ec 380 void SpiritGpioSetExtraClockCycles(ExtraClockCycles xExtraCycles);
Wolfgang Betz 34:edda6a7238ec 381 ExtraClockCycles SpiritGpioGetExtraClockCycles(void);
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
Wolfgang Betz 34:edda6a7238ec 393 /**
Wolfgang Betz 34:edda6a7238ec 394 * @}
Wolfgang Betz 34:edda6a7238ec 395 */
Wolfgang Betz 34:edda6a7238ec 396
Wolfgang Betz 34:edda6a7238ec 397
Wolfgang Betz 34:edda6a7238ec 398
Wolfgang Betz 34:edda6a7238ec 399 #ifdef __cplusplus
Wolfgang Betz 34:edda6a7238ec 400 }
Wolfgang Betz 34:edda6a7238ec 401 #endif
Wolfgang Betz 34:edda6a7238ec 402
Wolfgang Betz 34:edda6a7238ec 403 #endif
Wolfgang Betz 34:edda6a7238ec 404
Wolfgang Betz 34:edda6a7238ec 405 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/