DHT11

Committer:
jhon309
Date:
Thu Aug 13 00:21:57 2015 +0000
Revision:
0:c52df770855b
DHT11

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jhon309 0:c52df770855b 1 /**
jhon309 0:c52df770855b 2 ******************************************************************************
jhon309 0:c52df770855b 3 * @file stm32f0xx.h
jhon309 0:c52df770855b 4 * @author MCD Application Team
jhon309 0:c52df770855b 5 * @version V2.2.0
jhon309 0:c52df770855b 6 * @date 05-December-2014
jhon309 0:c52df770855b 7 * @brief CMSIS STM32F0xx Device Peripheral Access Layer Header File.
jhon309 0:c52df770855b 8 *
jhon309 0:c52df770855b 9 * The file is the unique include file that the application programmer
jhon309 0:c52df770855b 10 * is using in the C source code, usually in main.c. This file contains:
jhon309 0:c52df770855b 11 * - Configuration section that allows to select:
jhon309 0:c52df770855b 12 * - The STM32F0xx device used in the target application
jhon309 0:c52df770855b 13 * - To use or not the peripheral’s drivers in application code(i.e.
jhon309 0:c52df770855b 14 * code will be based on direct access to peripheral’s registers
jhon309 0:c52df770855b 15 * rather than drivers API), this option is controlled by
jhon309 0:c52df770855b 16 * "#define USE_HAL_DRIVER"
jhon309 0:c52df770855b 17 *
jhon309 0:c52df770855b 18 ******************************************************************************
jhon309 0:c52df770855b 19 * @attention
jhon309 0:c52df770855b 20 *
jhon309 0:c52df770855b 21 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
jhon309 0:c52df770855b 22 *
jhon309 0:c52df770855b 23 * Redistribution and use in source and binary forms, with or without modification,
jhon309 0:c52df770855b 24 * are permitted provided that the following conditions are met:
jhon309 0:c52df770855b 25 * 1. Redistributions of source code must retain the above copyright notice,
jhon309 0:c52df770855b 26 * this list of conditions and the following disclaimer.
jhon309 0:c52df770855b 27 * 2. Redistributions in binary form must reproduce the above copyright notice,
jhon309 0:c52df770855b 28 * this list of conditions and the following disclaimer in the documentation
jhon309 0:c52df770855b 29 * and/or other materials provided with the distribution.
jhon309 0:c52df770855b 30 * 3. Neither the name of STMicroelectronics nor the names of its contributors
jhon309 0:c52df770855b 31 * may be used to endorse or promote products derived from this software
jhon309 0:c52df770855b 32 * without specific prior written permission.
jhon309 0:c52df770855b 33 *
jhon309 0:c52df770855b 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
jhon309 0:c52df770855b 35 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
jhon309 0:c52df770855b 36 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
jhon309 0:c52df770855b 37 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
jhon309 0:c52df770855b 38 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
jhon309 0:c52df770855b 39 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
jhon309 0:c52df770855b 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
jhon309 0:c52df770855b 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
jhon309 0:c52df770855b 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
jhon309 0:c52df770855b 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jhon309 0:c52df770855b 44 *
jhon309 0:c52df770855b 45 ******************************************************************************
jhon309 0:c52df770855b 46 */
jhon309 0:c52df770855b 47
jhon309 0:c52df770855b 48 /** @addtogroup CMSIS
jhon309 0:c52df770855b 49 * @{
jhon309 0:c52df770855b 50 */
jhon309 0:c52df770855b 51
jhon309 0:c52df770855b 52 /** @addtogroup stm32f0xx
jhon309 0:c52df770855b 53 * @{
jhon309 0:c52df770855b 54 */
jhon309 0:c52df770855b 55
jhon309 0:c52df770855b 56 #ifndef __STM32F0xx_H
jhon309 0:c52df770855b 57 #define __STM32F0xx_H
jhon309 0:c52df770855b 58
jhon309 0:c52df770855b 59 #ifdef __cplusplus
jhon309 0:c52df770855b 60 extern "C" {
jhon309 0:c52df770855b 61 #endif /* __cplusplus */
jhon309 0:c52df770855b 62
jhon309 0:c52df770855b 63 /** @addtogroup Library_configuration_section
jhon309 0:c52df770855b 64 * @{
jhon309 0:c52df770855b 65 */
jhon309 0:c52df770855b 66
jhon309 0:c52df770855b 67 /* Uncomment the line below according to the target STM32 device used in your
jhon309 0:c52df770855b 68 application
jhon309 0:c52df770855b 69 */
jhon309 0:c52df770855b 70
jhon309 0:c52df770855b 71 #if !defined (STM32F030x6) && !defined (STM32F030x8) && \
jhon309 0:c52df770855b 72 !defined (STM32F031x6) && !defined (STM32F038xx) && \
jhon309 0:c52df770855b 73 !defined (STM32F042x6) && !defined (STM32F048xx) && !defined (STM32F070x6) && \
jhon309 0:c52df770855b 74 !defined (STM32F051x8) && !defined (STM32F058xx) && \
jhon309 0:c52df770855b 75 !defined (STM32F071xB) && !defined (STM32F072xB) && !defined (STM32F078xx) && !defined (STM32F070xB) && \
jhon309 0:c52df770855b 76 !defined (STM32F091xC) && !defined (STM32F098xx) && !defined (STM32F030xC)
jhon309 0:c52df770855b 77 /* #define STM32F030x6 */ /*!< STM32F030x4, STM32F030x6 Devices (STM32F030xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
jhon309 0:c52df770855b 78 /* #define STM32F030x8 */ /*!< STM32F030x8 Devices (STM32F030xx microcontrollers where the Flash memory is 64 Kbytes) */
jhon309 0:c52df770855b 79 /* #define STM32F031x6 */ /*!< STM32F031x4, STM32F031x6 Devices (STM32F031xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
jhon309 0:c52df770855b 80 /* #define STM32F038xx */ /*!< STM32F038xx Devices (STM32F038xx microcontrollers where the Flash memory is 32 Kbytes) */
jhon309 0:c52df770855b 81 /* #define STM32F042x6 */ /*!< STM32F042x4, STM32F042x6 Devices (STM32F042xx microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
jhon309 0:c52df770855b 82 /* #define STM32F048x6 */ /*!< STM32F048xx Devices (STM32F042xx microcontrollers where the Flash memory is 32 Kbytes) */
jhon309 0:c52df770855b 83 /* #define STM32F051x8 */ /*!< STM32F051x4, STM32F051x6, STM32F051x8 Devices (STM32F051xx microcontrollers where the Flash memory ranges between 16 and 64 Kbytes) */
jhon309 0:c52df770855b 84 /* #define STM32F058xx */ /*!< STM32F058xx Devices (STM32F058xx microcontrollers where the Flash memory is 64 Kbytes) */
jhon309 0:c52df770855b 85 /* #define STM32F070x6 */ /*!< STM32F070x6 Devices (STM32F070x6 microcontrollers where the Flash memory ranges between 16 and 32 Kbytes) */
jhon309 0:c52df770855b 86 /* #define STM32F070xB */ /*!< STM32F070xB Devices (STM32F070xB microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
jhon309 0:c52df770855b 87 /* #define STM32F071xB */ /*!< STM32F071x8, STM32F071xB Devices (STM32F071xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
jhon309 0:c52df770855b 88 #define STM32F072xB /*!< STM32F072x8, STM32F072xB Devices (STM32F072xx microcontrollers where the Flash memory ranges between 64 and 128 Kbytes) */
jhon309 0:c52df770855b 89 /* #define STM32F078xx */ /*!< STM32F078xx Devices (STM32F078xx microcontrollers where the Flash memory is 128 Kbytes) */
jhon309 0:c52df770855b 90 /* #define STM32F030xC */ /*!< STM32F030xC Devices (STM32F030xC microcontrollers where the Flash memory is 256 Kbytes) */
jhon309 0:c52df770855b 91 /* #define STM32F091xC */ /*!< STM32F091xC Devices (STM32F091xx microcontrollers where the Flash memory is 256 Kbytes) */
jhon309 0:c52df770855b 92 /* #define STM32F098xx */ /*!< STM32F098xx Devices (STM32F098xx microcontrollers where the Flash memory is 256 Kbytes) */
jhon309 0:c52df770855b 93 #endif
jhon309 0:c52df770855b 94
jhon309 0:c52df770855b 95 /* Tip: To avoid modifying this file each time you need to switch between these
jhon309 0:c52df770855b 96 devices, you can define the device in your toolchain compiler preprocessor.
jhon309 0:c52df770855b 97 */
jhon309 0:c52df770855b 98 #if !defined (USE_HAL_DRIVER)
jhon309 0:c52df770855b 99 /**
jhon309 0:c52df770855b 100 * @brief Comment the line below if you will not use the peripherals drivers.
jhon309 0:c52df770855b 101 In this case, these drivers will not be included and the application code will
jhon309 0:c52df770855b 102 be based on direct access to peripherals registers
jhon309 0:c52df770855b 103 */
jhon309 0:c52df770855b 104 #define USE_HAL_DRIVER
jhon309 0:c52df770855b 105 #endif /* USE_HAL_DRIVER */
jhon309 0:c52df770855b 106
jhon309 0:c52df770855b 107 /**
jhon309 0:c52df770855b 108 * @brief CMSIS Device version number V2.2.0
jhon309 0:c52df770855b 109 */
jhon309 0:c52df770855b 110 #define __STM32F0xx_CMSIS_DEVICE_VERSION_MAIN (0x02) /*!< [31:24] main version */
jhon309 0:c52df770855b 111 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB1 (0x02) /*!< [23:16] sub1 version */
jhon309 0:c52df770855b 112 #define __STM32F0xx_CMSIS_DEVICE_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
jhon309 0:c52df770855b 113 #define __STM32F0xx_CMSIS_DEVICE_VERSION_RC (0x00) /*!< [7:0] release candidate */
jhon309 0:c52df770855b 114 #define __STM32F0xx_CMSIS_DEVICE_VERSION ((__CMSIS_DEVICE_VERSION_MAIN << 24)\
jhon309 0:c52df770855b 115 |(__CMSIS_DEVICE_HAL_VERSION_SUB1 << 16)\
jhon309 0:c52df770855b 116 |(__CMSIS_DEVICE_HAL_VERSION_SUB2 << 8 )\
jhon309 0:c52df770855b 117 |(__CMSIS_DEVICE_HAL_VERSION_RC))
jhon309 0:c52df770855b 118
jhon309 0:c52df770855b 119 /**
jhon309 0:c52df770855b 120 * @}
jhon309 0:c52df770855b 121 */
jhon309 0:c52df770855b 122
jhon309 0:c52df770855b 123 /** @addtogroup Device_Included
jhon309 0:c52df770855b 124 * @{
jhon309 0:c52df770855b 125 */
jhon309 0:c52df770855b 126
jhon309 0:c52df770855b 127 #if defined(STM32F030x6)
jhon309 0:c52df770855b 128 #include "stm32f030x6.h"
jhon309 0:c52df770855b 129 #elif defined(STM32F030x8)
jhon309 0:c52df770855b 130 #include "stm32f030x8.h"
jhon309 0:c52df770855b 131 #elif defined(STM32F031x6)
jhon309 0:c52df770855b 132 #include "stm32f031x6.h"
jhon309 0:c52df770855b 133 #elif defined(STM32F038xx)
jhon309 0:c52df770855b 134 #include "stm32f038xx.h"
jhon309 0:c52df770855b 135 #elif defined(STM32F042x6)
jhon309 0:c52df770855b 136 #include "stm32f042x6.h"
jhon309 0:c52df770855b 137 #elif defined(STM32F048xx)
jhon309 0:c52df770855b 138 #include "stm32f048xx.h"
jhon309 0:c52df770855b 139 #elif defined(STM32F051x8)
jhon309 0:c52df770855b 140 #include "stm32f051x8.h"
jhon309 0:c52df770855b 141 #elif defined(STM32F058xx)
jhon309 0:c52df770855b 142 #include "stm32f058xx.h"
jhon309 0:c52df770855b 143 #elif defined(STM32F070x6)
jhon309 0:c52df770855b 144 #include "stm32f070x6.h"
jhon309 0:c52df770855b 145 #elif defined(STM32F070xB)
jhon309 0:c52df770855b 146 #include "stm32f070xb.h"
jhon309 0:c52df770855b 147 #elif defined(STM32F071xB)
jhon309 0:c52df770855b 148 #include "stm32f071xb.h"
jhon309 0:c52df770855b 149 #elif defined(STM32F072xB)
jhon309 0:c52df770855b 150 #include "stm32f072xb.h"
jhon309 0:c52df770855b 151 #elif defined(STM32F078xx)
jhon309 0:c52df770855b 152 #include "stm32f078xx.h"
jhon309 0:c52df770855b 153 #elif defined(STM32F091xC)
jhon309 0:c52df770855b 154 #include "stm32f091xc.h"
jhon309 0:c52df770855b 155 #elif defined(STM32F098xx)
jhon309 0:c52df770855b 156 #include "stm32f098xx.h"
jhon309 0:c52df770855b 157 #elif defined(STM32F030xC)
jhon309 0:c52df770855b 158 #include "stm32f030xc.h"
jhon309 0:c52df770855b 159 #else
jhon309 0:c52df770855b 160 #error "Please select first the target STM32F0xx device used in your application (in stm32f0xx.h file)"
jhon309 0:c52df770855b 161 #endif
jhon309 0:c52df770855b 162
jhon309 0:c52df770855b 163 /**
jhon309 0:c52df770855b 164 * @}
jhon309 0:c52df770855b 165 */
jhon309 0:c52df770855b 166
jhon309 0:c52df770855b 167 /** @addtogroup Exported_types
jhon309 0:c52df770855b 168 * @{
jhon309 0:c52df770855b 169 */
jhon309 0:c52df770855b 170 typedef enum
jhon309 0:c52df770855b 171 {
jhon309 0:c52df770855b 172 RESET = 0,
jhon309 0:c52df770855b 173 SET = !RESET
jhon309 0:c52df770855b 174 } FlagStatus, ITStatus;
jhon309 0:c52df770855b 175
jhon309 0:c52df770855b 176 typedef enum
jhon309 0:c52df770855b 177 {
jhon309 0:c52df770855b 178 DISABLE = 0,
jhon309 0:c52df770855b 179 ENABLE = !DISABLE
jhon309 0:c52df770855b 180 } FunctionalState;
jhon309 0:c52df770855b 181 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
jhon309 0:c52df770855b 182
jhon309 0:c52df770855b 183 typedef enum
jhon309 0:c52df770855b 184 {
jhon309 0:c52df770855b 185 ERROR = 0,
jhon309 0:c52df770855b 186 SUCCESS = !ERROR
jhon309 0:c52df770855b 187 } ErrorStatus;
jhon309 0:c52df770855b 188
jhon309 0:c52df770855b 189 /**
jhon309 0:c52df770855b 190 * @}
jhon309 0:c52df770855b 191 */
jhon309 0:c52df770855b 192
jhon309 0:c52df770855b 193
jhon309 0:c52df770855b 194 /** @addtogroup Exported_macros
jhon309 0:c52df770855b 195 * @{
jhon309 0:c52df770855b 196 */
jhon309 0:c52df770855b 197 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
jhon309 0:c52df770855b 198
jhon309 0:c52df770855b 199 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
jhon309 0:c52df770855b 200
jhon309 0:c52df770855b 201 #define READ_BIT(REG, BIT) ((REG) & (BIT))
jhon309 0:c52df770855b 202
jhon309 0:c52df770855b 203 #define CLEAR_REG(REG) ((REG) = (0x0))
jhon309 0:c52df770855b 204
jhon309 0:c52df770855b 205 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
jhon309 0:c52df770855b 206
jhon309 0:c52df770855b 207 #define READ_REG(REG) ((REG))
jhon309 0:c52df770855b 208
jhon309 0:c52df770855b 209 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
jhon309 0:c52df770855b 210
jhon309 0:c52df770855b 211
jhon309 0:c52df770855b 212 /**
jhon309 0:c52df770855b 213 * @}
jhon309 0:c52df770855b 214 */
jhon309 0:c52df770855b 215
jhon309 0:c52df770855b 216 #if defined (USE_HAL_DRIVER)
jhon309 0:c52df770855b 217 #include "stm32f0xx_hal.h"
jhon309 0:c52df770855b 218 #endif /* USE_HAL_DRIVER */
jhon309 0:c52df770855b 219
jhon309 0:c52df770855b 220
jhon309 0:c52df770855b 221 #ifdef __cplusplus
jhon309 0:c52df770855b 222 }
jhon309 0:c52df770855b 223 #endif /* __cplusplus */
jhon309 0:c52df770855b 224
jhon309 0:c52df770855b 225 #endif /* __STM32F0xx_H */
jhon309 0:c52df770855b 226 /**
jhon309 0:c52df770855b 227 * @}
jhon309 0:c52df770855b 228 */
jhon309 0:c52df770855b 229
jhon309 0:c52df770855b 230 /**
jhon309 0:c52df770855b 231 * @}
jhon309 0:c52df770855b 232 */
jhon309 0:c52df770855b 233
jhon309 0:c52df770855b 234
jhon309 0:c52df770855b 235
jhon309 0:c52df770855b 236
jhon309 0:c52df770855b 237 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/