DHT11
TARGET_NUCLEO_F072RB/stm32f0xx_hal_def.h@0:c52df770855b, 2015-08-13 (annotated)
- Committer:
- jhon309
- Date:
- Thu Aug 13 00:21:57 2015 +0000
- Revision:
- 0:c52df770855b
DHT11
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jhon309 | 0:c52df770855b | 1 | /** |
jhon309 | 0:c52df770855b | 2 | ****************************************************************************** |
jhon309 | 0:c52df770855b | 3 | * @file stm32f0xx_hal_def.h |
jhon309 | 0:c52df770855b | 4 | * @author MCD Application Team |
jhon309 | 0:c52df770855b | 5 | * @version V1.2.0 |
jhon309 | 0:c52df770855b | 6 | * @date 11-December-2014 |
jhon309 | 0:c52df770855b | 7 | * @brief This file contains HAL common defines, enumeration, macros and |
jhon309 | 0:c52df770855b | 8 | * structures definitions. |
jhon309 | 0:c52df770855b | 9 | ****************************************************************************** |
jhon309 | 0:c52df770855b | 10 | * @attention |
jhon309 | 0:c52df770855b | 11 | * |
jhon309 | 0:c52df770855b | 12 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
jhon309 | 0:c52df770855b | 13 | * |
jhon309 | 0:c52df770855b | 14 | * Redistribution and use in source and binary forms, with or without modification, |
jhon309 | 0:c52df770855b | 15 | * are permitted provided that the following conditions are met: |
jhon309 | 0:c52df770855b | 16 | * 1. Redistributions of source code must retain the above copyright notice, |
jhon309 | 0:c52df770855b | 17 | * this list of conditions and the following disclaimer. |
jhon309 | 0:c52df770855b | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
jhon309 | 0:c52df770855b | 19 | * this list of conditions and the following disclaimer in the documentation |
jhon309 | 0:c52df770855b | 20 | * and/or other materials provided with the distribution. |
jhon309 | 0:c52df770855b | 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
jhon309 | 0:c52df770855b | 22 | * may be used to endorse or promote products derived from this software |
jhon309 | 0:c52df770855b | 23 | * without specific prior written permission. |
jhon309 | 0:c52df770855b | 24 | * |
jhon309 | 0:c52df770855b | 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
jhon309 | 0:c52df770855b | 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
jhon309 | 0:c52df770855b | 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
jhon309 | 0:c52df770855b | 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
jhon309 | 0:c52df770855b | 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
jhon309 | 0:c52df770855b | 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
jhon309 | 0:c52df770855b | 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
jhon309 | 0:c52df770855b | 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
jhon309 | 0:c52df770855b | 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
jhon309 | 0:c52df770855b | 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
jhon309 | 0:c52df770855b | 35 | * |
jhon309 | 0:c52df770855b | 36 | ****************************************************************************** |
jhon309 | 0:c52df770855b | 37 | */ |
jhon309 | 0:c52df770855b | 38 | |
jhon309 | 0:c52df770855b | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ |
jhon309 | 0:c52df770855b | 40 | #ifndef __STM32F0xx_HAL_DEF |
jhon309 | 0:c52df770855b | 41 | #define __STM32F0xx_HAL_DEF |
jhon309 | 0:c52df770855b | 42 | |
jhon309 | 0:c52df770855b | 43 | #ifdef __cplusplus |
jhon309 | 0:c52df770855b | 44 | extern "C" { |
jhon309 | 0:c52df770855b | 45 | #endif |
jhon309 | 0:c52df770855b | 46 | |
jhon309 | 0:c52df770855b | 47 | /* Includes ------------------------------------------------------------------*/ |
jhon309 | 0:c52df770855b | 48 | #include "stm32f0xx.h" |
jhon309 | 0:c52df770855b | 49 | |
jhon309 | 0:c52df770855b | 50 | /* Exported types ------------------------------------------------------------*/ |
jhon309 | 0:c52df770855b | 51 | |
jhon309 | 0:c52df770855b | 52 | /** |
jhon309 | 0:c52df770855b | 53 | * @brief HAL Status structures definition |
jhon309 | 0:c52df770855b | 54 | */ |
jhon309 | 0:c52df770855b | 55 | typedef enum |
jhon309 | 0:c52df770855b | 56 | { |
jhon309 | 0:c52df770855b | 57 | HAL_OK = 0x00, |
jhon309 | 0:c52df770855b | 58 | HAL_ERROR = 0x01, |
jhon309 | 0:c52df770855b | 59 | HAL_BUSY = 0x02, |
jhon309 | 0:c52df770855b | 60 | HAL_TIMEOUT = 0x03 |
jhon309 | 0:c52df770855b | 61 | } HAL_StatusTypeDef; |
jhon309 | 0:c52df770855b | 62 | |
jhon309 | 0:c52df770855b | 63 | /** |
jhon309 | 0:c52df770855b | 64 | * @brief HAL Lock structures definition |
jhon309 | 0:c52df770855b | 65 | */ |
jhon309 | 0:c52df770855b | 66 | typedef enum |
jhon309 | 0:c52df770855b | 67 | { |
jhon309 | 0:c52df770855b | 68 | HAL_UNLOCKED = 0x00, |
jhon309 | 0:c52df770855b | 69 | HAL_LOCKED = 0x01 |
jhon309 | 0:c52df770855b | 70 | } HAL_LockTypeDef; |
jhon309 | 0:c52df770855b | 71 | |
jhon309 | 0:c52df770855b | 72 | /* Exported macro ------------------------------------------------------------*/ |
jhon309 | 0:c52df770855b | 73 | #ifndef NULL |
jhon309 | 0:c52df770855b | 74 | #define NULL 0 |
jhon309 | 0:c52df770855b | 75 | #endif |
jhon309 | 0:c52df770855b | 76 | |
jhon309 | 0:c52df770855b | 77 | #define HAL_MAX_DELAY 0xFFFFFFFF |
jhon309 | 0:c52df770855b | 78 | |
jhon309 | 0:c52df770855b | 79 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) |
jhon309 | 0:c52df770855b | 80 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) |
jhon309 | 0:c52df770855b | 81 | |
jhon309 | 0:c52df770855b | 82 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \ |
jhon309 | 0:c52df770855b | 83 | do{ \ |
jhon309 | 0:c52df770855b | 84 | (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \ |
jhon309 | 0:c52df770855b | 85 | (__DMA_HANDLE_).Parent = (__HANDLE__); \ |
jhon309 | 0:c52df770855b | 86 | } while(0) |
jhon309 | 0:c52df770855b | 87 | |
jhon309 | 0:c52df770855b | 88 | #define UNUSED(x) ((void)(x)) |
jhon309 | 0:c52df770855b | 89 | |
jhon309 | 0:c52df770855b | 90 | /** @brief Reset the Handle's State field. |
jhon309 | 0:c52df770855b | 91 | * @param __HANDLE__: specifies the Peripheral Handle. |
jhon309 | 0:c52df770855b | 92 | * @note This macro can be used for the following purpose: |
jhon309 | 0:c52df770855b | 93 | * - When the Handle is declared as local variable; before passing it as parameter |
jhon309 | 0:c52df770855b | 94 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro |
jhon309 | 0:c52df770855b | 95 | * to set to 0 the Handle's "State" field. |
jhon309 | 0:c52df770855b | 96 | * Otherwise, "State" field may have any random value and the first time the function |
jhon309 | 0:c52df770855b | 97 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed |
jhon309 | 0:c52df770855b | 98 | * (i.e. HAL_PPP_MspInit() will not be executed). |
jhon309 | 0:c52df770855b | 99 | * - When there is a need to reconfigure the low level hardware: instead of calling |
jhon309 | 0:c52df770855b | 100 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). |
jhon309 | 0:c52df770855b | 101 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function |
jhon309 | 0:c52df770855b | 102 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. |
jhon309 | 0:c52df770855b | 103 | * @retval None |
jhon309 | 0:c52df770855b | 104 | */ |
jhon309 | 0:c52df770855b | 105 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0) |
jhon309 | 0:c52df770855b | 106 | |
jhon309 | 0:c52df770855b | 107 | #if (USE_RTOS == 1) |
jhon309 | 0:c52df770855b | 108 | #error " USE_RTOS should be 0 in the current HAL release " |
jhon309 | 0:c52df770855b | 109 | #else |
jhon309 | 0:c52df770855b | 110 | #define __HAL_LOCK(__HANDLE__) \ |
jhon309 | 0:c52df770855b | 111 | do{ \ |
jhon309 | 0:c52df770855b | 112 | if((__HANDLE__)->Lock == HAL_LOCKED) \ |
jhon309 | 0:c52df770855b | 113 | { \ |
jhon309 | 0:c52df770855b | 114 | return HAL_BUSY; \ |
jhon309 | 0:c52df770855b | 115 | } \ |
jhon309 | 0:c52df770855b | 116 | else \ |
jhon309 | 0:c52df770855b | 117 | { \ |
jhon309 | 0:c52df770855b | 118 | (__HANDLE__)->Lock = HAL_LOCKED; \ |
jhon309 | 0:c52df770855b | 119 | } \ |
jhon309 | 0:c52df770855b | 120 | }while (0) |
jhon309 | 0:c52df770855b | 121 | |
jhon309 | 0:c52df770855b | 122 | #define __HAL_UNLOCK(__HANDLE__) \ |
jhon309 | 0:c52df770855b | 123 | do{ \ |
jhon309 | 0:c52df770855b | 124 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ |
jhon309 | 0:c52df770855b | 125 | }while (0) |
jhon309 | 0:c52df770855b | 126 | #endif /* USE_RTOS */ |
jhon309 | 0:c52df770855b | 127 | |
jhon309 | 0:c52df770855b | 128 | #if defined ( __GNUC__ ) |
jhon309 | 0:c52df770855b | 129 | #ifndef __weak |
jhon309 | 0:c52df770855b | 130 | #define __weak __attribute__((weak)) |
jhon309 | 0:c52df770855b | 131 | #endif /* __weak */ |
jhon309 | 0:c52df770855b | 132 | #ifndef __packed |
jhon309 | 0:c52df770855b | 133 | #define __packed __attribute__((__packed__)) |
jhon309 | 0:c52df770855b | 134 | #endif /* __packed */ |
jhon309 | 0:c52df770855b | 135 | #endif /* __GNUC__ */ |
jhon309 | 0:c52df770855b | 136 | |
jhon309 | 0:c52df770855b | 137 | |
jhon309 | 0:c52df770855b | 138 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ |
jhon309 | 0:c52df770855b | 139 | #if defined (__GNUC__) /* GNU Compiler */ |
jhon309 | 0:c52df770855b | 140 | #ifndef __ALIGN_END |
jhon309 | 0:c52df770855b | 141 | #define __ALIGN_END __attribute__ ((aligned (4))) |
jhon309 | 0:c52df770855b | 142 | #endif /* __ALIGN_END */ |
jhon309 | 0:c52df770855b | 143 | #ifndef __ALIGN_BEGIN |
jhon309 | 0:c52df770855b | 144 | #define __ALIGN_BEGIN |
jhon309 | 0:c52df770855b | 145 | #endif /* __ALIGN_BEGIN */ |
jhon309 | 0:c52df770855b | 146 | #else |
jhon309 | 0:c52df770855b | 147 | #ifndef __ALIGN_END |
jhon309 | 0:c52df770855b | 148 | #define __ALIGN_END |
jhon309 | 0:c52df770855b | 149 | #endif /* __ALIGN_END */ |
jhon309 | 0:c52df770855b | 150 | #ifndef __ALIGN_BEGIN |
jhon309 | 0:c52df770855b | 151 | #if defined (__CC_ARM) /* ARM Compiler */ |
jhon309 | 0:c52df770855b | 152 | #define __ALIGN_BEGIN __align(4) |
jhon309 | 0:c52df770855b | 153 | #elif defined (__ICCARM__) /* IAR Compiler */ |
jhon309 | 0:c52df770855b | 154 | #define __ALIGN_BEGIN |
jhon309 | 0:c52df770855b | 155 | #endif /* __CC_ARM */ |
jhon309 | 0:c52df770855b | 156 | #endif /* __ALIGN_BEGIN */ |
jhon309 | 0:c52df770855b | 157 | #endif /* __GNUC__ */ |
jhon309 | 0:c52df770855b | 158 | |
jhon309 | 0:c52df770855b | 159 | /** |
jhon309 | 0:c52df770855b | 160 | * @brief __NOINLINE definition |
jhon309 | 0:c52df770855b | 161 | */ |
jhon309 | 0:c52df770855b | 162 | #if defined ( __CC_ARM ) || defined ( __GNUC__ ) |
jhon309 | 0:c52df770855b | 163 | /* ARM & GNUCompiler |
jhon309 | 0:c52df770855b | 164 | ---------------- |
jhon309 | 0:c52df770855b | 165 | */ |
jhon309 | 0:c52df770855b | 166 | #define __NOINLINE __attribute__ ( (noinline) ) |
jhon309 | 0:c52df770855b | 167 | |
jhon309 | 0:c52df770855b | 168 | #elif defined ( __ICCARM__ ) |
jhon309 | 0:c52df770855b | 169 | /* ICCARM Compiler |
jhon309 | 0:c52df770855b | 170 | --------------- |
jhon309 | 0:c52df770855b | 171 | */ |
jhon309 | 0:c52df770855b | 172 | #define __NOINLINE _Pragma("optimize = no_inline") |
jhon309 | 0:c52df770855b | 173 | |
jhon309 | 0:c52df770855b | 174 | #endif |
jhon309 | 0:c52df770855b | 175 | |
jhon309 | 0:c52df770855b | 176 | #ifdef __cplusplus |
jhon309 | 0:c52df770855b | 177 | } |
jhon309 | 0:c52df770855b | 178 | #endif |
jhon309 | 0:c52df770855b | 179 | |
jhon309 | 0:c52df770855b | 180 | #endif /* ___STM32F0xx_HAL_DEF */ |
jhon309 | 0:c52df770855b | 181 | |
jhon309 | 0:c52df770855b | 182 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
jhon309 | 0:c52df770855b | 183 |