A simple 128x32 graphical LCD program to quickstart with LCD on ARM mbed IoT Starter Kit. This requires mbed Applciation Shield with FRDM-K64F platform.
mbed/TARGET_ARCH_MAX/stm32f4xx_hal_rng.h@1:eb68c94a8ee5, 2015-04-12 (annotated)
- Committer:
- tushki7
- Date:
- Sun Apr 12 15:45:52 2015 +0000
- Revision:
- 1:eb68c94a8ee5
- Parent:
- 0:60d829a0353a
A simple 128x32 LCD program with ARM mbed IoT Starter Kit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tushki7 | 0:60d829a0353a | 1 | /** |
tushki7 | 0:60d829a0353a | 2 | ****************************************************************************** |
tushki7 | 0:60d829a0353a | 3 | * @file stm32f4xx_hal_rng.h |
tushki7 | 0:60d829a0353a | 4 | * @author MCD Application Team |
tushki7 | 0:60d829a0353a | 5 | * @version V1.1.0 |
tushki7 | 0:60d829a0353a | 6 | * @date 19-June-2014 |
tushki7 | 0:60d829a0353a | 7 | * @brief Header file of RNG HAL module. |
tushki7 | 0:60d829a0353a | 8 | ****************************************************************************** |
tushki7 | 0:60d829a0353a | 9 | * @attention |
tushki7 | 0:60d829a0353a | 10 | * |
tushki7 | 0:60d829a0353a | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
tushki7 | 0:60d829a0353a | 12 | * |
tushki7 | 0:60d829a0353a | 13 | * Redistribution and use in source and binary forms, with or without modification, |
tushki7 | 0:60d829a0353a | 14 | * are permitted provided that the following conditions are met: |
tushki7 | 0:60d829a0353a | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
tushki7 | 0:60d829a0353a | 16 | * this list of conditions and the following disclaimer. |
tushki7 | 0:60d829a0353a | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
tushki7 | 0:60d829a0353a | 18 | * this list of conditions and the following disclaimer in the documentation |
tushki7 | 0:60d829a0353a | 19 | * and/or other materials provided with the distribution. |
tushki7 | 0:60d829a0353a | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
tushki7 | 0:60d829a0353a | 21 | * may be used to endorse or promote products derived from this software |
tushki7 | 0:60d829a0353a | 22 | * without specific prior written permission. |
tushki7 | 0:60d829a0353a | 23 | * |
tushki7 | 0:60d829a0353a | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
tushki7 | 0:60d829a0353a | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
tushki7 | 0:60d829a0353a | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
tushki7 | 0:60d829a0353a | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
tushki7 | 0:60d829a0353a | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
tushki7 | 0:60d829a0353a | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
tushki7 | 0:60d829a0353a | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
tushki7 | 0:60d829a0353a | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
tushki7 | 0:60d829a0353a | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
tushki7 | 0:60d829a0353a | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
tushki7 | 0:60d829a0353a | 34 | * |
tushki7 | 0:60d829a0353a | 35 | ****************************************************************************** |
tushki7 | 0:60d829a0353a | 36 | */ |
tushki7 | 0:60d829a0353a | 37 | |
tushki7 | 0:60d829a0353a | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
tushki7 | 0:60d829a0353a | 39 | #ifndef __STM32F4xx_HAL_RNG_H |
tushki7 | 0:60d829a0353a | 40 | #define __STM32F4xx_HAL_RNG_H |
tushki7 | 0:60d829a0353a | 41 | |
tushki7 | 0:60d829a0353a | 42 | #ifdef __cplusplus |
tushki7 | 0:60d829a0353a | 43 | extern "C" { |
tushki7 | 0:60d829a0353a | 44 | #endif |
tushki7 | 0:60d829a0353a | 45 | |
tushki7 | 0:60d829a0353a | 46 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ |
tushki7 | 0:60d829a0353a | 47 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) |
tushki7 | 0:60d829a0353a | 48 | /* Includes ------------------------------------------------------------------*/ |
tushki7 | 0:60d829a0353a | 49 | #include "stm32f4xx_hal_def.h" |
tushki7 | 0:60d829a0353a | 50 | |
tushki7 | 0:60d829a0353a | 51 | /** @addtogroup STM32F4xx_HAL_Driver |
tushki7 | 0:60d829a0353a | 52 | * @{ |
tushki7 | 0:60d829a0353a | 53 | */ |
tushki7 | 0:60d829a0353a | 54 | |
tushki7 | 0:60d829a0353a | 55 | /** @addtogroup RNG |
tushki7 | 0:60d829a0353a | 56 | * @{ |
tushki7 | 0:60d829a0353a | 57 | */ |
tushki7 | 0:60d829a0353a | 58 | |
tushki7 | 0:60d829a0353a | 59 | /* Exported types ------------------------------------------------------------*/ |
tushki7 | 0:60d829a0353a | 60 | |
tushki7 | 0:60d829a0353a | 61 | /** |
tushki7 | 0:60d829a0353a | 62 | * @brief RNG HAL State Structure definition |
tushki7 | 0:60d829a0353a | 63 | */ |
tushki7 | 0:60d829a0353a | 64 | typedef enum |
tushki7 | 0:60d829a0353a | 65 | { |
tushki7 | 0:60d829a0353a | 66 | HAL_RNG_STATE_RESET = 0x00, /*!< RNG not yet initialized or disabled */ |
tushki7 | 0:60d829a0353a | 67 | HAL_RNG_STATE_READY = 0x01, /*!< RNG initialized and ready for use */ |
tushki7 | 0:60d829a0353a | 68 | HAL_RNG_STATE_BUSY = 0x02, /*!< RNG internal process is ongoing */ |
tushki7 | 0:60d829a0353a | 69 | HAL_RNG_STATE_TIMEOUT = 0x03, /*!< RNG timeout state */ |
tushki7 | 0:60d829a0353a | 70 | HAL_RNG_STATE_ERROR = 0x04 /*!< RNG error state */ |
tushki7 | 0:60d829a0353a | 71 | |
tushki7 | 0:60d829a0353a | 72 | }HAL_RNG_StateTypeDef; |
tushki7 | 0:60d829a0353a | 73 | |
tushki7 | 0:60d829a0353a | 74 | /** |
tushki7 | 0:60d829a0353a | 75 | * @brief RNG Handle Structure definition |
tushki7 | 0:60d829a0353a | 76 | */ |
tushki7 | 0:60d829a0353a | 77 | typedef struct |
tushki7 | 0:60d829a0353a | 78 | { |
tushki7 | 0:60d829a0353a | 79 | RNG_TypeDef *Instance; /*!< Register base address */ |
tushki7 | 0:60d829a0353a | 80 | |
tushki7 | 0:60d829a0353a | 81 | HAL_LockTypeDef Lock; /*!< RNG locking object */ |
tushki7 | 0:60d829a0353a | 82 | |
tushki7 | 0:60d829a0353a | 83 | __IO HAL_RNG_StateTypeDef State; /*!< RNG communication state */ |
tushki7 | 0:60d829a0353a | 84 | |
tushki7 | 0:60d829a0353a | 85 | }RNG_HandleTypeDef; |
tushki7 | 0:60d829a0353a | 86 | |
tushki7 | 0:60d829a0353a | 87 | /* Exported constants --------------------------------------------------------*/ |
tushki7 | 0:60d829a0353a | 88 | |
tushki7 | 0:60d829a0353a | 89 | /** @defgroup RNG_Exported_Constants |
tushki7 | 0:60d829a0353a | 90 | * @{ |
tushki7 | 0:60d829a0353a | 91 | */ |
tushki7 | 0:60d829a0353a | 92 | |
tushki7 | 0:60d829a0353a | 93 | /** @defgroup RNG_Interrupt_definition |
tushki7 | 0:60d829a0353a | 94 | * @{ |
tushki7 | 0:60d829a0353a | 95 | */ |
tushki7 | 0:60d829a0353a | 96 | #define RNG_IT_CEI ((uint32_t)0x20) /*!< Clock error interrupt */ |
tushki7 | 0:60d829a0353a | 97 | #define RNG_IT_SEI ((uint32_t)0x40) /*!< Seed error interrupt */ |
tushki7 | 0:60d829a0353a | 98 | |
tushki7 | 0:60d829a0353a | 99 | #define IS_RNG_IT(IT) (((IT) == RNG_IT_CEI) || \ |
tushki7 | 0:60d829a0353a | 100 | ((IT) == RNG_IT_SEI)) |
tushki7 | 0:60d829a0353a | 101 | /** |
tushki7 | 0:60d829a0353a | 102 | * @} |
tushki7 | 0:60d829a0353a | 103 | */ |
tushki7 | 0:60d829a0353a | 104 | |
tushki7 | 0:60d829a0353a | 105 | |
tushki7 | 0:60d829a0353a | 106 | /** @defgroup RNG_Flag_definition |
tushki7 | 0:60d829a0353a | 107 | * @{ |
tushki7 | 0:60d829a0353a | 108 | */ |
tushki7 | 0:60d829a0353a | 109 | #define RNG_FLAG_DRDY ((uint32_t)0x0001) /*!< Data ready */ |
tushki7 | 0:60d829a0353a | 110 | #define RNG_FLAG_CECS ((uint32_t)0x0002) /*!< Clock error current status */ |
tushki7 | 0:60d829a0353a | 111 | #define RNG_FLAG_SECS ((uint32_t)0x0004) /*!< Seed error current status */ |
tushki7 | 0:60d829a0353a | 112 | |
tushki7 | 0:60d829a0353a | 113 | #define IS_RNG_FLAG(FLAG) (((FLAG) == RNG_FLAG_DRDY) || \ |
tushki7 | 0:60d829a0353a | 114 | ((FLAG) == RNG_FLAG_CECS) || \ |
tushki7 | 0:60d829a0353a | 115 | ((FLAG) == RNG_FLAG_SECS)) |
tushki7 | 0:60d829a0353a | 116 | /** |
tushki7 | 0:60d829a0353a | 117 | * @} |
tushki7 | 0:60d829a0353a | 118 | */ |
tushki7 | 0:60d829a0353a | 119 | |
tushki7 | 0:60d829a0353a | 120 | /** |
tushki7 | 0:60d829a0353a | 121 | * @} |
tushki7 | 0:60d829a0353a | 122 | */ |
tushki7 | 0:60d829a0353a | 123 | |
tushki7 | 0:60d829a0353a | 124 | /* Exported macro ------------------------------------------------------------*/ |
tushki7 | 0:60d829a0353a | 125 | |
tushki7 | 0:60d829a0353a | 126 | /** @brief Reset RNG handle state |
tushki7 | 0:60d829a0353a | 127 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 128 | * @retval None |
tushki7 | 0:60d829a0353a | 129 | */ |
tushki7 | 0:60d829a0353a | 130 | #define __HAL_RNG_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_RNG_STATE_RESET) |
tushki7 | 0:60d829a0353a | 131 | |
tushki7 | 0:60d829a0353a | 132 | /** |
tushki7 | 0:60d829a0353a | 133 | * @brief Enables the RNG peripheral. |
tushki7 | 0:60d829a0353a | 134 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 135 | * @retval None |
tushki7 | 0:60d829a0353a | 136 | */ |
tushki7 | 0:60d829a0353a | 137 | #define __HAL_RNG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_RNGEN) |
tushki7 | 0:60d829a0353a | 138 | |
tushki7 | 0:60d829a0353a | 139 | /** |
tushki7 | 0:60d829a0353a | 140 | * @brief Disables the RNG peripheral. |
tushki7 | 0:60d829a0353a | 141 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 142 | * @retval None |
tushki7 | 0:60d829a0353a | 143 | */ |
tushki7 | 0:60d829a0353a | 144 | #define __HAL_RNG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_RNGEN) |
tushki7 | 0:60d829a0353a | 145 | |
tushki7 | 0:60d829a0353a | 146 | /** |
tushki7 | 0:60d829a0353a | 147 | * @brief Gets the selected RNG's flag status. |
tushki7 | 0:60d829a0353a | 148 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 149 | * @param __FLAG__: RNG flag |
tushki7 | 0:60d829a0353a | 150 | * @retval The new state of RNG_FLAG (SET or RESET). |
tushki7 | 0:60d829a0353a | 151 | */ |
tushki7 | 0:60d829a0353a | 152 | #define __HAL_RNG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) |
tushki7 | 0:60d829a0353a | 153 | |
tushki7 | 0:60d829a0353a | 154 | /** |
tushki7 | 0:60d829a0353a | 155 | * @brief Clears the RNG's pending flags. |
tushki7 | 0:60d829a0353a | 156 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 157 | * @param __FLAG__: RNG flag |
tushki7 | 0:60d829a0353a | 158 | * @retval None |
tushki7 | 0:60d829a0353a | 159 | */ |
tushki7 | 0:60d829a0353a | 160 | #define __HAL_RNG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = ~(__FLAG__)) |
tushki7 | 0:60d829a0353a | 161 | |
tushki7 | 0:60d829a0353a | 162 | /** |
tushki7 | 0:60d829a0353a | 163 | * @brief Enables the RNG interrupts. |
tushki7 | 0:60d829a0353a | 164 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 165 | * @retval None |
tushki7 | 0:60d829a0353a | 166 | */ |
tushki7 | 0:60d829a0353a | 167 | #define __HAL_RNG_ENABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_IE) |
tushki7 | 0:60d829a0353a | 168 | |
tushki7 | 0:60d829a0353a | 169 | /** |
tushki7 | 0:60d829a0353a | 170 | * @brief Disables the RNG interrupts. |
tushki7 | 0:60d829a0353a | 171 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 172 | * @retval None |
tushki7 | 0:60d829a0353a | 173 | */ |
tushki7 | 0:60d829a0353a | 174 | #define __HAL_RNG_DISABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_IE) |
tushki7 | 0:60d829a0353a | 175 | |
tushki7 | 0:60d829a0353a | 176 | /** |
tushki7 | 0:60d829a0353a | 177 | * @brief Checks whether the specified RNG interrupt has occurred or not. |
tushki7 | 0:60d829a0353a | 178 | * @param __HANDLE__: RNG Handle |
tushki7 | 0:60d829a0353a | 179 | * @param __INTERRUPT__: specifies the RNG interrupt source to check. |
tushki7 | 0:60d829a0353a | 180 | * This parameter can be one of the following values: |
tushki7 | 0:60d829a0353a | 181 | * @arg RNG_FLAG_DRDY: Data ready interrupt |
tushki7 | 0:60d829a0353a | 182 | * @arg RNG_FLAG_CECS: Clock error interrupt |
tushki7 | 0:60d829a0353a | 183 | * @arg RNG_FLAG_SECS: Seed error interrupt |
tushki7 | 0:60d829a0353a | 184 | * @retval The new state of RNG_FLAG (SET or RESET). |
tushki7 | 0:60d829a0353a | 185 | */ |
tushki7 | 0:60d829a0353a | 186 | #define __HAL_RNG_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->SR & (__INTERRUPT__)) == (__INTERRUPT__)) |
tushki7 | 0:60d829a0353a | 187 | |
tushki7 | 0:60d829a0353a | 188 | /* Exported functions --------------------------------------------------------*/ |
tushki7 | 0:60d829a0353a | 189 | |
tushki7 | 0:60d829a0353a | 190 | /* Initialization/de-initialization functions **********************************/ |
tushki7 | 0:60d829a0353a | 191 | HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 192 | HAL_StatusTypeDef HAL_RNG_DeInit (RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 193 | void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 194 | void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 195 | |
tushki7 | 0:60d829a0353a | 196 | /* Peripheral Control functions ************************************************/ |
tushki7 | 0:60d829a0353a | 197 | uint32_t HAL_RNG_GetRandomNumber(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 198 | uint32_t HAL_RNG_GetRandomNumber_IT(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 199 | void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 200 | void HAL_RNG_ReadyCallback(RNG_HandleTypeDef* hrng); |
tushki7 | 0:60d829a0353a | 201 | void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 202 | |
tushki7 | 0:60d829a0353a | 203 | /* Peripheral State functions **************************************************/ |
tushki7 | 0:60d829a0353a | 204 | HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng); |
tushki7 | 0:60d829a0353a | 205 | |
tushki7 | 0:60d829a0353a | 206 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ |
tushki7 | 0:60d829a0353a | 207 | |
tushki7 | 0:60d829a0353a | 208 | /** |
tushki7 | 0:60d829a0353a | 209 | * @} |
tushki7 | 0:60d829a0353a | 210 | */ |
tushki7 | 0:60d829a0353a | 211 | |
tushki7 | 0:60d829a0353a | 212 | /** |
tushki7 | 0:60d829a0353a | 213 | * @} |
tushki7 | 0:60d829a0353a | 214 | */ |
tushki7 | 0:60d829a0353a | 215 | |
tushki7 | 0:60d829a0353a | 216 | #ifdef __cplusplus |
tushki7 | 0:60d829a0353a | 217 | } |
tushki7 | 0:60d829a0353a | 218 | #endif |
tushki7 | 0:60d829a0353a | 219 | |
tushki7 | 0:60d829a0353a | 220 | #endif /* __STM32F4xx_HAL_RNG_H */ |
tushki7 | 0:60d829a0353a | 221 | |
tushki7 | 0:60d829a0353a | 222 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |