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_Qi.c
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 Configuration and management of SPIRIT QI.
group-Avnet 0:478cfd88041f 8 * @details
group-Avnet 0:478cfd88041f 9 *
group-Avnet 0:478cfd88041f 10 * @attention
group-Avnet 0:478cfd88041f 11 *
group-Avnet 0:478cfd88041f 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
group-Avnet 0:478cfd88041f 13 *
group-Avnet 0:478cfd88041f 14 * Redistribution and use in source and binary forms, with or without modification,
group-Avnet 0:478cfd88041f 15 * are permitted provided that the following conditions are met:
group-Avnet 0:478cfd88041f 16 * 1. Redistributions of source code must retain the above copyright notice,
group-Avnet 0:478cfd88041f 17 * this list of conditions and the following disclaimer.
group-Avnet 0:478cfd88041f 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
group-Avnet 0:478cfd88041f 19 * this list of conditions and the following disclaimer in the documentation
group-Avnet 0:478cfd88041f 20 * and/or other materials provided with the distribution.
group-Avnet 0:478cfd88041f 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
group-Avnet 0:478cfd88041f 22 * may be used to endorse or promote products derived from this software
group-Avnet 0:478cfd88041f 23 * without specific prior written permission.
group-Avnet 0:478cfd88041f 24 *
group-Avnet 0:478cfd88041f 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
group-Avnet 0:478cfd88041f 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
group-Avnet 0:478cfd88041f 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
group-Avnet 0:478cfd88041f 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
group-Avnet 0:478cfd88041f 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
group-Avnet 0:478cfd88041f 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
group-Avnet 0:478cfd88041f 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
group-Avnet 0:478cfd88041f 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
group-Avnet 0:478cfd88041f 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
group-Avnet 0:478cfd88041f 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
group-Avnet 0:478cfd88041f 35 *
group-Avnet 0:478cfd88041f 36 ******************************************************************************
group-Avnet 0:478cfd88041f 37 */
group-Avnet 0:478cfd88041f 38
group-Avnet 0:478cfd88041f 39 /* Includes ------------------------------------------------------------------*/
group-Avnet 0:478cfd88041f 40 #include "SPIRIT_Qi.h"
group-Avnet 0:478cfd88041f 41 #include "MCU_Interface.h"
group-Avnet 0:478cfd88041f 42
group-Avnet 0:478cfd88041f 43
group-Avnet 0:478cfd88041f 44
group-Avnet 0:478cfd88041f 45 /**
group-Avnet 0:478cfd88041f 46 * @addtogroup SPIRIT_Libraries
group-Avnet 0:478cfd88041f 47 * @{
group-Avnet 0:478cfd88041f 48 */
group-Avnet 0:478cfd88041f 49
group-Avnet 0:478cfd88041f 50
group-Avnet 0:478cfd88041f 51 /**
group-Avnet 0:478cfd88041f 52 * @addtogroup SPIRIT_Qi
group-Avnet 0:478cfd88041f 53 * @{
group-Avnet 0:478cfd88041f 54 */
group-Avnet 0:478cfd88041f 55
group-Avnet 0:478cfd88041f 56
group-Avnet 0:478cfd88041f 57 /**
group-Avnet 0:478cfd88041f 58 * @defgroup Qi_Private_TypesDefinitions QI Private Types Definitions
group-Avnet 0:478cfd88041f 59 * @{
group-Avnet 0:478cfd88041f 60 */
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
group-Avnet 0:478cfd88041f 66
group-Avnet 0:478cfd88041f 67 /**
group-Avnet 0:478cfd88041f 68 * @defgroup Qi_Private_Defines QI Private Defines
group-Avnet 0:478cfd88041f 69 * @{
group-Avnet 0:478cfd88041f 70 */
group-Avnet 0:478cfd88041f 71
group-Avnet 0:478cfd88041f 72 /**
group-Avnet 0:478cfd88041f 73 *@}
group-Avnet 0:478cfd88041f 74 */
group-Avnet 0:478cfd88041f 75
group-Avnet 0:478cfd88041f 76
group-Avnet 0:478cfd88041f 77 /**
group-Avnet 0:478cfd88041f 78 * @defgroup Qi_Private_Macros QI Private Macros
group-Avnet 0:478cfd88041f 79 * @{
group-Avnet 0:478cfd88041f 80 */
group-Avnet 0:478cfd88041f 81
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
group-Avnet 0:478cfd88041f 87 /**
group-Avnet 0:478cfd88041f 88 * @defgroup Qi_Private_Variables QI Private Variables
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 */
group-Avnet 0:478cfd88041f 95
group-Avnet 0:478cfd88041f 96
group-Avnet 0:478cfd88041f 97 /**
group-Avnet 0:478cfd88041f 98 * @defgroup Qi_Private_FunctionPrototypes QI Private Function Prototypes
group-Avnet 0:478cfd88041f 99 * @{
group-Avnet 0:478cfd88041f 100 */
group-Avnet 0:478cfd88041f 101
group-Avnet 0:478cfd88041f 102 /**
group-Avnet 0:478cfd88041f 103 *@}
group-Avnet 0:478cfd88041f 104 */
group-Avnet 0:478cfd88041f 105
group-Avnet 0:478cfd88041f 106
group-Avnet 0:478cfd88041f 107 /**
group-Avnet 0:478cfd88041f 108 * @defgroup Qi_Private_Functions QI Private Functions
group-Avnet 0:478cfd88041f 109 * @{
group-Avnet 0:478cfd88041f 110 */
group-Avnet 0:478cfd88041f 111
group-Avnet 0:478cfd88041f 112 /**
group-Avnet 0:478cfd88041f 113 * @brief Enables/Disables the PQI Preamble Quality Indicator check. The running peak PQI is
group-Avnet 0:478cfd88041f 114 * compared to a threshold value and the preamble valid IRQ is asserted as soon as the threshold is passed.
group-Avnet 0:478cfd88041f 115 * @param xNewState new state for PQI check.
group-Avnet 0:478cfd88041f 116 * This parameter can be: S_ENABLE or S_DISABLE.
group-Avnet 0:478cfd88041f 117 * @retval None.
group-Avnet 0:478cfd88041f 118 */
group-Avnet 0:478cfd88041f 119 void SpiritQiPqiCheck(SpiritFunctionalState xNewState)
group-Avnet 0:478cfd88041f 120 {
group-Avnet 0:478cfd88041f 121 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 122
group-Avnet 0:478cfd88041f 123 /* Check the parameters */
group-Avnet 0:478cfd88041f 124 s_assert_param(IS_SPIRIT_FUNCTIONAL_STATE(xNewState));
group-Avnet 0:478cfd88041f 125
group-Avnet 0:478cfd88041f 126 /* Reads the QI register value */
group-Avnet 0:478cfd88041f 127 g_xStatus = SpiritSpiReadRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 128
group-Avnet 0:478cfd88041f 129 /* Enables or disables the PQI Check bit on the QI_BASE register */
group-Avnet 0:478cfd88041f 130 if(xNewState == S_ENABLE)
group-Avnet 0:478cfd88041f 131 {
group-Avnet 0:478cfd88041f 132 tempRegValue |= QI_PQI_MASK;
group-Avnet 0:478cfd88041f 133 }
group-Avnet 0:478cfd88041f 134 else
group-Avnet 0:478cfd88041f 135 {
group-Avnet 0:478cfd88041f 136 tempRegValue &= ~QI_PQI_MASK;
group-Avnet 0:478cfd88041f 137 }
group-Avnet 0:478cfd88041f 138
group-Avnet 0:478cfd88041f 139 /* Writes value on the QI register */
group-Avnet 0:478cfd88041f 140 g_xStatus = SpiritSpiWriteRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 141
group-Avnet 0:478cfd88041f 142 }
group-Avnet 0:478cfd88041f 143
group-Avnet 0:478cfd88041f 144
group-Avnet 0:478cfd88041f 145 /**
group-Avnet 0:478cfd88041f 146 * @brief Enables/Disables the Synchronization Quality Indicator check. The running peak SQI is
group-Avnet 0:478cfd88041f 147 * compared to a threshold value and the sync valid IRQ is asserted as soon as the threshold is passed.
group-Avnet 0:478cfd88041f 148 * @param xNewState new state for SQI check.
group-Avnet 0:478cfd88041f 149 * This parameter can be: S_ENABLE or S_DISABLE.
group-Avnet 0:478cfd88041f 150 * @retval None.
group-Avnet 0:478cfd88041f 151 */
group-Avnet 0:478cfd88041f 152 void SpiritQiSqiCheck(SpiritFunctionalState xNewState)
group-Avnet 0:478cfd88041f 153 {
group-Avnet 0:478cfd88041f 154 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 155
group-Avnet 0:478cfd88041f 156 /* Check the parameters */
group-Avnet 0:478cfd88041f 157 s_assert_param(IS_SPIRIT_FUNCTIONAL_STATE(xNewState));
group-Avnet 0:478cfd88041f 158
group-Avnet 0:478cfd88041f 159 /* Reads the QI register value */
group-Avnet 0:478cfd88041f 160 g_xStatus = SpiritSpiReadRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 161
group-Avnet 0:478cfd88041f 162 /* Enables or disables the SQI Check bit on the QI_BASE register */
group-Avnet 0:478cfd88041f 163 if(xNewState == S_ENABLE)
group-Avnet 0:478cfd88041f 164 {
group-Avnet 0:478cfd88041f 165 tempRegValue |= QI_SQI_MASK;
group-Avnet 0:478cfd88041f 166 }
group-Avnet 0:478cfd88041f 167 else
group-Avnet 0:478cfd88041f 168 {
group-Avnet 0:478cfd88041f 169 tempRegValue &= ~QI_SQI_MASK;
group-Avnet 0:478cfd88041f 170 }
group-Avnet 0:478cfd88041f 171
group-Avnet 0:478cfd88041f 172 /* Writes value on the QI register */
group-Avnet 0:478cfd88041f 173 g_xStatus = SpiritSpiWriteRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 174
group-Avnet 0:478cfd88041f 175 }
group-Avnet 0:478cfd88041f 176
group-Avnet 0:478cfd88041f 177
group-Avnet 0:478cfd88041f 178 /**
group-Avnet 0:478cfd88041f 179 * @brief Sets the PQI threshold. The preamble quality threshold is 4*PQI_TH (PQI_TH = 0..15).
group-Avnet 0:478cfd88041f 180 * @param xPqiThr parameter of the formula above.
group-Avnet 0:478cfd88041f 181 * This variable is a @ref PqiThreshold.
group-Avnet 0:478cfd88041f 182 * @retval None.
group-Avnet 0:478cfd88041f 183 */
group-Avnet 0:478cfd88041f 184 void SpiritQiSetPqiThreshold(PqiThreshold xPqiThr)
group-Avnet 0:478cfd88041f 185 {
group-Avnet 0:478cfd88041f 186 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 187
group-Avnet 0:478cfd88041f 188 /* Check the parameters */
group-Avnet 0:478cfd88041f 189 s_assert_param(IS_PQI_THR(xPqiThr));
group-Avnet 0:478cfd88041f 190
group-Avnet 0:478cfd88041f 191 /* Reads the QI register value */
group-Avnet 0:478cfd88041f 192 g_xStatus = SpiritSpiReadRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 193
group-Avnet 0:478cfd88041f 194 /* Build the PQI threshold value to be written */
group-Avnet 0:478cfd88041f 195 tempRegValue &= 0xC3;
group-Avnet 0:478cfd88041f 196 tempRegValue |= ((uint8_t)xPqiThr);
group-Avnet 0:478cfd88041f 197
group-Avnet 0:478cfd88041f 198 /* Writes value on the QI register */
group-Avnet 0:478cfd88041f 199 g_xStatus = SpiritSpiWriteRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 200
group-Avnet 0:478cfd88041f 201 }
group-Avnet 0:478cfd88041f 202
group-Avnet 0:478cfd88041f 203
group-Avnet 0:478cfd88041f 204 /**
group-Avnet 0:478cfd88041f 205 * @brief Returns the PQI threshold. The preamble quality threshold is 4*PQI_TH (PQI_TH = 0..15).
group-Avnet 0:478cfd88041f 206 * @param None.
group-Avnet 0:478cfd88041f 207 * @retval PqiThreshold PQI threshold (PQI_TH of the formula above).
group-Avnet 0:478cfd88041f 208 */
group-Avnet 0:478cfd88041f 209 PqiThreshold SpiritQiGetPqiThreshold(void)
group-Avnet 0:478cfd88041f 210 {
group-Avnet 0:478cfd88041f 211 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 212
group-Avnet 0:478cfd88041f 213 /* Reads the QI register value */
group-Avnet 0:478cfd88041f 214 g_xStatus = SpiritSpiReadRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 215
group-Avnet 0:478cfd88041f 216 /* Rebuild and return the PQI threshold value */
group-Avnet 0:478cfd88041f 217 return (PqiThreshold)(tempRegValue & 0x3C);
group-Avnet 0:478cfd88041f 218
group-Avnet 0:478cfd88041f 219 }
group-Avnet 0:478cfd88041f 220
group-Avnet 0:478cfd88041f 221
group-Avnet 0:478cfd88041f 222 /**
group-Avnet 0:478cfd88041f 223 * @brief Sets the SQI threshold. The synchronization quality
group-Avnet 0:478cfd88041f 224 * threshold is equal to 8 * SYNC_LEN - 2 * SQI_TH with SQI_TH = 0..3. When SQI_TH is 0 perfect match is required; when
group-Avnet 0:478cfd88041f 225 * SQI_TH = 1, 2, 3 then 1, 2, or 3 bit errors are respectively accepted. It is recommended that the SQI check is always
group-Avnet 0:478cfd88041f 226 * enabled.
group-Avnet 0:478cfd88041f 227 * @param xSqiThr parameter of the formula above.
group-Avnet 0:478cfd88041f 228 * This parameter is a @ref SqiThreshold.
group-Avnet 0:478cfd88041f 229 * @retval None.
group-Avnet 0:478cfd88041f 230 */
group-Avnet 0:478cfd88041f 231 void SpiritQiSetSqiThreshold(SqiThreshold xSqiThr)
group-Avnet 0:478cfd88041f 232 {
group-Avnet 0:478cfd88041f 233 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 234
group-Avnet 0:478cfd88041f 235 /* Check the parameters */
group-Avnet 0:478cfd88041f 236 s_assert_param(IS_SQI_THR(xSqiThr));
group-Avnet 0:478cfd88041f 237
group-Avnet 0:478cfd88041f 238 /* Reads the QI register value */
group-Avnet 0:478cfd88041f 239 g_xStatus = SpiritSpiReadRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 240
group-Avnet 0:478cfd88041f 241 /* Build the SQI threshold value to be written */
group-Avnet 0:478cfd88041f 242 tempRegValue &= 0x3F;
group-Avnet 0:478cfd88041f 243 tempRegValue |= ((uint8_t)xSqiThr);
group-Avnet 0:478cfd88041f 244
group-Avnet 0:478cfd88041f 245 /* Writes the new value on the QI register */
group-Avnet 0:478cfd88041f 246 g_xStatus = SpiritSpiWriteRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 247
group-Avnet 0:478cfd88041f 248 }
group-Avnet 0:478cfd88041f 249
group-Avnet 0:478cfd88041f 250
group-Avnet 0:478cfd88041f 251 /**
group-Avnet 0:478cfd88041f 252 * @brief Returns the SQI threshold. The synchronization quality threshold is equal to 8 * SYNC_LEN - 2 * SQI_TH with SQI_TH = 0..3.
group-Avnet 0:478cfd88041f 253 * @param None.
group-Avnet 0:478cfd88041f 254 * @retval SqiThreshold SQI threshold (SQI_TH of the formula above).
group-Avnet 0:478cfd88041f 255 */
group-Avnet 0:478cfd88041f 256 SqiThreshold SpiritQiGetSqiThreshold(void)
group-Avnet 0:478cfd88041f 257 {
group-Avnet 0:478cfd88041f 258 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 259
group-Avnet 0:478cfd88041f 260 /* Reads the QI register value */
group-Avnet 0:478cfd88041f 261 g_xStatus = SpiritSpiReadRegisters(QI_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 262
group-Avnet 0:478cfd88041f 263 /* Rebuild and return the SQI threshold value */
group-Avnet 0:478cfd88041f 264 return (SqiThreshold)(tempRegValue & 0xC0);
group-Avnet 0:478cfd88041f 265
group-Avnet 0:478cfd88041f 266 }
group-Avnet 0:478cfd88041f 267
group-Avnet 0:478cfd88041f 268
group-Avnet 0:478cfd88041f 269 /**
group-Avnet 0:478cfd88041f 270 * @brief Returns the PQI value.
group-Avnet 0:478cfd88041f 271 * @param None.
group-Avnet 0:478cfd88041f 272 * @retval uint8_t PQI value.
group-Avnet 0:478cfd88041f 273 */
group-Avnet 0:478cfd88041f 274 uint8_t SpiritQiGetPqi(void)
group-Avnet 0:478cfd88041f 275 {
group-Avnet 0:478cfd88041f 276 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 277
group-Avnet 0:478cfd88041f 278 /* Reads the LINK_QUALIF2 register value */
group-Avnet 0:478cfd88041f 279 g_xStatus = SpiritSpiReadRegisters(LINK_QUALIF2_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 280
group-Avnet 0:478cfd88041f 281 /* Returns the PQI value */
group-Avnet 0:478cfd88041f 282 return tempRegValue;
group-Avnet 0:478cfd88041f 283
group-Avnet 0:478cfd88041f 284 }
group-Avnet 0:478cfd88041f 285
group-Avnet 0:478cfd88041f 286
group-Avnet 0:478cfd88041f 287 /**
group-Avnet 0:478cfd88041f 288 * @brief Returns the SQI value.
group-Avnet 0:478cfd88041f 289 * @param None.
group-Avnet 0:478cfd88041f 290 * @retval uint8_t SQI value.
group-Avnet 0:478cfd88041f 291 */
group-Avnet 0:478cfd88041f 292 uint8_t SpiritQiGetSqi(void)
group-Avnet 0:478cfd88041f 293 {
group-Avnet 0:478cfd88041f 294 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 295
group-Avnet 0:478cfd88041f 296 /* Reads the register LINK_QUALIF1 value */
group-Avnet 0:478cfd88041f 297 g_xStatus = SpiritSpiReadRegisters(LINK_QUALIF1_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 298
group-Avnet 0:478cfd88041f 299 /* Rebuild and return the SQI value */
group-Avnet 0:478cfd88041f 300 return (tempRegValue & 0x7F);
group-Avnet 0:478cfd88041f 301
group-Avnet 0:478cfd88041f 302 }
group-Avnet 0:478cfd88041f 303
group-Avnet 0:478cfd88041f 304
group-Avnet 0:478cfd88041f 305 /**
group-Avnet 0:478cfd88041f 306 * @brief Returns the LQI value.
group-Avnet 0:478cfd88041f 307 * @param None.
group-Avnet 0:478cfd88041f 308 * @retval uint8_t LQI value.
group-Avnet 0:478cfd88041f 309 */
group-Avnet 0:478cfd88041f 310 uint8_t SpiritQiGetLqi(void)
group-Avnet 0:478cfd88041f 311 {
group-Avnet 0:478cfd88041f 312 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 313
group-Avnet 0:478cfd88041f 314 /* Reads the LINK_QUALIF0 register value */
group-Avnet 0:478cfd88041f 315 g_xStatus = SpiritSpiReadRegisters(LINK_QUALIF0_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 316
group-Avnet 0:478cfd88041f 317 /* Rebuild and return the LQI value */
group-Avnet 0:478cfd88041f 318 return ((tempRegValue & 0xF0)>> 4);
group-Avnet 0:478cfd88041f 319
group-Avnet 0:478cfd88041f 320 }
group-Avnet 0:478cfd88041f 321
group-Avnet 0:478cfd88041f 322
group-Avnet 0:478cfd88041f 323 /**
group-Avnet 0:478cfd88041f 324 * @brief Returns the CS status.
group-Avnet 0:478cfd88041f 325 * @param None.
group-Avnet 0:478cfd88041f 326 * @retval SpiritFlagStatus CS value (S_SET or S_RESET).
group-Avnet 0:478cfd88041f 327 */
group-Avnet 0:478cfd88041f 328 SpiritFlagStatus SpiritQiGetCs(void)
group-Avnet 0:478cfd88041f 329 {
group-Avnet 0:478cfd88041f 330 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 331
group-Avnet 0:478cfd88041f 332 /* Reads the LINK_QUALIF1 register value */
group-Avnet 0:478cfd88041f 333 g_xStatus = SpiritSpiReadRegisters(LINK_QUALIF1_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 334
group-Avnet 0:478cfd88041f 335 /* Rebuild and returns the CS status value */
group-Avnet 0:478cfd88041f 336 if((tempRegValue & 0x80) == 0)
group-Avnet 0:478cfd88041f 337 {
group-Avnet 0:478cfd88041f 338 return S_RESET;
group-Avnet 0:478cfd88041f 339 }
group-Avnet 0:478cfd88041f 340 else
group-Avnet 0:478cfd88041f 341 {
group-Avnet 0:478cfd88041f 342 return S_SET;
group-Avnet 0:478cfd88041f 343 }
group-Avnet 0:478cfd88041f 344
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 * @brief Returns the RSSI value. The measured power is reported in steps of half a dB from 0 to 255 and is offset in such a way that -120 dBm corresponds
group-Avnet 0:478cfd88041f 350 * to 20.
group-Avnet 0:478cfd88041f 351 * @param None.
group-Avnet 0:478cfd88041f 352 * @retval uint8_t RSSI value.
group-Avnet 0:478cfd88041f 353 */
group-Avnet 0:478cfd88041f 354 uint8_t SpiritQiGetRssi(void)
group-Avnet 0:478cfd88041f 355 {
group-Avnet 0:478cfd88041f 356 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 357
group-Avnet 0:478cfd88041f 358 /* Reads the RSSI_LEVEL register value */
group-Avnet 0:478cfd88041f 359 g_xStatus = SpiritSpiReadRegisters(RSSI_LEVEL_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 360
group-Avnet 0:478cfd88041f 361 /* Returns the RSSI value */
group-Avnet 0:478cfd88041f 362 return tempRegValue;
group-Avnet 0:478cfd88041f 363
group-Avnet 0:478cfd88041f 364 }
group-Avnet 0:478cfd88041f 365
group-Avnet 0:478cfd88041f 366
group-Avnet 0:478cfd88041f 367 /**
group-Avnet 0:478cfd88041f 368 * @brief Sets the RSSI threshold.
group-Avnet 0:478cfd88041f 369 * @param cRssiThr RSSI threshold reported in steps of half a dBm with a -130 dBm offset.
group-Avnet 0:478cfd88041f 370 * This parameter must be a uint8_t.
group-Avnet 0:478cfd88041f 371 * @retval None.
group-Avnet 0:478cfd88041f 372 */
group-Avnet 0:478cfd88041f 373 void SpiritQiSetRssiThreshold(uint8_t cRssiThr)
group-Avnet 0:478cfd88041f 374 {
group-Avnet 0:478cfd88041f 375 /* Writes the new value on the RSSI_TH register */
group-Avnet 0:478cfd88041f 376 g_xStatus = SpiritSpiWriteRegisters(RSSI_TH_BASE, 1, &cRssiThr);
group-Avnet 0:478cfd88041f 377
group-Avnet 0:478cfd88041f 378 }
group-Avnet 0:478cfd88041f 379
group-Avnet 0:478cfd88041f 380
group-Avnet 0:478cfd88041f 381 /**
group-Avnet 0:478cfd88041f 382 * @brief Returns the RSSI threshold.
group-Avnet 0:478cfd88041f 383 * @param None.
group-Avnet 0:478cfd88041f 384 * @retval uint8_t RSSI threshold.
group-Avnet 0:478cfd88041f 385 */
group-Avnet 0:478cfd88041f 386 uint8_t SpiritQiGetRssiThreshold(void)
group-Avnet 0:478cfd88041f 387 {
group-Avnet 0:478cfd88041f 388 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 389
group-Avnet 0:478cfd88041f 390 /* Reads the RSSI_TH register value */
group-Avnet 0:478cfd88041f 391 g_xStatus = SpiritSpiReadRegisters(RSSI_TH_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 392
group-Avnet 0:478cfd88041f 393 /* Returns RSSI threshold */
group-Avnet 0:478cfd88041f 394 return tempRegValue;
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 /**
group-Avnet 0:478cfd88041f 400 * @brief Computes the RSSI threshold from its dBm value according to the formula: (RSSI[Dbm] + 130)/0.5
group-Avnet 0:478cfd88041f 401 * @param nDbmValue RSSI threshold reported in dBm.
group-Avnet 0:478cfd88041f 402 * This parameter must be a sint16_t.
group-Avnet 0:478cfd88041f 403 * @retval uint8_t RSSI threshold corresponding to dBm value.
group-Avnet 0:478cfd88041f 404 */
group-Avnet 0:478cfd88041f 405 uint8_t SpiritQiComputeRssiThreshold(int nDbmValue)
group-Avnet 0:478cfd88041f 406 {
group-Avnet 0:478cfd88041f 407 /* Check the parameters */
group-Avnet 0:478cfd88041f 408 s_assert_param(IS_RSSI_THR_DBM(nDbmValue));
group-Avnet 0:478cfd88041f 409
group-Avnet 0:478cfd88041f 410 /* Computes the RSSI threshold for register */
group-Avnet 0:478cfd88041f 411 return 2*(nDbmValue+130);
group-Avnet 0:478cfd88041f 412
group-Avnet 0:478cfd88041f 413 }
group-Avnet 0:478cfd88041f 414
group-Avnet 0:478cfd88041f 415 /**
group-Avnet 0:478cfd88041f 416 * @brief Sets the RSSI threshold from its dBm value according to the formula: (RSSI[Dbm] + 130)/0.5.
group-Avnet 0:478cfd88041f 417 * @param nDbmValue RSSI threshold reported in dBm.
group-Avnet 0:478cfd88041f 418 * This parameter must be a sint16_t.
group-Avnet 0:478cfd88041f 419 * @retval None.
group-Avnet 0:478cfd88041f 420 */
group-Avnet 0:478cfd88041f 421 void SpiritQiSetRssiThresholddBm(int nDbmValue)
group-Avnet 0:478cfd88041f 422 {
group-Avnet 0:478cfd88041f 423 uint8_t tempRegValue=2*(nDbmValue+130);
group-Avnet 0:478cfd88041f 424
group-Avnet 0:478cfd88041f 425 /* Check the parameters */
group-Avnet 0:478cfd88041f 426 s_assert_param(IS_RSSI_THR_DBM(nDbmValue));
group-Avnet 0:478cfd88041f 427
group-Avnet 0:478cfd88041f 428 /* Writes the new value on the RSSI_TH register */
group-Avnet 0:478cfd88041f 429 g_xStatus = SpiritSpiWriteRegisters(RSSI_TH_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 430
group-Avnet 0:478cfd88041f 431 }
group-Avnet 0:478cfd88041f 432
group-Avnet 0:478cfd88041f 433 /**
group-Avnet 0:478cfd88041f 434 * @brief Sets the RSSI filter gain. This parameter sets the bandwidth of a low pass IIR filter (RSSI_FLT register, allowed values 0..15), a
group-Avnet 0:478cfd88041f 435 * lower values gives a faster settling of the measurements but lower precision. The recommended value for such parameter is 14.
group-Avnet 0:478cfd88041f 436 * @param xRssiFg RSSI filter gain value.
group-Avnet 0:478cfd88041f 437 * This parameter can be any value of @ref RssiFilterGain.
group-Avnet 0:478cfd88041f 438 * @retval None.
group-Avnet 0:478cfd88041f 439 */
group-Avnet 0:478cfd88041f 440 void SpiritQiSetRssiFilterGain(RssiFilterGain xRssiFg)
group-Avnet 0:478cfd88041f 441 {
group-Avnet 0:478cfd88041f 442 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 443
group-Avnet 0:478cfd88041f 444 /* Check the parameters */
group-Avnet 0:478cfd88041f 445 s_assert_param(IS_RSSI_FILTER_GAIN(xRssiFg));
group-Avnet 0:478cfd88041f 446
group-Avnet 0:478cfd88041f 447 /* Reads the RSSI_FLT register */
group-Avnet 0:478cfd88041f 448 g_xStatus = SpiritSpiReadRegisters(RSSI_FLT_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 449
group-Avnet 0:478cfd88041f 450 /* Sets the specified filter gain */
group-Avnet 0:478cfd88041f 451 tempRegValue &= 0x0F;
group-Avnet 0:478cfd88041f 452 tempRegValue |= ((uint8_t)xRssiFg);
group-Avnet 0:478cfd88041f 453
group-Avnet 0:478cfd88041f 454 /* Writes the new value on the RSSI_FLT register */
group-Avnet 0:478cfd88041f 455 g_xStatus = SpiritSpiWriteRegisters(RSSI_FLT_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 456
group-Avnet 0:478cfd88041f 457 }
group-Avnet 0:478cfd88041f 458
group-Avnet 0:478cfd88041f 459
group-Avnet 0:478cfd88041f 460 /**
group-Avnet 0:478cfd88041f 461 * @brief Returns the RSSI filter gain.
group-Avnet 0:478cfd88041f 462 * @param None.
group-Avnet 0:478cfd88041f 463 * @retval RssiFilterGain RSSI filter gain.
group-Avnet 0:478cfd88041f 464 */
group-Avnet 0:478cfd88041f 465 RssiFilterGain SpiritQiGetRssiFilterGain(void)
group-Avnet 0:478cfd88041f 466 {
group-Avnet 0:478cfd88041f 467 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 468
group-Avnet 0:478cfd88041f 469 /* Reads the RSSI_FLT register */
group-Avnet 0:478cfd88041f 470 g_xStatus = SpiritSpiReadRegisters(RSSI_FLT_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 471
group-Avnet 0:478cfd88041f 472 /* Rebuild and returns the filter gain value */
group-Avnet 0:478cfd88041f 473 return (RssiFilterGain)(tempRegValue & 0xF0);
group-Avnet 0:478cfd88041f 474
group-Avnet 0:478cfd88041f 475 }
group-Avnet 0:478cfd88041f 476
group-Avnet 0:478cfd88041f 477
group-Avnet 0:478cfd88041f 478 /**
group-Avnet 0:478cfd88041f 479 * @brief Sets the CS Mode. When static carrier sensing is used (cs_mode = 0), the carrier sense signal is asserted when the measured RSSI is above the
group-Avnet 0:478cfd88041f 480 * value specified in the RSSI_TH register and is deasserted when the RSSI falls 3 dB below the same threshold.
group-Avnet 0:478cfd88041f 481 * When dynamic carrier sense is used (cs_mode = 1, 2, 3), the carrier sense signal is asserted if the signal is above the
group-Avnet 0:478cfd88041f 482 * threshold and a fast power increase of 6, 12 or 18 dB is detected; it is deasserted if a power fall of the same amplitude is
group-Avnet 0:478cfd88041f 483 * detected.
group-Avnet 0:478cfd88041f 484 * @param xCsMode CS mode selector.
group-Avnet 0:478cfd88041f 485 * This parameter can be any value of @ref CSMode.
group-Avnet 0:478cfd88041f 486 * @retval None.
group-Avnet 0:478cfd88041f 487 */
group-Avnet 0:478cfd88041f 488 void SpiritQiSetCsMode(CSMode xCsMode)
group-Avnet 0:478cfd88041f 489 {
group-Avnet 0:478cfd88041f 490 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 491
group-Avnet 0:478cfd88041f 492 /* Check the parameters */
group-Avnet 0:478cfd88041f 493 s_assert_param(IS_CS_MODE(xCsMode));
group-Avnet 0:478cfd88041f 494
group-Avnet 0:478cfd88041f 495 /* Reads the RSSI_FLT register */
group-Avnet 0:478cfd88041f 496 g_xStatus = SpiritSpiReadRegisters(RSSI_FLT_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 497
group-Avnet 0:478cfd88041f 498 /* Sets bit to select the CS mode */
group-Avnet 0:478cfd88041f 499 tempRegValue &= ~0x0C;
group-Avnet 0:478cfd88041f 500 tempRegValue |= ((uint8_t)xCsMode);
group-Avnet 0:478cfd88041f 501
group-Avnet 0:478cfd88041f 502 /* Writes the new value on the RSSI_FLT register */
group-Avnet 0:478cfd88041f 503 g_xStatus = SpiritSpiWriteRegisters(RSSI_FLT_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 504
group-Avnet 0:478cfd88041f 505 }
group-Avnet 0:478cfd88041f 506
group-Avnet 0:478cfd88041f 507
group-Avnet 0:478cfd88041f 508 /**
group-Avnet 0:478cfd88041f 509 * @brief Returns the CS Mode.
group-Avnet 0:478cfd88041f 510 * @param None.
group-Avnet 0:478cfd88041f 511 * @retval CSMode CS mode.
group-Avnet 0:478cfd88041f 512 */
group-Avnet 0:478cfd88041f 513 CSMode SpiritQiGetCsMode(void)
group-Avnet 0:478cfd88041f 514 {
group-Avnet 0:478cfd88041f 515 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 516
group-Avnet 0:478cfd88041f 517 /* Reads the RSSI_FLT register */
group-Avnet 0:478cfd88041f 518 g_xStatus = SpiritSpiReadRegisters(RSSI_FLT_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 519
group-Avnet 0:478cfd88041f 520 /* Rebuild and returns the CS mode value */
group-Avnet 0:478cfd88041f 521 return (CSMode)(tempRegValue & 0x0C);
group-Avnet 0:478cfd88041f 522
group-Avnet 0:478cfd88041f 523 }
group-Avnet 0:478cfd88041f 524
group-Avnet 0:478cfd88041f 525 /**
group-Avnet 0:478cfd88041f 526 * @brief Enables/Disables the CS Timeout Mask. If enabled CS value contributes to timeout disabling.
group-Avnet 0:478cfd88041f 527 * @param xNewState new state for CS Timeout Mask.
group-Avnet 0:478cfd88041f 528 * This parameter can be S_ENABLE or S_DISABLE.
group-Avnet 0:478cfd88041f 529 * @retval None.
group-Avnet 0:478cfd88041f 530 */
group-Avnet 0:478cfd88041f 531 void SpiritQiCsTimeoutMask(SpiritFunctionalState xNewState)
group-Avnet 0:478cfd88041f 532 {
group-Avnet 0:478cfd88041f 533 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 534
group-Avnet 0:478cfd88041f 535 /* Check the parameters */
group-Avnet 0:478cfd88041f 536 s_assert_param(IS_SPIRIT_FUNCTIONAL_STATE(xNewState));
group-Avnet 0:478cfd88041f 537
group-Avnet 0:478cfd88041f 538 /* Reads the PROTOCOL2 register value */
group-Avnet 0:478cfd88041f 539 g_xStatus = SpiritSpiReadRegisters(PROTOCOL2_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 540
group-Avnet 0:478cfd88041f 541 /* Enables or disables the CS timeout mask */
group-Avnet 0:478cfd88041f 542 if(xNewState == S_ENABLE)
group-Avnet 0:478cfd88041f 543 {
group-Avnet 0:478cfd88041f 544 tempRegValue |= PROTOCOL2_CS_TIMEOUT_MASK;
group-Avnet 0:478cfd88041f 545 }
group-Avnet 0:478cfd88041f 546 else
group-Avnet 0:478cfd88041f 547 {
group-Avnet 0:478cfd88041f 548 tempRegValue &= ~PROTOCOL2_CS_TIMEOUT_MASK;
group-Avnet 0:478cfd88041f 549 }
group-Avnet 0:478cfd88041f 550
group-Avnet 0:478cfd88041f 551 /* Writes the new value on the PROTOCOL2 register */
group-Avnet 0:478cfd88041f 552 g_xStatus = SpiritSpiWriteRegisters(PROTOCOL2_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 553
group-Avnet 0:478cfd88041f 554 }
group-Avnet 0:478cfd88041f 555
group-Avnet 0:478cfd88041f 556
group-Avnet 0:478cfd88041f 557 /**
group-Avnet 0:478cfd88041f 558 * @brief Enables/Disables the PQI Timeout Mask. If enabled PQI value contributes to timeout disabling.
group-Avnet 0:478cfd88041f 559 * @param xNewState new state for PQI Timeout Mask.
group-Avnet 0:478cfd88041f 560 * This parameter can be S_ENABLE or S_DISABLE.
group-Avnet 0:478cfd88041f 561 * @retval None.
group-Avnet 0:478cfd88041f 562 */
group-Avnet 0:478cfd88041f 563 void SpiritQiPqiTimeoutMask(SpiritFunctionalState xNewState)
group-Avnet 0:478cfd88041f 564 {
group-Avnet 0:478cfd88041f 565 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 566
group-Avnet 0:478cfd88041f 567 /* Check the parameters */
group-Avnet 0:478cfd88041f 568 s_assert_param(IS_SPIRIT_FUNCTIONAL_STATE(xNewState));
group-Avnet 0:478cfd88041f 569
group-Avnet 0:478cfd88041f 570 /* Reads the PROTOCOL2 register */
group-Avnet 0:478cfd88041f 571 g_xStatus = SpiritSpiReadRegisters(PROTOCOL2_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 572
group-Avnet 0:478cfd88041f 573 /* Enables or disables the PQI timeout mask */
group-Avnet 0:478cfd88041f 574 if(xNewState == S_ENABLE)
group-Avnet 0:478cfd88041f 575 {
group-Avnet 0:478cfd88041f 576 tempRegValue |= PROTOCOL2_PQI_TIMEOUT_MASK;
group-Avnet 0:478cfd88041f 577 }
group-Avnet 0:478cfd88041f 578 else
group-Avnet 0:478cfd88041f 579 {
group-Avnet 0:478cfd88041f 580 tempRegValue &= ~PROTOCOL2_PQI_TIMEOUT_MASK;
group-Avnet 0:478cfd88041f 581 }
group-Avnet 0:478cfd88041f 582
group-Avnet 0:478cfd88041f 583 /* Writes the new value on the PROTOCOL2 register */
group-Avnet 0:478cfd88041f 584 g_xStatus = SpiritSpiWriteRegisters(PROTOCOL2_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 585
group-Avnet 0:478cfd88041f 586 }
group-Avnet 0:478cfd88041f 587
group-Avnet 0:478cfd88041f 588
group-Avnet 0:478cfd88041f 589 /**
group-Avnet 0:478cfd88041f 590 * @brief Enables/Disables the SQI Timeout Mask. If enabled SQI value contributes to timeout disabling.
group-Avnet 0:478cfd88041f 591 * @param xNewState new state for SQI Timeout Mask.
group-Avnet 0:478cfd88041f 592 * This parameter can be S_ENABLE or S_DISABLE.
group-Avnet 0:478cfd88041f 593 * @retval None.
group-Avnet 0:478cfd88041f 594 */
group-Avnet 0:478cfd88041f 595 void SpiritQiSqiTimeoutMask(SpiritFunctionalState xNewState)
group-Avnet 0:478cfd88041f 596 {
group-Avnet 0:478cfd88041f 597 uint8_t tempRegValue;
group-Avnet 0:478cfd88041f 598
group-Avnet 0:478cfd88041f 599 /* Check the parameters */
group-Avnet 0:478cfd88041f 600 s_assert_param(IS_SPIRIT_FUNCTIONAL_STATE(xNewState));
group-Avnet 0:478cfd88041f 601
group-Avnet 0:478cfd88041f 602 /* Reads the PROTOCOL2 register */
group-Avnet 0:478cfd88041f 603 g_xStatus = SpiritSpiReadRegisters(PROTOCOL2_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 604
group-Avnet 0:478cfd88041f 605 /* Enables or disables the SQI timeout mask */
group-Avnet 0:478cfd88041f 606 if(xNewState == S_ENABLE)
group-Avnet 0:478cfd88041f 607 {
group-Avnet 0:478cfd88041f 608 tempRegValue |= PROTOCOL2_SQI_TIMEOUT_MASK;
group-Avnet 0:478cfd88041f 609 }
group-Avnet 0:478cfd88041f 610 else
group-Avnet 0:478cfd88041f 611 {
group-Avnet 0:478cfd88041f 612 tempRegValue &= ~PROTOCOL2_SQI_TIMEOUT_MASK;
group-Avnet 0:478cfd88041f 613 }
group-Avnet 0:478cfd88041f 614
group-Avnet 0:478cfd88041f 615 /* Writes the new value on the PROTOCOL2 register */
group-Avnet 0:478cfd88041f 616 g_xStatus = SpiritSpiWriteRegisters(PROTOCOL2_BASE, 1, &tempRegValue);
group-Avnet 0:478cfd88041f 617
group-Avnet 0:478cfd88041f 618 }
group-Avnet 0:478cfd88041f 619
group-Avnet 0:478cfd88041f 620
group-Avnet 0:478cfd88041f 621 /**
group-Avnet 0:478cfd88041f 622 *@}
group-Avnet 0:478cfd88041f 623 */
group-Avnet 0:478cfd88041f 624
group-Avnet 0:478cfd88041f 625 /**
group-Avnet 0:478cfd88041f 626 *@}
group-Avnet 0:478cfd88041f 627 */
group-Avnet 0:478cfd88041f 628
group-Avnet 0:478cfd88041f 629
group-Avnet 0:478cfd88041f 630 /**
group-Avnet 0:478cfd88041f 631 *@}
group-Avnet 0:478cfd88041f 632 */
group-Avnet 0:478cfd88041f 633
group-Avnet 0:478cfd88041f 634
group-Avnet 0:478cfd88041f 635
group-Avnet 0:478cfd88041f 636 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/