wifi test
Dependencies: X_NUCLEO_IKS01A2 mbed-http
easy-connect/stm-spirit1-rf-driver/source/libs/spirit1/SPIRIT1_Library/Src/SPIRIT_Types.c@0:24d3eb812fd4, 2018-09-05 (annotated)
- Committer:
- JMF
- Date:
- Wed Sep 05 14:28:24 2018 +0000
- Revision:
- 0:24d3eb812fd4
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JMF | 0:24d3eb812fd4 | 1 | /** |
| JMF | 0:24d3eb812fd4 | 2 | ****************************************************************************** |
| JMF | 0:24d3eb812fd4 | 3 | * @file SPIRIT_Types.c |
| 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 File for SPIRIT types. |
| JMF | 0:24d3eb812fd4 | 8 | * @details |
| JMF | 0:24d3eb812fd4 | 9 | * |
| JMF | 0:24d3eb812fd4 | 10 | * @attention |
| JMF | 0:24d3eb812fd4 | 11 | * |
| JMF | 0:24d3eb812fd4 | 12 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
| JMF | 0:24d3eb812fd4 | 13 | * |
| JMF | 0:24d3eb812fd4 | 14 | * Redistribution and use in source and binary forms, with or without modification, |
| JMF | 0:24d3eb812fd4 | 15 | * are permitted provided that the following conditions are met: |
| JMF | 0:24d3eb812fd4 | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
| JMF | 0:24d3eb812fd4 | 17 | * this list of conditions and the following disclaimer. |
| JMF | 0:24d3eb812fd4 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| JMF | 0:24d3eb812fd4 | 19 | * this list of conditions and the following disclaimer in the documentation |
| JMF | 0:24d3eb812fd4 | 20 | * and/or other materials provided with the distribution. |
| JMF | 0:24d3eb812fd4 | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| JMF | 0:24d3eb812fd4 | 22 | * may be used to endorse or promote products derived from this software |
| JMF | 0:24d3eb812fd4 | 23 | * without specific prior written permission. |
| JMF | 0:24d3eb812fd4 | 24 | * |
| JMF | 0:24d3eb812fd4 | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| JMF | 0:24d3eb812fd4 | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| JMF | 0:24d3eb812fd4 | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| JMF | 0:24d3eb812fd4 | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| JMF | 0:24d3eb812fd4 | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| JMF | 0:24d3eb812fd4 | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| JMF | 0:24d3eb812fd4 | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| JMF | 0:24d3eb812fd4 | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| JMF | 0:24d3eb812fd4 | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| JMF | 0:24d3eb812fd4 | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| JMF | 0:24d3eb812fd4 | 35 | * |
| JMF | 0:24d3eb812fd4 | 36 | ****************************************************************************** |
| JMF | 0:24d3eb812fd4 | 37 | */ |
| JMF | 0:24d3eb812fd4 | 38 | |
| JMF | 0:24d3eb812fd4 | 39 | /* Includes ------------------------------------------------------------------*/ |
| JMF | 0:24d3eb812fd4 | 40 | #include "SPIRIT_Types.h" |
| JMF | 0:24d3eb812fd4 | 41 | #include "MCU_Interface.h" |
| JMF | 0:24d3eb812fd4 | 42 | |
| JMF | 0:24d3eb812fd4 | 43 | |
| JMF | 0:24d3eb812fd4 | 44 | /** @addtogroup SPIRIT_Libraries |
| JMF | 0:24d3eb812fd4 | 45 | * @{ |
| JMF | 0:24d3eb812fd4 | 46 | */ |
| JMF | 0:24d3eb812fd4 | 47 | |
| JMF | 0:24d3eb812fd4 | 48 | |
| JMF | 0:24d3eb812fd4 | 49 | /** @addtogroup SPIRIT_Types |
| JMF | 0:24d3eb812fd4 | 50 | * @{ |
| JMF | 0:24d3eb812fd4 | 51 | */ |
| JMF | 0:24d3eb812fd4 | 52 | |
| JMF | 0:24d3eb812fd4 | 53 | |
| JMF | 0:24d3eb812fd4 | 54 | /** @defgroup Types_Private_TypesDefinitions Types Private Types Definitions |
| JMF | 0:24d3eb812fd4 | 55 | * @{ |
| JMF | 0:24d3eb812fd4 | 56 | */ |
| JMF | 0:24d3eb812fd4 | 57 | |
| JMF | 0:24d3eb812fd4 | 58 | |
| JMF | 0:24d3eb812fd4 | 59 | /** |
| JMF | 0:24d3eb812fd4 | 60 | * @} |
| JMF | 0:24d3eb812fd4 | 61 | */ |
| JMF | 0:24d3eb812fd4 | 62 | |
| JMF | 0:24d3eb812fd4 | 63 | |
| JMF | 0:24d3eb812fd4 | 64 | |
| JMF | 0:24d3eb812fd4 | 65 | /** @defgroup Types_Private_Defines Types Private Defines |
| JMF | 0:24d3eb812fd4 | 66 | * @{ |
| JMF | 0:24d3eb812fd4 | 67 | */ |
| JMF | 0:24d3eb812fd4 | 68 | |
| JMF | 0:24d3eb812fd4 | 69 | |
| JMF | 0:24d3eb812fd4 | 70 | /** |
| JMF | 0:24d3eb812fd4 | 71 | * @} |
| JMF | 0:24d3eb812fd4 | 72 | */ |
| JMF | 0:24d3eb812fd4 | 73 | |
| JMF | 0:24d3eb812fd4 | 74 | |
| JMF | 0:24d3eb812fd4 | 75 | |
| JMF | 0:24d3eb812fd4 | 76 | /** @defgroup Types_Private_Macros Types Private Macros |
| JMF | 0:24d3eb812fd4 | 77 | * @{ |
| JMF | 0:24d3eb812fd4 | 78 | */ |
| JMF | 0:24d3eb812fd4 | 79 | |
| JMF | 0:24d3eb812fd4 | 80 | |
| JMF | 0:24d3eb812fd4 | 81 | /** |
| JMF | 0:24d3eb812fd4 | 82 | * @} |
| JMF | 0:24d3eb812fd4 | 83 | */ |
| JMF | 0:24d3eb812fd4 | 84 | |
| JMF | 0:24d3eb812fd4 | 85 | |
| JMF | 0:24d3eb812fd4 | 86 | |
| JMF | 0:24d3eb812fd4 | 87 | /** @defgroup Types_Private_Variables Types Private Variables |
| JMF | 0:24d3eb812fd4 | 88 | * @{ |
| JMF | 0:24d3eb812fd4 | 89 | */ |
| JMF | 0:24d3eb812fd4 | 90 | |
| JMF | 0:24d3eb812fd4 | 91 | /** |
| JMF | 0:24d3eb812fd4 | 92 | * @brief Spirit Status global variable. |
| JMF | 0:24d3eb812fd4 | 93 | * This global variable of @ref SpiritStatus type is updated on every SPI transaction |
| JMF | 0:24d3eb812fd4 | 94 | * to maintain memory of Spirit Status. |
| JMF | 0:24d3eb812fd4 | 95 | */ |
| JMF | 0:24d3eb812fd4 | 96 | |
| JMF | 0:24d3eb812fd4 | 97 | volatile SpiritStatus g_xStatus; |
| JMF | 0:24d3eb812fd4 | 98 | |
| JMF | 0:24d3eb812fd4 | 99 | /** |
| JMF | 0:24d3eb812fd4 | 100 | * @} |
| JMF | 0:24d3eb812fd4 | 101 | */ |
| JMF | 0:24d3eb812fd4 | 102 | |
| JMF | 0:24d3eb812fd4 | 103 | |
| JMF | 0:24d3eb812fd4 | 104 | |
| JMF | 0:24d3eb812fd4 | 105 | /** @defgroup Types_Private_FunctionPrototypes Types Private FunctionPrototypes |
| JMF | 0:24d3eb812fd4 | 106 | * @{ |
| JMF | 0:24d3eb812fd4 | 107 | */ |
| JMF | 0:24d3eb812fd4 | 108 | |
| JMF | 0:24d3eb812fd4 | 109 | |
| JMF | 0:24d3eb812fd4 | 110 | |
| JMF | 0:24d3eb812fd4 | 111 | /** |
| JMF | 0:24d3eb812fd4 | 112 | * @} |
| JMF | 0:24d3eb812fd4 | 113 | */ |
| JMF | 0:24d3eb812fd4 | 114 | |
| JMF | 0:24d3eb812fd4 | 115 | |
| JMF | 0:24d3eb812fd4 | 116 | |
| JMF | 0:24d3eb812fd4 | 117 | /** @defgroup Types_Private_Functions Types Private Functions |
| JMF | 0:24d3eb812fd4 | 118 | * @{ |
| JMF | 0:24d3eb812fd4 | 119 | */ |
| JMF | 0:24d3eb812fd4 | 120 | |
| JMF | 0:24d3eb812fd4 | 121 | #ifdef SPIRIT_USE_FULL_ASSERT |
| JMF | 0:24d3eb812fd4 | 122 | /** |
| JMF | 0:24d3eb812fd4 | 123 | * @brief Reports the name of the source file and the source line number |
| JMF | 0:24d3eb812fd4 | 124 | * where the assert_param error has occurred. |
| JMF | 0:24d3eb812fd4 | 125 | * @param file pointer to the source file name |
| JMF | 0:24d3eb812fd4 | 126 | * @param line assert_param error line source number |
| JMF | 0:24d3eb812fd4 | 127 | * @retval : None |
| JMF | 0:24d3eb812fd4 | 128 | */ |
| JMF | 0:24d3eb812fd4 | 129 | void s_assert_failed(uint8_t* file, uint32_t line) |
| JMF | 0:24d3eb812fd4 | 130 | { |
| JMF | 0:24d3eb812fd4 | 131 | /* User can add his own implementation to report the file name and line number */ |
| JMF | 0:24d3eb812fd4 | 132 | printf("Wrong parameters value: file %s on line %d\r\n", file, (int)line); |
| JMF | 0:24d3eb812fd4 | 133 | |
| JMF | 0:24d3eb812fd4 | 134 | /* Infinite loop */ |
| JMF | 0:24d3eb812fd4 | 135 | while (1) |
| JMF | 0:24d3eb812fd4 | 136 | { |
| JMF | 0:24d3eb812fd4 | 137 | } |
| JMF | 0:24d3eb812fd4 | 138 | } |
| JMF | 0:24d3eb812fd4 | 139 | #elif SPIRIT_USE_VCOM_ASSERT |
| JMF | 0:24d3eb812fd4 | 140 | |
| JMF | 0:24d3eb812fd4 | 141 | #include "SDK_EVAL_VC_General.h" |
| JMF | 0:24d3eb812fd4 | 142 | |
| JMF | 0:24d3eb812fd4 | 143 | /** |
| JMF | 0:24d3eb812fd4 | 144 | * @brief Reports the name of the source file and the source line number |
| JMF | 0:24d3eb812fd4 | 145 | * where the assert_param error has occurred. |
| JMF | 0:24d3eb812fd4 | 146 | * @param file pointer to the source file name |
| JMF | 0:24d3eb812fd4 | 147 | * @param line assert_param error line source number |
| JMF | 0:24d3eb812fd4 | 148 | * @param expression: string representing the assert failed expression |
| JMF | 0:24d3eb812fd4 | 149 | * @retval : None |
| JMF | 0:24d3eb812fd4 | 150 | */ |
| JMF | 0:24d3eb812fd4 | 151 | void s_assert_failed(uint8_t* file, uint32_t line, char* expression) |
| JMF | 0:24d3eb812fd4 | 152 | { |
| JMF | 0:24d3eb812fd4 | 153 | |
| JMF | 0:24d3eb812fd4 | 154 | printf("\n\rVCOM DEBUG: Incorrect parameter. Please reboot.\n\r"); |
| JMF | 0:24d3eb812fd4 | 155 | printf("%s:%d \n\r",file,line); |
| JMF | 0:24d3eb812fd4 | 156 | printf("The expression %s returned FALSE.\n\r", expression); |
| JMF | 0:24d3eb812fd4 | 157 | |
| JMF | 0:24d3eb812fd4 | 158 | /* Infinite loop */ |
| JMF | 0:24d3eb812fd4 | 159 | while (1) |
| JMF | 0:24d3eb812fd4 | 160 | { |
| JMF | 0:24d3eb812fd4 | 161 | } |
| JMF | 0:24d3eb812fd4 | 162 | } |
| JMF | 0:24d3eb812fd4 | 163 | |
| JMF | 0:24d3eb812fd4 | 164 | #elif SPIRIT_USE_FRAME_ASSERT |
| JMF | 0:24d3eb812fd4 | 165 | |
| JMF | 0:24d3eb812fd4 | 166 | #include "SdkUsbProtocol.h" |
| JMF | 0:24d3eb812fd4 | 167 | |
| JMF | 0:24d3eb812fd4 | 168 | /** |
| JMF | 0:24d3eb812fd4 | 169 | * @brief Sends a notify frame with a payload indicating the name |
| JMF | 0:24d3eb812fd4 | 170 | * of the assert failed. |
| JMF | 0:24d3eb812fd4 | 171 | * @param expression: string representing the assert failed expression |
| JMF | 0:24d3eb812fd4 | 172 | * @retval : None |
| JMF | 0:24d3eb812fd4 | 173 | */ |
| JMF | 0:24d3eb812fd4 | 174 | void s_assert_failed(char* expression) |
| JMF | 0:24d3eb812fd4 | 175 | { |
| JMF | 0:24d3eb812fd4 | 176 | char pcPayload[100]; |
| JMF | 0:24d3eb812fd4 | 177 | uint16_t i; |
| JMF | 0:24d3eb812fd4 | 178 | |
| JMF | 0:24d3eb812fd4 | 179 | for(i = 0 ; expression[i]!='(' ; i++); |
| JMF | 0:24d3eb812fd4 | 180 | expression[i]='\0'; |
| JMF | 0:24d3eb812fd4 | 181 | |
| JMF | 0:24d3eb812fd4 | 182 | strcpy(pcPayload, &expression[3]); |
| JMF | 0:24d3eb812fd4 | 183 | |
| JMF | 0:24d3eb812fd4 | 184 | //sprintf(pcPayload, "The expression %s returned FALSE.\n\r", expression); |
| JMF | 0:24d3eb812fd4 | 185 | SpiritNotifyAssertFailed(pcPayload); |
| JMF | 0:24d3eb812fd4 | 186 | |
| JMF | 0:24d3eb812fd4 | 187 | } |
| JMF | 0:24d3eb812fd4 | 188 | |
| JMF | 0:24d3eb812fd4 | 189 | #endif |
| JMF | 0:24d3eb812fd4 | 190 | |
| JMF | 0:24d3eb812fd4 | 191 | |
| JMF | 0:24d3eb812fd4 | 192 | /** |
| JMF | 0:24d3eb812fd4 | 193 | * @brief Updates the gState (the global variable used to maintain memory of Spirit Status) |
| JMF | 0:24d3eb812fd4 | 194 | * reading the MC_STATE register of SPIRIT. |
| JMF | 0:24d3eb812fd4 | 195 | * @param None |
| JMF | 0:24d3eb812fd4 | 196 | * @retval None |
| JMF | 0:24d3eb812fd4 | 197 | */ |
| JMF | 0:24d3eb812fd4 | 198 | void SpiritRefreshStatus(void) |
| JMF | 0:24d3eb812fd4 | 199 | { |
| JMF | 0:24d3eb812fd4 | 200 | uint8_t tempRegValue; |
| JMF | 0:24d3eb812fd4 | 201 | |
| JMF | 0:24d3eb812fd4 | 202 | /* Reads the MC_STATUS register to update the g_xStatus */ |
| JMF | 0:24d3eb812fd4 | 203 | g_xStatus = SpiritSpiReadRegisters(MC_STATE1_BASE, 1, &tempRegValue); |
| JMF | 0:24d3eb812fd4 | 204 | } |
| JMF | 0:24d3eb812fd4 | 205 | |
| JMF | 0:24d3eb812fd4 | 206 | |
| JMF | 0:24d3eb812fd4 | 207 | /** |
| JMF | 0:24d3eb812fd4 | 208 | * @} |
| JMF | 0:24d3eb812fd4 | 209 | */ |
| JMF | 0:24d3eb812fd4 | 210 | |
| JMF | 0:24d3eb812fd4 | 211 | |
| JMF | 0:24d3eb812fd4 | 212 | |
| JMF | 0:24d3eb812fd4 | 213 | /** |
| JMF | 0:24d3eb812fd4 | 214 | * @} |
| JMF | 0:24d3eb812fd4 | 215 | */ |
| JMF | 0:24d3eb812fd4 | 216 | |
| JMF | 0:24d3eb812fd4 | 217 | |
| JMF | 0:24d3eb812fd4 | 218 | |
| JMF | 0:24d3eb812fd4 | 219 | /** |
| JMF | 0:24d3eb812fd4 | 220 | * @} |
| JMF | 0:24d3eb812fd4 | 221 | */ |
| JMF | 0:24d3eb812fd4 | 222 | |
| JMF | 0:24d3eb812fd4 | 223 | |
| JMF | 0:24d3eb812fd4 | 224 | |
| JMF | 0:24d3eb812fd4 | 225 | /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/ |