Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**
sahilmgandhi 18:6a4db94011d3 2 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 3 * @file stm32f4xx_hal_crc.c
sahilmgandhi 18:6a4db94011d3 4 * @author MCD Application Team
sahilmgandhi 18:6a4db94011d3 5 * @version V1.5.0
sahilmgandhi 18:6a4db94011d3 6 * @date 06-May-2016
sahilmgandhi 18:6a4db94011d3 7 * @brief CRC HAL module driver.
sahilmgandhi 18:6a4db94011d3 8 * This file provides firmware functions to manage the following
sahilmgandhi 18:6a4db94011d3 9 * functionalities of the Cyclic Redundancy Check (CRC) peripheral:
sahilmgandhi 18:6a4db94011d3 10 * + Initialization and de-initialization functions
sahilmgandhi 18:6a4db94011d3 11 * + Peripheral Control functions
sahilmgandhi 18:6a4db94011d3 12 * + Peripheral State functions
sahilmgandhi 18:6a4db94011d3 13 *
sahilmgandhi 18:6a4db94011d3 14 @verbatim
sahilmgandhi 18:6a4db94011d3 15 ==============================================================================
sahilmgandhi 18:6a4db94011d3 16 ##### How to use this driver #####
sahilmgandhi 18:6a4db94011d3 17 ==============================================================================
sahilmgandhi 18:6a4db94011d3 18 [..]
sahilmgandhi 18:6a4db94011d3 19 The CRC HAL driver can be used as follows:
sahilmgandhi 18:6a4db94011d3 20
sahilmgandhi 18:6a4db94011d3 21 (#) Enable CRC AHB clock using __HAL_RCC_CRC_CLK_ENABLE();
sahilmgandhi 18:6a4db94011d3 22
sahilmgandhi 18:6a4db94011d3 23 (#) Use HAL_CRC_Accumulate() function to compute the CRC value of
sahilmgandhi 18:6a4db94011d3 24 a 32-bit data buffer using combination of the previous CRC value
sahilmgandhi 18:6a4db94011d3 25 and the new one.
sahilmgandhi 18:6a4db94011d3 26
sahilmgandhi 18:6a4db94011d3 27 (#) Use HAL_CRC_Calculate() function to compute the CRC Value of
sahilmgandhi 18:6a4db94011d3 28 a new 32-bit data buffer. This function resets the CRC computation
sahilmgandhi 18:6a4db94011d3 29 unit before starting the computation to avoid getting wrong CRC values.
sahilmgandhi 18:6a4db94011d3 30
sahilmgandhi 18:6a4db94011d3 31 @endverbatim
sahilmgandhi 18:6a4db94011d3 32 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 33 * @attention
sahilmgandhi 18:6a4db94011d3 34 *
sahilmgandhi 18:6a4db94011d3 35 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
sahilmgandhi 18:6a4db94011d3 36 *
sahilmgandhi 18:6a4db94011d3 37 * Redistribution and use in source and binary forms, with or without modification,
sahilmgandhi 18:6a4db94011d3 38 * are permitted provided that the following conditions are met:
sahilmgandhi 18:6a4db94011d3 39 * 1. Redistributions of source code must retain the above copyright notice,
sahilmgandhi 18:6a4db94011d3 40 * this list of conditions and the following disclaimer.
sahilmgandhi 18:6a4db94011d3 41 * 2. Redistributions in binary form must reproduce the above copyright notice,
sahilmgandhi 18:6a4db94011d3 42 * this list of conditions and the following disclaimer in the documentation
sahilmgandhi 18:6a4db94011d3 43 * and/or other materials provided with the distribution.
sahilmgandhi 18:6a4db94011d3 44 * 3. Neither the name of STMicroelectronics nor the names of its contributors
sahilmgandhi 18:6a4db94011d3 45 * may be used to endorse or promote products derived from this software
sahilmgandhi 18:6a4db94011d3 46 * without specific prior written permission.
sahilmgandhi 18:6a4db94011d3 47 *
sahilmgandhi 18:6a4db94011d3 48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
sahilmgandhi 18:6a4db94011d3 49 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sahilmgandhi 18:6a4db94011d3 50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
sahilmgandhi 18:6a4db94011d3 51 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
sahilmgandhi 18:6a4db94011d3 52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sahilmgandhi 18:6a4db94011d3 53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sahilmgandhi 18:6a4db94011d3 54 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
sahilmgandhi 18:6a4db94011d3 55 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
sahilmgandhi 18:6a4db94011d3 56 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
sahilmgandhi 18:6a4db94011d3 57 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sahilmgandhi 18:6a4db94011d3 58 *
sahilmgandhi 18:6a4db94011d3 59 ******************************************************************************
sahilmgandhi 18:6a4db94011d3 60 */
sahilmgandhi 18:6a4db94011d3 61
sahilmgandhi 18:6a4db94011d3 62 /* Includes ------------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 63 #include "stm32f4xx_hal.h"
sahilmgandhi 18:6a4db94011d3 64
sahilmgandhi 18:6a4db94011d3 65 /** @addtogroup STM32F4xx_HAL_Driver
sahilmgandhi 18:6a4db94011d3 66 * @{
sahilmgandhi 18:6a4db94011d3 67 */
sahilmgandhi 18:6a4db94011d3 68
sahilmgandhi 18:6a4db94011d3 69 /** @addtogroup CRC
sahilmgandhi 18:6a4db94011d3 70 * @{
sahilmgandhi 18:6a4db94011d3 71 */
sahilmgandhi 18:6a4db94011d3 72
sahilmgandhi 18:6a4db94011d3 73 #ifdef HAL_CRC_MODULE_ENABLED
sahilmgandhi 18:6a4db94011d3 74
sahilmgandhi 18:6a4db94011d3 75 /* Private typedef -----------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 76 /* Private define ------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 77 /* Private macro -------------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 78 /* Private variables ---------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 79 /* Private function prototypes -----------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 80 /* Private functions ---------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 81 /* Exported functions --------------------------------------------------------*/
sahilmgandhi 18:6a4db94011d3 82
sahilmgandhi 18:6a4db94011d3 83 /** @addtogroup CRC_Exported_Functions
sahilmgandhi 18:6a4db94011d3 84 * @{
sahilmgandhi 18:6a4db94011d3 85 */
sahilmgandhi 18:6a4db94011d3 86
sahilmgandhi 18:6a4db94011d3 87 /** @addtogroup CRC_Exported_Functions_Group1
sahilmgandhi 18:6a4db94011d3 88 * @brief Initialization and de-initialization functions
sahilmgandhi 18:6a4db94011d3 89 *
sahilmgandhi 18:6a4db94011d3 90 @verbatim
sahilmgandhi 18:6a4db94011d3 91 ==============================================================================
sahilmgandhi 18:6a4db94011d3 92 ##### Initialization and de-initialization functions #####
sahilmgandhi 18:6a4db94011d3 93 ==============================================================================
sahilmgandhi 18:6a4db94011d3 94 [..] This section provides functions allowing to:
sahilmgandhi 18:6a4db94011d3 95 (+) Initialize the CRC according to the specified parameters
sahilmgandhi 18:6a4db94011d3 96 in the CRC_InitTypeDef and create the associated handle
sahilmgandhi 18:6a4db94011d3 97 (+) DeInitialize the CRC peripheral
sahilmgandhi 18:6a4db94011d3 98 (+) Initialize the CRC MSP
sahilmgandhi 18:6a4db94011d3 99 (+) DeInitialize CRC MSP
sahilmgandhi 18:6a4db94011d3 100
sahilmgandhi 18:6a4db94011d3 101 @endverbatim
sahilmgandhi 18:6a4db94011d3 102 * @{
sahilmgandhi 18:6a4db94011d3 103 */
sahilmgandhi 18:6a4db94011d3 104
sahilmgandhi 18:6a4db94011d3 105 /**
sahilmgandhi 18:6a4db94011d3 106 * @brief Initializes the CRC according to the specified
sahilmgandhi 18:6a4db94011d3 107 * parameters in the CRC_InitTypeDef and creates the associated handle.
sahilmgandhi 18:6a4db94011d3 108 * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 109 * the configuration information for CRC
sahilmgandhi 18:6a4db94011d3 110 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 111 */
sahilmgandhi 18:6a4db94011d3 112 HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc)
sahilmgandhi 18:6a4db94011d3 113 {
sahilmgandhi 18:6a4db94011d3 114 /* Check the CRC handle allocation */
sahilmgandhi 18:6a4db94011d3 115 if(hcrc == NULL)
sahilmgandhi 18:6a4db94011d3 116 {
sahilmgandhi 18:6a4db94011d3 117 return HAL_ERROR;
sahilmgandhi 18:6a4db94011d3 118 }
sahilmgandhi 18:6a4db94011d3 119
sahilmgandhi 18:6a4db94011d3 120 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 121 assert_param(IS_CRC_ALL_INSTANCE(hcrc->Instance));
sahilmgandhi 18:6a4db94011d3 122
sahilmgandhi 18:6a4db94011d3 123 if(hcrc->State == HAL_CRC_STATE_RESET)
sahilmgandhi 18:6a4db94011d3 124 {
sahilmgandhi 18:6a4db94011d3 125 /* Allocate lock resource and initialize it */
sahilmgandhi 18:6a4db94011d3 126 hcrc->Lock = HAL_UNLOCKED;
sahilmgandhi 18:6a4db94011d3 127 /* Init the low level hardware */
sahilmgandhi 18:6a4db94011d3 128 HAL_CRC_MspInit(hcrc);
sahilmgandhi 18:6a4db94011d3 129 }
sahilmgandhi 18:6a4db94011d3 130
sahilmgandhi 18:6a4db94011d3 131 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 132 hcrc->State = HAL_CRC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 133
sahilmgandhi 18:6a4db94011d3 134 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 135 hcrc->State = HAL_CRC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 136
sahilmgandhi 18:6a4db94011d3 137 /* Return function status */
sahilmgandhi 18:6a4db94011d3 138 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 139 }
sahilmgandhi 18:6a4db94011d3 140
sahilmgandhi 18:6a4db94011d3 141 /**
sahilmgandhi 18:6a4db94011d3 142 * @brief DeInitializes the CRC peripheral.
sahilmgandhi 18:6a4db94011d3 143 * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 144 * the configuration information for CRC
sahilmgandhi 18:6a4db94011d3 145 * @retval HAL status
sahilmgandhi 18:6a4db94011d3 146 */
sahilmgandhi 18:6a4db94011d3 147 HAL_StatusTypeDef HAL_CRC_DeInit(CRC_HandleTypeDef *hcrc)
sahilmgandhi 18:6a4db94011d3 148 {
sahilmgandhi 18:6a4db94011d3 149 /* Check the CRC handle allocation */
sahilmgandhi 18:6a4db94011d3 150 if(hcrc == NULL)
sahilmgandhi 18:6a4db94011d3 151 {
sahilmgandhi 18:6a4db94011d3 152 return HAL_ERROR;
sahilmgandhi 18:6a4db94011d3 153 }
sahilmgandhi 18:6a4db94011d3 154
sahilmgandhi 18:6a4db94011d3 155 /* Check the parameters */
sahilmgandhi 18:6a4db94011d3 156 assert_param(IS_CRC_ALL_INSTANCE(hcrc->Instance));
sahilmgandhi 18:6a4db94011d3 157
sahilmgandhi 18:6a4db94011d3 158 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 159 hcrc->State = HAL_CRC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 160
sahilmgandhi 18:6a4db94011d3 161 /* DeInit the low level hardware */
sahilmgandhi 18:6a4db94011d3 162 HAL_CRC_MspDeInit(hcrc);
sahilmgandhi 18:6a4db94011d3 163
sahilmgandhi 18:6a4db94011d3 164 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 165 hcrc->State = HAL_CRC_STATE_RESET;
sahilmgandhi 18:6a4db94011d3 166
sahilmgandhi 18:6a4db94011d3 167 /* Release Lock */
sahilmgandhi 18:6a4db94011d3 168 __HAL_UNLOCK(hcrc);
sahilmgandhi 18:6a4db94011d3 169
sahilmgandhi 18:6a4db94011d3 170 /* Return function status */
sahilmgandhi 18:6a4db94011d3 171 return HAL_OK;
sahilmgandhi 18:6a4db94011d3 172 }
sahilmgandhi 18:6a4db94011d3 173
sahilmgandhi 18:6a4db94011d3 174 /**
sahilmgandhi 18:6a4db94011d3 175 * @brief Initializes the CRC MSP.
sahilmgandhi 18:6a4db94011d3 176 * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 177 * the configuration information for CRC
sahilmgandhi 18:6a4db94011d3 178 * @retval None
sahilmgandhi 18:6a4db94011d3 179 */
sahilmgandhi 18:6a4db94011d3 180 __weak void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc)
sahilmgandhi 18:6a4db94011d3 181 {
sahilmgandhi 18:6a4db94011d3 182 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 183 UNUSED(hcrc);
sahilmgandhi 18:6a4db94011d3 184 /* NOTE : This function Should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 185 the HAL_CRC_MspInit could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 186 */
sahilmgandhi 18:6a4db94011d3 187 }
sahilmgandhi 18:6a4db94011d3 188
sahilmgandhi 18:6a4db94011d3 189 /**
sahilmgandhi 18:6a4db94011d3 190 * @brief DeInitializes the CRC MSP.
sahilmgandhi 18:6a4db94011d3 191 * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 192 * the configuration information for CRC
sahilmgandhi 18:6a4db94011d3 193 * @retval None
sahilmgandhi 18:6a4db94011d3 194 */
sahilmgandhi 18:6a4db94011d3 195 __weak void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc)
sahilmgandhi 18:6a4db94011d3 196 {
sahilmgandhi 18:6a4db94011d3 197 /* Prevent unused argument(s) compilation warning */
sahilmgandhi 18:6a4db94011d3 198 UNUSED(hcrc);
sahilmgandhi 18:6a4db94011d3 199 /* NOTE : This function Should not be modified, when the callback is needed,
sahilmgandhi 18:6a4db94011d3 200 the HAL_CRC_MspDeInit could be implemented in the user file
sahilmgandhi 18:6a4db94011d3 201 */
sahilmgandhi 18:6a4db94011d3 202 }
sahilmgandhi 18:6a4db94011d3 203
sahilmgandhi 18:6a4db94011d3 204 /**
sahilmgandhi 18:6a4db94011d3 205 * @}
sahilmgandhi 18:6a4db94011d3 206 */
sahilmgandhi 18:6a4db94011d3 207
sahilmgandhi 18:6a4db94011d3 208 /** @addtogroup CRC_Exported_Functions_Group2
sahilmgandhi 18:6a4db94011d3 209 * @brief Peripheral Control functions
sahilmgandhi 18:6a4db94011d3 210 *
sahilmgandhi 18:6a4db94011d3 211 @verbatim
sahilmgandhi 18:6a4db94011d3 212 ==============================================================================
sahilmgandhi 18:6a4db94011d3 213 ##### Peripheral Control functions #####
sahilmgandhi 18:6a4db94011d3 214 ==============================================================================
sahilmgandhi 18:6a4db94011d3 215 [..] This section provides functions allowing to:
sahilmgandhi 18:6a4db94011d3 216 (+) Compute the 32-bit CRC value of 32-bit data buffer,
sahilmgandhi 18:6a4db94011d3 217 using combination of the previous CRC value and the new one.
sahilmgandhi 18:6a4db94011d3 218 (+) Compute the 32-bit CRC value of 32-bit data buffer,
sahilmgandhi 18:6a4db94011d3 219 independently of the previous CRC value.
sahilmgandhi 18:6a4db94011d3 220
sahilmgandhi 18:6a4db94011d3 221 @endverbatim
sahilmgandhi 18:6a4db94011d3 222 * @{
sahilmgandhi 18:6a4db94011d3 223 */
sahilmgandhi 18:6a4db94011d3 224
sahilmgandhi 18:6a4db94011d3 225 /**
sahilmgandhi 18:6a4db94011d3 226 * @brief Computes the 32-bit CRC of 32-bit data buffer using combination
sahilmgandhi 18:6a4db94011d3 227 * of the previous CRC value and the new one.
sahilmgandhi 18:6a4db94011d3 228 * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 229 * the configuration information for CRC
sahilmgandhi 18:6a4db94011d3 230 * @param pBuffer: pointer to the buffer containing the data to be computed
sahilmgandhi 18:6a4db94011d3 231 * @param BufferLength: length of the buffer to be computed
sahilmgandhi 18:6a4db94011d3 232 * @retval 32-bit CRC
sahilmgandhi 18:6a4db94011d3 233 */
sahilmgandhi 18:6a4db94011d3 234 uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
sahilmgandhi 18:6a4db94011d3 235 {
sahilmgandhi 18:6a4db94011d3 236 uint32_t index = 0U;
sahilmgandhi 18:6a4db94011d3 237
sahilmgandhi 18:6a4db94011d3 238 /* Process Locked */
sahilmgandhi 18:6a4db94011d3 239 __HAL_LOCK(hcrc);
sahilmgandhi 18:6a4db94011d3 240
sahilmgandhi 18:6a4db94011d3 241 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 242 hcrc->State = HAL_CRC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 243
sahilmgandhi 18:6a4db94011d3 244 /* Enter Data to the CRC calculator */
sahilmgandhi 18:6a4db94011d3 245 for(index = 0U; index < BufferLength; index++)
sahilmgandhi 18:6a4db94011d3 246 {
sahilmgandhi 18:6a4db94011d3 247 hcrc->Instance->DR = pBuffer[index];
sahilmgandhi 18:6a4db94011d3 248 }
sahilmgandhi 18:6a4db94011d3 249
sahilmgandhi 18:6a4db94011d3 250 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 251 hcrc->State = HAL_CRC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 252
sahilmgandhi 18:6a4db94011d3 253 /* Process Unlocked */
sahilmgandhi 18:6a4db94011d3 254 __HAL_UNLOCK(hcrc);
sahilmgandhi 18:6a4db94011d3 255
sahilmgandhi 18:6a4db94011d3 256 /* Return the CRC computed value */
sahilmgandhi 18:6a4db94011d3 257 return hcrc->Instance->DR;
sahilmgandhi 18:6a4db94011d3 258 }
sahilmgandhi 18:6a4db94011d3 259
sahilmgandhi 18:6a4db94011d3 260 /**
sahilmgandhi 18:6a4db94011d3 261 * @brief Computes the 32-bit CRC of 32-bit data buffer independently
sahilmgandhi 18:6a4db94011d3 262 * of the previous CRC value.
sahilmgandhi 18:6a4db94011d3 263 * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 264 * the configuration information for CRC
sahilmgandhi 18:6a4db94011d3 265 * @param pBuffer: Pointer to the buffer containing the data to be computed
sahilmgandhi 18:6a4db94011d3 266 * @param BufferLength: Length of the buffer to be computed
sahilmgandhi 18:6a4db94011d3 267 * @retval 32-bit CRC
sahilmgandhi 18:6a4db94011d3 268 */
sahilmgandhi 18:6a4db94011d3 269 uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength)
sahilmgandhi 18:6a4db94011d3 270 {
sahilmgandhi 18:6a4db94011d3 271 uint32_t index = 0U;
sahilmgandhi 18:6a4db94011d3 272
sahilmgandhi 18:6a4db94011d3 273 /* Process Locked */
sahilmgandhi 18:6a4db94011d3 274 __HAL_LOCK(hcrc);
sahilmgandhi 18:6a4db94011d3 275
sahilmgandhi 18:6a4db94011d3 276 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 277 hcrc->State = HAL_CRC_STATE_BUSY;
sahilmgandhi 18:6a4db94011d3 278
sahilmgandhi 18:6a4db94011d3 279 /* Reset CRC Calculation Unit */
sahilmgandhi 18:6a4db94011d3 280 __HAL_CRC_DR_RESET(hcrc);
sahilmgandhi 18:6a4db94011d3 281
sahilmgandhi 18:6a4db94011d3 282 /* Enter Data to the CRC calculator */
sahilmgandhi 18:6a4db94011d3 283 for(index = 0U; index < BufferLength; index++)
sahilmgandhi 18:6a4db94011d3 284 {
sahilmgandhi 18:6a4db94011d3 285 hcrc->Instance->DR = pBuffer[index];
sahilmgandhi 18:6a4db94011d3 286 }
sahilmgandhi 18:6a4db94011d3 287
sahilmgandhi 18:6a4db94011d3 288 /* Change CRC peripheral state */
sahilmgandhi 18:6a4db94011d3 289 hcrc->State = HAL_CRC_STATE_READY;
sahilmgandhi 18:6a4db94011d3 290
sahilmgandhi 18:6a4db94011d3 291 /* Process Unlocked */
sahilmgandhi 18:6a4db94011d3 292 __HAL_UNLOCK(hcrc);
sahilmgandhi 18:6a4db94011d3 293
sahilmgandhi 18:6a4db94011d3 294 /* Return the CRC computed value */
sahilmgandhi 18:6a4db94011d3 295 return hcrc->Instance->DR;
sahilmgandhi 18:6a4db94011d3 296 }
sahilmgandhi 18:6a4db94011d3 297
sahilmgandhi 18:6a4db94011d3 298 /**
sahilmgandhi 18:6a4db94011d3 299 * @}
sahilmgandhi 18:6a4db94011d3 300 */
sahilmgandhi 18:6a4db94011d3 301
sahilmgandhi 18:6a4db94011d3 302
sahilmgandhi 18:6a4db94011d3 303 /** @addtogroup CRC_Exported_Functions_Group3
sahilmgandhi 18:6a4db94011d3 304 * @brief Peripheral State functions
sahilmgandhi 18:6a4db94011d3 305 *
sahilmgandhi 18:6a4db94011d3 306 @verbatim
sahilmgandhi 18:6a4db94011d3 307 ==============================================================================
sahilmgandhi 18:6a4db94011d3 308 ##### Peripheral State functions #####
sahilmgandhi 18:6a4db94011d3 309 ==============================================================================
sahilmgandhi 18:6a4db94011d3 310 [..]
sahilmgandhi 18:6a4db94011d3 311 This subsection permits to get in run-time the status of the peripheral
sahilmgandhi 18:6a4db94011d3 312 and the data flow.
sahilmgandhi 18:6a4db94011d3 313
sahilmgandhi 18:6a4db94011d3 314 @endverbatim
sahilmgandhi 18:6a4db94011d3 315 * @{
sahilmgandhi 18:6a4db94011d3 316 */
sahilmgandhi 18:6a4db94011d3 317
sahilmgandhi 18:6a4db94011d3 318 /**
sahilmgandhi 18:6a4db94011d3 319 * @brief Returns the CRC state.
sahilmgandhi 18:6a4db94011d3 320 * @param hcrc: pointer to a CRC_HandleTypeDef structure that contains
sahilmgandhi 18:6a4db94011d3 321 * the configuration information for CRC
sahilmgandhi 18:6a4db94011d3 322 * @retval HAL state
sahilmgandhi 18:6a4db94011d3 323 */
sahilmgandhi 18:6a4db94011d3 324 HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc)
sahilmgandhi 18:6a4db94011d3 325 {
sahilmgandhi 18:6a4db94011d3 326 return hcrc->State;
sahilmgandhi 18:6a4db94011d3 327 }
sahilmgandhi 18:6a4db94011d3 328
sahilmgandhi 18:6a4db94011d3 329 /**
sahilmgandhi 18:6a4db94011d3 330 * @}
sahilmgandhi 18:6a4db94011d3 331 */
sahilmgandhi 18:6a4db94011d3 332
sahilmgandhi 18:6a4db94011d3 333 /**
sahilmgandhi 18:6a4db94011d3 334 * @}
sahilmgandhi 18:6a4db94011d3 335 */
sahilmgandhi 18:6a4db94011d3 336
sahilmgandhi 18:6a4db94011d3 337 #endif /* HAL_CRC_MODULE_ENABLED */
sahilmgandhi 18:6a4db94011d3 338 /**
sahilmgandhi 18:6a4db94011d3 339 * @}
sahilmgandhi 18:6a4db94011d3 340 */
sahilmgandhi 18:6a4db94011d3 341
sahilmgandhi 18:6a4db94011d3 342 /**
sahilmgandhi 18:6a4db94011d3 343 * @}
sahilmgandhi 18:6a4db94011d3 344 */
sahilmgandhi 18:6a4db94011d3 345
sahilmgandhi 18:6a4db94011d3 346 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/