Added support for the WNC M14A2A Cellular LTE Data Module.

Dependencies:   WNC14A2AInterface

Easy Connect

Easily add all supported connectivity methods to your mbed OS project

This project is derived from https://developer.mbed.org/teams/sandbox/code/simple-mbed-client-example/file/dd6231df71bb/easy-connect.lib. It give user the ability to switch between connectivity methods and includes support for the WNC14A2A Data Module. The `NetworkInterface` API makes this easy, but you still need a mechanism for the user to select the connection method, The selection is made by modifying the `mbed_app.json` file and using `easy_connect()` from your application.

Specifying connectivity method

To add support for the WNC14A2A, add the following to your ``mbed_app.json`` file:

mbed_app.json

{
    "config": {
        "network-interface":{
            "help": "options are ETHERNET,WIFI_ESP8266,WIFI_ODIN,MESH_LOWPAN_ND,MESH_THREAD,WNC14A2A",
            "value": "WNC14A2A"
        }
    },
}

After you choose `WNC14A2A` you'll also need to indicate if you want debug output or not by Enabling (true) or Disabling (false) WNC_DEBUG.

If WNC_DEBUG is enabled, there are 3 different levels of debug output (selected via bit settings). These debug levels are set using the following values:

ValueDescription
1Basic WNC driver debug output
2Comprehensive WNC driver debug output
4Network Layer debug output

You can have any combination of these three bit values for a total value of 0 – 7.

WNC Debug Settings

    "config": {
        "WNC_DEBUG": {
            "value": false
        },
        "WNC_DEBUG_SETTING": {
            "value": 4
        },
    }

Using Easy Connect from your application

Easy Connect has just one function which will either return a `NetworkInterface`-pointer or `NULL`:

Sample Code

#include "easy-connect.h"

int main(int, char**) {
    NetworkInterface* network = easy_connect(true); /* has 1 argument, enable_logging (pass in true to log to serial port) */
    if (!network) {
        printf("Connecting to the network failed... See serial output.\r\n");
        return 1;
    }
 
    // Rest of your program
}

Tested on

  • K64F with Ethernet.
  • AT&T Cellular IoT Starter Kit with WNC M14A2A Cellular Data Module

The WNCInterface class currently supports the following version(s):

  • MPSS: M14A2A_v11.50.164451 APSS: M14A2A_v11.53.164451

License

This library is released under the Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License and may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Committer:
group-Avnet
Date:
Wed Apr 19 01:08:11 2017 +0000
Revision:
0:478cfd88041f
Initial commit

Who changed what in which revision?

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