wifi test

Dependencies:   X_NUCLEO_IKS01A2 mbed-http

Committer:
JMF
Date:
Wed Sep 05 14:28:24 2018 +0000
Revision:
0:24d3eb812fd4
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 0:24d3eb812fd4 1 /**
JMF 0:24d3eb812fd4 2 ******************************************************************************
JMF 0:24d3eb812fd4 3 * @file SPIRIT_Types.h
JMF 0:24d3eb812fd4 4 * @author VMA division - AMS
JMF 0:24d3eb812fd4 5 * @version 3.2.2
JMF 0:24d3eb812fd4 6 * @date 08-July-2015
JMF 0:24d3eb812fd4 7 * @brief Header file for SPIRIT types.
JMF 0:24d3eb812fd4 8 * @details
JMF 0:24d3eb812fd4 9 *
JMF 0:24d3eb812fd4 10 * This module provide some types definitions which will be used in
JMF 0:24d3eb812fd4 11 * all the modules of this library. Here is defined also the global
JMF 0:24d3eb812fd4 12 * variable @ref g_xStatus which contains the status of Spirit and
JMF 0:24d3eb812fd4 13 * is updated every time an SPI transaction occurs.
JMF 0:24d3eb812fd4 14 *
JMF 0:24d3eb812fd4 15 * @attention
JMF 0:24d3eb812fd4 16 *
JMF 0:24d3eb812fd4 17 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
JMF 0:24d3eb812fd4 18 *
JMF 0:24d3eb812fd4 19 * Redistribution and use in source and binary forms, with or without modification,
JMF 0:24d3eb812fd4 20 * are permitted provided that the following conditions are met:
JMF 0:24d3eb812fd4 21 * 1. Redistributions of source code must retain the above copyright notice,
JMF 0:24d3eb812fd4 22 * this list of conditions and the following disclaimer.
JMF 0:24d3eb812fd4 23 * 2. Redistributions in binary form must reproduce the above copyright notice,
JMF 0:24d3eb812fd4 24 * this list of conditions and the following disclaimer in the documentation
JMF 0:24d3eb812fd4 25 * and/or other materials provided with the distribution.
JMF 0:24d3eb812fd4 26 * 3. Neither the name of STMicroelectronics nor the names of its contributors
JMF 0:24d3eb812fd4 27 * may be used to endorse or promote products derived from this software
JMF 0:24d3eb812fd4 28 * without specific prior written permission.
JMF 0:24d3eb812fd4 29 *
JMF 0:24d3eb812fd4 30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
JMF 0:24d3eb812fd4 31 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
JMF 0:24d3eb812fd4 32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
JMF 0:24d3eb812fd4 33 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
JMF 0:24d3eb812fd4 34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
JMF 0:24d3eb812fd4 35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
JMF 0:24d3eb812fd4 36 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
JMF 0:24d3eb812fd4 37 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
JMF 0:24d3eb812fd4 38 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
JMF 0:24d3eb812fd4 39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
JMF 0:24d3eb812fd4 40 *
JMF 0:24d3eb812fd4 41 ******************************************************************************
JMF 0:24d3eb812fd4 42 */
JMF 0:24d3eb812fd4 43
JMF 0:24d3eb812fd4 44 /* Define to prevent recursive inclusion -------------------------------------*/
JMF 0:24d3eb812fd4 45 #ifndef __SPIRIT_GENERICTYPES_H
JMF 0:24d3eb812fd4 46 #define __SPIRIT_GENERICTYPES_H
JMF 0:24d3eb812fd4 47
JMF 0:24d3eb812fd4 48
JMF 0:24d3eb812fd4 49 /* Includes ------------------------------------------------------------------*/
JMF 0:24d3eb812fd4 50
JMF 0:24d3eb812fd4 51 /* Include all integer types definitions */
JMF 0:24d3eb812fd4 52 #include <stdint.h>
JMF 0:24d3eb812fd4 53 #include <stdio.h>
JMF 0:24d3eb812fd4 54 #include "SPIRIT_Regs.h"
JMF 0:24d3eb812fd4 55
JMF 0:24d3eb812fd4 56
JMF 0:24d3eb812fd4 57
JMF 0:24d3eb812fd4 58 #ifdef __cplusplus
JMF 0:24d3eb812fd4 59 extern "C" {
JMF 0:24d3eb812fd4 60 #endif
JMF 0:24d3eb812fd4 61
JMF 0:24d3eb812fd4 62
JMF 0:24d3eb812fd4 63 /**
JMF 0:24d3eb812fd4 64 * @addtogroup SPIRIT_Libraries
JMF 0:24d3eb812fd4 65 * @{
JMF 0:24d3eb812fd4 66 */
JMF 0:24d3eb812fd4 67
JMF 0:24d3eb812fd4 68
JMF 0:24d3eb812fd4 69 /**
JMF 0:24d3eb812fd4 70 * @defgroup SPIRIT_Types Types
JMF 0:24d3eb812fd4 71 * @brief Module for SPIRIT types definition.
JMF 0:24d3eb812fd4 72 * * @details See the file <i>@ref SPIRIT_Types.h</i> for more details.
JMF 0:24d3eb812fd4 73 * @{
JMF 0:24d3eb812fd4 74 */
JMF 0:24d3eb812fd4 75
JMF 0:24d3eb812fd4 76 /**
JMF 0:24d3eb812fd4 77 * @defgroup Types_Exported_Types Types Exported Types
JMF 0:24d3eb812fd4 78 * @{
JMF 0:24d3eb812fd4 79 */
JMF 0:24d3eb812fd4 80
JMF 0:24d3eb812fd4 81 /**
JMF 0:24d3eb812fd4 82 * @brief Spirit Functional state. Used to enable or disable a specific option.
JMF 0:24d3eb812fd4 83 */
JMF 0:24d3eb812fd4 84 typedef enum
JMF 0:24d3eb812fd4 85 {
JMF 0:24d3eb812fd4 86 S_DISABLE = 0,
JMF 0:24d3eb812fd4 87 S_ENABLE = !S_DISABLE
JMF 0:24d3eb812fd4 88
JMF 0:24d3eb812fd4 89 } SpiritFunctionalState;
JMF 0:24d3eb812fd4 90
JMF 0:24d3eb812fd4 91 #define IS_SPIRIT_FUNCTIONAL_STATE(STATE) (STATE == S_DISABLE || STATE == S_ENABLE)
JMF 0:24d3eb812fd4 92
JMF 0:24d3eb812fd4 93 /**
JMF 0:24d3eb812fd4 94 * @brief Spirit Flag status. Used to control the state of a flag.
JMF 0:24d3eb812fd4 95 */
JMF 0:24d3eb812fd4 96 typedef enum
JMF 0:24d3eb812fd4 97 {
JMF 0:24d3eb812fd4 98 S_RESET = 0,
JMF 0:24d3eb812fd4 99 S_SET = !S_RESET
JMF 0:24d3eb812fd4 100
JMF 0:24d3eb812fd4 101 } SpiritFlagStatus;
JMF 0:24d3eb812fd4 102
JMF 0:24d3eb812fd4 103 #define IS_SPIRIT_FLAG_STATUS(STATUS) (STATUS == S_RESET || STATUS == S_SET)
JMF 0:24d3eb812fd4 104
JMF 0:24d3eb812fd4 105
JMF 0:24d3eb812fd4 106 /**
JMF 0:24d3eb812fd4 107 * @brief boolean type enumeration.
JMF 0:24d3eb812fd4 108 */
JMF 0:24d3eb812fd4 109 typedef enum
JMF 0:24d3eb812fd4 110 {
JMF 0:24d3eb812fd4 111 S_FALSE = 0,
JMF 0:24d3eb812fd4 112 S_TRUE = !S_FALSE
JMF 0:24d3eb812fd4 113
JMF 0:24d3eb812fd4 114 } SpiritBool;
JMF 0:24d3eb812fd4 115
JMF 0:24d3eb812fd4 116
JMF 0:24d3eb812fd4 117 /**
JMF 0:24d3eb812fd4 118 * @brief SPIRIT States enumeration.
JMF 0:24d3eb812fd4 119 */
JMF 0:24d3eb812fd4 120 typedef enum
JMF 0:24d3eb812fd4 121 {
JMF 0:24d3eb812fd4 122 MC_STATE_STANDBY =0x40, /*!< STANDBY */
JMF 0:24d3eb812fd4 123 MC_STATE_SLEEP =0x36, /*!< SLEEP */
JMF 0:24d3eb812fd4 124 MC_STATE_READY =0x03, /*!< READY */
JMF 0:24d3eb812fd4 125 MC_STATE_PM_SETUP =0x3D, /*!< PM_SETUP */
JMF 0:24d3eb812fd4 126 MC_STATE_XO_SETTLING =0x23, /*!< XO_SETTLING */
JMF 0:24d3eb812fd4 127 MC_STATE_SYNTH_SETUP =0x53, /*!< SYNT_SETUP */
JMF 0:24d3eb812fd4 128 MC_STATE_PROTOCOL =0x1F, /*!< PROTOCOL */
JMF 0:24d3eb812fd4 129 MC_STATE_SYNTH_CALIBRATION =0x4F, /*!< SYNTH */
JMF 0:24d3eb812fd4 130 MC_STATE_LOCK =0x0F, /*!< LOCK */
JMF 0:24d3eb812fd4 131 MC_STATE_RX =0x33, /*!< RX */
JMF 0:24d3eb812fd4 132 MC_STATE_TX =0x5F /*!< TX */
JMF 0:24d3eb812fd4 133
JMF 0:24d3eb812fd4 134 } SpiritState;
JMF 0:24d3eb812fd4 135
JMF 0:24d3eb812fd4 136
JMF 0:24d3eb812fd4 137
JMF 0:24d3eb812fd4 138 /**
JMF 0:24d3eb812fd4 139 * @brief SPIRIT Status. This definition represents the single field of the SPIRIT
JMF 0:24d3eb812fd4 140 * status returned on each SPI transaction, equal also to the MC_STATE registers.
JMF 0:24d3eb812fd4 141 * This field-oriented structure allows user to address in simple way the single
JMF 0:24d3eb812fd4 142 * field of the SPIRIT status.
JMF 0:24d3eb812fd4 143 * The user shall define a variable of SpiritStatus type to access on SPIRIT status fields.
JMF 0:24d3eb812fd4 144 * @note The fields order in the structure depends on used endianness (little or big
JMF 0:24d3eb812fd4 145 * endian). The actual definition is valid ONLY for LITTLE ENDIAN mode. Be sure to
JMF 0:24d3eb812fd4 146 * change opportunely the fields order when use a different endianness.
JMF 0:24d3eb812fd4 147 */
JMF 0:24d3eb812fd4 148
JMF 0:24d3eb812fd4 149 typedef struct
JMF 0:24d3eb812fd4 150 {
JMF 0:24d3eb812fd4 151 uint8_t XO_ON:1; /*!< This one bit field notifies if XO is operating
JMF 0:24d3eb812fd4 152 (XO_ON is 1) or not (XO_On is 0) */
JMF 0:24d3eb812fd4 153 SpiritState MC_STATE: 7; /*!< This 7 bits field indicates the state of the
JMF 0:24d3eb812fd4 154 Main Controller of SPIRIT. The possible states
JMF 0:24d3eb812fd4 155 and their corresponding values are defined in
JMF 0:24d3eb812fd4 156 @ref SpiritState */
JMF 0:24d3eb812fd4 157 uint8_t ERROR_LOCK: 1; /*!< This one bit field notifies if there is an
JMF 0:24d3eb812fd4 158 error on RCO calibration (ERROR_LOCK is 1) or
JMF 0:24d3eb812fd4 159 not (ERROR_LOCK is 0) */
JMF 0:24d3eb812fd4 160 uint8_t RX_FIFO_EMPTY: 1; /*!< This one bit field notifies if RX FIFO is empty
JMF 0:24d3eb812fd4 161 (RX_FIFO_EMPTY is 1) or not (RX_FIFO_EMPTY is 0) */
JMF 0:24d3eb812fd4 162 uint8_t TX_FIFO_FULL: 1; /*!< This one bit field notifies if TX FIFO is full
JMF 0:24d3eb812fd4 163 (TX_FIFO_FULL is 1) or not (TX_FIFO_FULL is 0) */
JMF 0:24d3eb812fd4 164 uint8_t ANT_SELECT: 1; /*!< This one bit field notifies the currently selected
JMF 0:24d3eb812fd4 165 antenna */
JMF 0:24d3eb812fd4 166 uint8_t : 4; /*!< This 4 bits field are reserved and equal to 5 */
JMF 0:24d3eb812fd4 167
JMF 0:24d3eb812fd4 168 }SpiritStatus;
JMF 0:24d3eb812fd4 169
JMF 0:24d3eb812fd4 170
JMF 0:24d3eb812fd4 171
JMF 0:24d3eb812fd4 172 /**
JMF 0:24d3eb812fd4 173 * @}
JMF 0:24d3eb812fd4 174 */
JMF 0:24d3eb812fd4 175
JMF 0:24d3eb812fd4 176
JMF 0:24d3eb812fd4 177 /**
JMF 0:24d3eb812fd4 178 * @defgroup Types_Exported_Constants Types Exported Constants
JMF 0:24d3eb812fd4 179 * @{
JMF 0:24d3eb812fd4 180 */
JMF 0:24d3eb812fd4 181
JMF 0:24d3eb812fd4 182
JMF 0:24d3eb812fd4 183 /**
JMF 0:24d3eb812fd4 184 * @}
JMF 0:24d3eb812fd4 185 */
JMF 0:24d3eb812fd4 186
JMF 0:24d3eb812fd4 187 /**
JMF 0:24d3eb812fd4 188 * @defgroup Types_Exported_Variables Types Exported Variables
JMF 0:24d3eb812fd4 189 * @{
JMF 0:24d3eb812fd4 190 */
JMF 0:24d3eb812fd4 191
JMF 0:24d3eb812fd4 192 extern volatile SpiritStatus g_xStatus;
JMF 0:24d3eb812fd4 193
JMF 0:24d3eb812fd4 194 /**
JMF 0:24d3eb812fd4 195 * @}
JMF 0:24d3eb812fd4 196 */
JMF 0:24d3eb812fd4 197
JMF 0:24d3eb812fd4 198 /**
JMF 0:24d3eb812fd4 199 * @defgroup Types_Exported_Macros Types Exported Macros
JMF 0:24d3eb812fd4 200 * @{
JMF 0:24d3eb812fd4 201 */
JMF 0:24d3eb812fd4 202
JMF 0:24d3eb812fd4 203 #ifdef SPIRIT_USE_FULL_ASSERT
JMF 0:24d3eb812fd4 204 /**
JMF 0:24d3eb812fd4 205 * @brief The s_assert_param macro is used for function's parameters check.
JMF 0:24d3eb812fd4 206 * @param expr If expr is false, it calls assert_failed function which reports
JMF 0:24d3eb812fd4 207 * the name of the source file and the source line number of the call
JMF 0:24d3eb812fd4 208 * that failed. If expr is true, it returns no value.
JMF 0:24d3eb812fd4 209 * @retval None
JMF 0:24d3eb812fd4 210 */
JMF 0:24d3eb812fd4 211 #define s_assert_param(expr) ((expr) ? (void)0 : s_assert_failed((uint8_t *)__FILE__, __LINE__))
JMF 0:24d3eb812fd4 212 void s_assert_failed(uint8_t* file, uint32_t line);
JMF 0:24d3eb812fd4 213 #elif SPIRIT_USE_VCOM_ASSERT
JMF 0:24d3eb812fd4 214 /**
JMF 0:24d3eb812fd4 215 * @brief The s_assert_param macro is used for function's parameters check.
JMF 0:24d3eb812fd4 216 * @param expr If expr is false, it calls assert_failed function which reports
JMF 0:24d3eb812fd4 217 * the name of the source file and the source line number of the call
JMF 0:24d3eb812fd4 218 * that failed. If expr is true, it returns no value.
JMF 0:24d3eb812fd4 219 * @retval None
JMF 0:24d3eb812fd4 220 */
JMF 0:24d3eb812fd4 221 #define s_assert_param(expr) ((expr) ? (void)0 : s_assert_failed((uint8_t *)__FILE__, __LINE__,#expr))
JMF 0:24d3eb812fd4 222 void s_assert_failed(uint8_t* file, uint32_t line, char* expression);
JMF 0:24d3eb812fd4 223
JMF 0:24d3eb812fd4 224 #elif SPIRIT_USE_FRAME_ASSERT
JMF 0:24d3eb812fd4 225 /**
JMF 0:24d3eb812fd4 226 * @brief The s_assert_param macro is used for function's parameters check.
JMF 0:24d3eb812fd4 227 * @param expr If expr is false, it calls assert_failed function which reports
JMF 0:24d3eb812fd4 228 * the name of the source file and the source line number of the call
JMF 0:24d3eb812fd4 229 * that failed. If expr is true, it returns no value.
JMF 0:24d3eb812fd4 230 * @retval None
JMF 0:24d3eb812fd4 231 */
JMF 0:24d3eb812fd4 232 #define s_assert_param(expr) ((expr) ? (void)0 : s_assert_failed(#expr))
JMF 0:24d3eb812fd4 233 void s_assert_failed(char* expression);
JMF 0:24d3eb812fd4 234 #else
JMF 0:24d3eb812fd4 235 #define s_assert_param(expr) {}
JMF 0:24d3eb812fd4 236 #endif
JMF 0:24d3eb812fd4 237
JMF 0:24d3eb812fd4 238 /**
JMF 0:24d3eb812fd4 239 * @brief Returns the absolute value.
JMF 0:24d3eb812fd4 240 */
JMF 0:24d3eb812fd4 241 #define S_ABS(a) ((a)>0?(a):-(a))
JMF 0:24d3eb812fd4 242
JMF 0:24d3eb812fd4 243
JMF 0:24d3eb812fd4 244 /**
JMF 0:24d3eb812fd4 245 * @}
JMF 0:24d3eb812fd4 246 */
JMF 0:24d3eb812fd4 247
JMF 0:24d3eb812fd4 248
JMF 0:24d3eb812fd4 249 /**
JMF 0:24d3eb812fd4 250 * @defgroup Types_Exported_Functions Types Exported Functions
JMF 0:24d3eb812fd4 251 * @{
JMF 0:24d3eb812fd4 252 */
JMF 0:24d3eb812fd4 253
JMF 0:24d3eb812fd4 254 void SpiritRefreshStatus(void);
JMF 0:24d3eb812fd4 255
JMF 0:24d3eb812fd4 256 /**
JMF 0:24d3eb812fd4 257 *@}
JMF 0:24d3eb812fd4 258 */
JMF 0:24d3eb812fd4 259
JMF 0:24d3eb812fd4 260 /**
JMF 0:24d3eb812fd4 261 * @}
JMF 0:24d3eb812fd4 262 */
JMF 0:24d3eb812fd4 263
JMF 0:24d3eb812fd4 264
JMF 0:24d3eb812fd4 265 /**
JMF 0:24d3eb812fd4 266 * @}
JMF 0:24d3eb812fd4 267 */
JMF 0:24d3eb812fd4 268
JMF 0:24d3eb812fd4 269
JMF 0:24d3eb812fd4 270 #ifdef __cplusplus
JMF 0:24d3eb812fd4 271 }
JMF 0:24d3eb812fd4 272 #endif
JMF 0:24d3eb812fd4 273
JMF 0:24d3eb812fd4 274 #endif
JMF 0:24d3eb812fd4 275
JMF 0:24d3eb812fd4 276 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/