mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/stm32f10x_bkp.c@84:f54042cbc282, 2014-02-03 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Feb 03 09:30:05 2014 +0000
- Revision:
- 84:f54042cbc282
- Parent:
- 70:c1fbde68b492
Synchronized with git revision bbbd8699601c42149ccf0c37bc42bb6856ccc4c6
Full URL: https://github.com/mbedmicro/mbed/commit/bbbd8699601c42149ccf0c37bc42bb6856ccc4c6/
[NUCLEO_L152RE/F030_R8] SPI, I2C, Ticker, PWM updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 52:a51c77007319 | 1 | /** |
mbed_official | 52:a51c77007319 | 2 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 3 | * @file stm32f10x_bkp.c |
mbed_official | 52:a51c77007319 | 4 | * @author MCD Application Team |
mbed_official | 84:f54042cbc282 | 5 | * @version V3.6.1 |
mbed_official | 84:f54042cbc282 | 6 | * @date 05-March-2012 |
mbed_official | 52:a51c77007319 | 7 | * @brief This file provides all the BKP firmware functions. |
mbed_official | 70:c1fbde68b492 | 8 | ******************************************************************************* |
mbed_official | 70:c1fbde68b492 | 9 | * Copyright (c) 2014, STMicroelectronics |
mbed_official | 70:c1fbde68b492 | 10 | * All rights reserved. |
mbed_official | 70:c1fbde68b492 | 11 | * |
mbed_official | 70:c1fbde68b492 | 12 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 70:c1fbde68b492 | 13 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 70:c1fbde68b492 | 14 | * |
mbed_official | 70:c1fbde68b492 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 70:c1fbde68b492 | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 70:c1fbde68b492 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 70:c1fbde68b492 | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 70:c1fbde68b492 | 19 | * and/or other materials provided with the distribution. |
mbed_official | 70:c1fbde68b492 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 70:c1fbde68b492 | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 70:c1fbde68b492 | 22 | * without specific prior written permission. |
mbed_official | 70:c1fbde68b492 | 23 | * |
mbed_official | 70:c1fbde68b492 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 70:c1fbde68b492 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 70:c1fbde68b492 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 70:c1fbde68b492 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 70:c1fbde68b492 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 70:c1fbde68b492 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 70:c1fbde68b492 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 70:c1fbde68b492 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 70:c1fbde68b492 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 70:c1fbde68b492 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 70:c1fbde68b492 | 34 | ******************************************************************************* |
mbed_official | 70:c1fbde68b492 | 35 | */ |
mbed_official | 52:a51c77007319 | 36 | |
mbed_official | 52:a51c77007319 | 37 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 52:a51c77007319 | 38 | #include "stm32f10x_bkp.h" |
mbed_official | 52:a51c77007319 | 39 | #include "stm32f10x_rcc.h" |
mbed_official | 52:a51c77007319 | 40 | |
mbed_official | 52:a51c77007319 | 41 | /** @addtogroup STM32F10x_StdPeriph_Driver |
mbed_official | 52:a51c77007319 | 42 | * @{ |
mbed_official | 52:a51c77007319 | 43 | */ |
mbed_official | 52:a51c77007319 | 44 | |
mbed_official | 52:a51c77007319 | 45 | /** @defgroup BKP |
mbed_official | 52:a51c77007319 | 46 | * @brief BKP driver modules |
mbed_official | 52:a51c77007319 | 47 | * @{ |
mbed_official | 52:a51c77007319 | 48 | */ |
mbed_official | 52:a51c77007319 | 49 | |
mbed_official | 52:a51c77007319 | 50 | /** @defgroup BKP_Private_TypesDefinitions |
mbed_official | 52:a51c77007319 | 51 | * @{ |
mbed_official | 52:a51c77007319 | 52 | */ |
mbed_official | 52:a51c77007319 | 53 | |
mbed_official | 52:a51c77007319 | 54 | /** |
mbed_official | 52:a51c77007319 | 55 | * @} |
mbed_official | 52:a51c77007319 | 56 | */ |
mbed_official | 52:a51c77007319 | 57 | |
mbed_official | 52:a51c77007319 | 58 | /** @defgroup BKP_Private_Defines |
mbed_official | 52:a51c77007319 | 59 | * @{ |
mbed_official | 52:a51c77007319 | 60 | */ |
mbed_official | 52:a51c77007319 | 61 | |
mbed_official | 52:a51c77007319 | 62 | /* ------------ BKP registers bit address in the alias region --------------- */ |
mbed_official | 52:a51c77007319 | 63 | #define BKP_OFFSET (BKP_BASE - PERIPH_BASE) |
mbed_official | 52:a51c77007319 | 64 | |
mbed_official | 52:a51c77007319 | 65 | /* --- CR Register ----*/ |
mbed_official | 52:a51c77007319 | 66 | |
mbed_official | 52:a51c77007319 | 67 | /* Alias word address of TPAL bit */ |
mbed_official | 52:a51c77007319 | 68 | #define CR_OFFSET (BKP_OFFSET + 0x30) |
mbed_official | 52:a51c77007319 | 69 | #define TPAL_BitNumber 0x01 |
mbed_official | 52:a51c77007319 | 70 | #define CR_TPAL_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (TPAL_BitNumber * 4)) |
mbed_official | 52:a51c77007319 | 71 | |
mbed_official | 52:a51c77007319 | 72 | /* Alias word address of TPE bit */ |
mbed_official | 52:a51c77007319 | 73 | #define TPE_BitNumber 0x00 |
mbed_official | 52:a51c77007319 | 74 | #define CR_TPE_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (TPE_BitNumber * 4)) |
mbed_official | 52:a51c77007319 | 75 | |
mbed_official | 52:a51c77007319 | 76 | /* --- CSR Register ---*/ |
mbed_official | 52:a51c77007319 | 77 | |
mbed_official | 52:a51c77007319 | 78 | /* Alias word address of TPIE bit */ |
mbed_official | 52:a51c77007319 | 79 | #define CSR_OFFSET (BKP_OFFSET + 0x34) |
mbed_official | 52:a51c77007319 | 80 | #define TPIE_BitNumber 0x02 |
mbed_official | 52:a51c77007319 | 81 | #define CSR_TPIE_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TPIE_BitNumber * 4)) |
mbed_official | 52:a51c77007319 | 82 | |
mbed_official | 52:a51c77007319 | 83 | /* Alias word address of TIF bit */ |
mbed_official | 52:a51c77007319 | 84 | #define TIF_BitNumber 0x09 |
mbed_official | 52:a51c77007319 | 85 | #define CSR_TIF_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TIF_BitNumber * 4)) |
mbed_official | 52:a51c77007319 | 86 | |
mbed_official | 52:a51c77007319 | 87 | /* Alias word address of TEF bit */ |
mbed_official | 52:a51c77007319 | 88 | #define TEF_BitNumber 0x08 |
mbed_official | 52:a51c77007319 | 89 | #define CSR_TEF_BB (PERIPH_BB_BASE + (CSR_OFFSET * 32) + (TEF_BitNumber * 4)) |
mbed_official | 52:a51c77007319 | 90 | |
mbed_official | 52:a51c77007319 | 91 | /* ---------------------- BKP registers bit mask ------------------------ */ |
mbed_official | 52:a51c77007319 | 92 | |
mbed_official | 52:a51c77007319 | 93 | /* RTCCR register bit mask */ |
mbed_official | 52:a51c77007319 | 94 | #define RTCCR_CAL_MASK ((uint16_t)0xFF80) |
mbed_official | 52:a51c77007319 | 95 | #define RTCCR_MASK ((uint16_t)0xFC7F) |
mbed_official | 52:a51c77007319 | 96 | |
mbed_official | 52:a51c77007319 | 97 | /** |
mbed_official | 52:a51c77007319 | 98 | * @} |
mbed_official | 52:a51c77007319 | 99 | */ |
mbed_official | 52:a51c77007319 | 100 | |
mbed_official | 52:a51c77007319 | 101 | |
mbed_official | 52:a51c77007319 | 102 | /** @defgroup BKP_Private_Macros |
mbed_official | 52:a51c77007319 | 103 | * @{ |
mbed_official | 52:a51c77007319 | 104 | */ |
mbed_official | 52:a51c77007319 | 105 | |
mbed_official | 52:a51c77007319 | 106 | /** |
mbed_official | 52:a51c77007319 | 107 | * @} |
mbed_official | 52:a51c77007319 | 108 | */ |
mbed_official | 52:a51c77007319 | 109 | |
mbed_official | 52:a51c77007319 | 110 | /** @defgroup BKP_Private_Variables |
mbed_official | 52:a51c77007319 | 111 | * @{ |
mbed_official | 52:a51c77007319 | 112 | */ |
mbed_official | 52:a51c77007319 | 113 | |
mbed_official | 52:a51c77007319 | 114 | /** |
mbed_official | 52:a51c77007319 | 115 | * @} |
mbed_official | 52:a51c77007319 | 116 | */ |
mbed_official | 52:a51c77007319 | 117 | |
mbed_official | 52:a51c77007319 | 118 | /** @defgroup BKP_Private_FunctionPrototypes |
mbed_official | 52:a51c77007319 | 119 | * @{ |
mbed_official | 52:a51c77007319 | 120 | */ |
mbed_official | 52:a51c77007319 | 121 | |
mbed_official | 52:a51c77007319 | 122 | /** |
mbed_official | 52:a51c77007319 | 123 | * @} |
mbed_official | 52:a51c77007319 | 124 | */ |
mbed_official | 52:a51c77007319 | 125 | |
mbed_official | 52:a51c77007319 | 126 | /** @defgroup BKP_Private_Functions |
mbed_official | 52:a51c77007319 | 127 | * @{ |
mbed_official | 52:a51c77007319 | 128 | */ |
mbed_official | 52:a51c77007319 | 129 | |
mbed_official | 52:a51c77007319 | 130 | /** |
mbed_official | 52:a51c77007319 | 131 | * @brief Deinitializes the BKP peripheral registers to their default reset values. |
mbed_official | 52:a51c77007319 | 132 | * @param None |
mbed_official | 52:a51c77007319 | 133 | * @retval None |
mbed_official | 52:a51c77007319 | 134 | */ |
mbed_official | 52:a51c77007319 | 135 | void BKP_DeInit(void) |
mbed_official | 52:a51c77007319 | 136 | { |
mbed_official | 52:a51c77007319 | 137 | RCC_BackupResetCmd(ENABLE); |
mbed_official | 52:a51c77007319 | 138 | RCC_BackupResetCmd(DISABLE); |
mbed_official | 52:a51c77007319 | 139 | } |
mbed_official | 52:a51c77007319 | 140 | |
mbed_official | 52:a51c77007319 | 141 | /** |
mbed_official | 52:a51c77007319 | 142 | * @brief Configures the Tamper Pin active level. |
mbed_official | 52:a51c77007319 | 143 | * @param BKP_TamperPinLevel: specifies the Tamper Pin active level. |
mbed_official | 52:a51c77007319 | 144 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 145 | * @arg BKP_TamperPinLevel_High: Tamper pin active on high level |
mbed_official | 52:a51c77007319 | 146 | * @arg BKP_TamperPinLevel_Low: Tamper pin active on low level |
mbed_official | 52:a51c77007319 | 147 | * @retval None |
mbed_official | 52:a51c77007319 | 148 | */ |
mbed_official | 52:a51c77007319 | 149 | void BKP_TamperPinLevelConfig(uint16_t BKP_TamperPinLevel) |
mbed_official | 52:a51c77007319 | 150 | { |
mbed_official | 52:a51c77007319 | 151 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 152 | assert_param(IS_BKP_TAMPER_PIN_LEVEL(BKP_TamperPinLevel)); |
mbed_official | 52:a51c77007319 | 153 | *(__IO uint32_t *) CR_TPAL_BB = BKP_TamperPinLevel; |
mbed_official | 52:a51c77007319 | 154 | } |
mbed_official | 52:a51c77007319 | 155 | |
mbed_official | 52:a51c77007319 | 156 | /** |
mbed_official | 52:a51c77007319 | 157 | * @brief Enables or disables the Tamper Pin activation. |
mbed_official | 52:a51c77007319 | 158 | * @param NewState: new state of the Tamper Pin activation. |
mbed_official | 52:a51c77007319 | 159 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 160 | * @retval None |
mbed_official | 52:a51c77007319 | 161 | */ |
mbed_official | 52:a51c77007319 | 162 | void BKP_TamperPinCmd(FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 163 | { |
mbed_official | 52:a51c77007319 | 164 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 165 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 166 | *(__IO uint32_t *) CR_TPE_BB = (uint32_t)NewState; |
mbed_official | 52:a51c77007319 | 167 | } |
mbed_official | 52:a51c77007319 | 168 | |
mbed_official | 52:a51c77007319 | 169 | /** |
mbed_official | 52:a51c77007319 | 170 | * @brief Enables or disables the Tamper Pin Interrupt. |
mbed_official | 52:a51c77007319 | 171 | * @param NewState: new state of the Tamper Pin Interrupt. |
mbed_official | 52:a51c77007319 | 172 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 173 | * @retval None |
mbed_official | 52:a51c77007319 | 174 | */ |
mbed_official | 52:a51c77007319 | 175 | void BKP_ITConfig(FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 176 | { |
mbed_official | 52:a51c77007319 | 177 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 178 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 179 | *(__IO uint32_t *) CSR_TPIE_BB = (uint32_t)NewState; |
mbed_official | 52:a51c77007319 | 180 | } |
mbed_official | 52:a51c77007319 | 181 | |
mbed_official | 52:a51c77007319 | 182 | /** |
mbed_official | 52:a51c77007319 | 183 | * @brief Select the RTC output source to output on the Tamper pin. |
mbed_official | 52:a51c77007319 | 184 | * @param BKP_RTCOutputSource: specifies the RTC output source. |
mbed_official | 52:a51c77007319 | 185 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 186 | * @arg BKP_RTCOutputSource_None: no RTC output on the Tamper pin. |
mbed_official | 52:a51c77007319 | 187 | * @arg BKP_RTCOutputSource_CalibClock: output the RTC clock with frequency |
mbed_official | 52:a51c77007319 | 188 | * divided by 64 on the Tamper pin. |
mbed_official | 52:a51c77007319 | 189 | * @arg BKP_RTCOutputSource_Alarm: output the RTC Alarm pulse signal on |
mbed_official | 52:a51c77007319 | 190 | * the Tamper pin. |
mbed_official | 52:a51c77007319 | 191 | * @arg BKP_RTCOutputSource_Second: output the RTC Second pulse signal on |
mbed_official | 52:a51c77007319 | 192 | * the Tamper pin. |
mbed_official | 52:a51c77007319 | 193 | * @retval None |
mbed_official | 52:a51c77007319 | 194 | */ |
mbed_official | 52:a51c77007319 | 195 | void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource) |
mbed_official | 52:a51c77007319 | 196 | { |
mbed_official | 52:a51c77007319 | 197 | uint16_t tmpreg = 0; |
mbed_official | 52:a51c77007319 | 198 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 199 | assert_param(IS_BKP_RTC_OUTPUT_SOURCE(BKP_RTCOutputSource)); |
mbed_official | 52:a51c77007319 | 200 | tmpreg = BKP->RTCCR; |
mbed_official | 52:a51c77007319 | 201 | /* Clear CCO, ASOE and ASOS bits */ |
mbed_official | 52:a51c77007319 | 202 | tmpreg &= RTCCR_MASK; |
mbed_official | 52:a51c77007319 | 203 | |
mbed_official | 52:a51c77007319 | 204 | /* Set CCO, ASOE and ASOS bits according to BKP_RTCOutputSource value */ |
mbed_official | 52:a51c77007319 | 205 | tmpreg |= BKP_RTCOutputSource; |
mbed_official | 52:a51c77007319 | 206 | /* Store the new value */ |
mbed_official | 52:a51c77007319 | 207 | BKP->RTCCR = tmpreg; |
mbed_official | 52:a51c77007319 | 208 | } |
mbed_official | 52:a51c77007319 | 209 | |
mbed_official | 52:a51c77007319 | 210 | /** |
mbed_official | 52:a51c77007319 | 211 | * @brief Sets RTC Clock Calibration value. |
mbed_official | 52:a51c77007319 | 212 | * @param CalibrationValue: specifies the RTC Clock Calibration value. |
mbed_official | 52:a51c77007319 | 213 | * This parameter must be a number between 0 and 0x7F. |
mbed_official | 52:a51c77007319 | 214 | * @retval None |
mbed_official | 52:a51c77007319 | 215 | */ |
mbed_official | 52:a51c77007319 | 216 | void BKP_SetRTCCalibrationValue(uint8_t CalibrationValue) |
mbed_official | 52:a51c77007319 | 217 | { |
mbed_official | 52:a51c77007319 | 218 | uint16_t tmpreg = 0; |
mbed_official | 52:a51c77007319 | 219 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 220 | assert_param(IS_BKP_CALIBRATION_VALUE(CalibrationValue)); |
mbed_official | 52:a51c77007319 | 221 | tmpreg = BKP->RTCCR; |
mbed_official | 52:a51c77007319 | 222 | /* Clear CAL[6:0] bits */ |
mbed_official | 52:a51c77007319 | 223 | tmpreg &= RTCCR_CAL_MASK; |
mbed_official | 52:a51c77007319 | 224 | /* Set CAL[6:0] bits according to CalibrationValue value */ |
mbed_official | 52:a51c77007319 | 225 | tmpreg |= CalibrationValue; |
mbed_official | 52:a51c77007319 | 226 | /* Store the new value */ |
mbed_official | 52:a51c77007319 | 227 | BKP->RTCCR = tmpreg; |
mbed_official | 52:a51c77007319 | 228 | } |
mbed_official | 52:a51c77007319 | 229 | |
mbed_official | 52:a51c77007319 | 230 | /** |
mbed_official | 52:a51c77007319 | 231 | * @brief Writes user data to the specified Data Backup Register. |
mbed_official | 52:a51c77007319 | 232 | * @param BKP_DR: specifies the Data Backup Register. |
mbed_official | 52:a51c77007319 | 233 | * This parameter can be BKP_DRx where x:[1, 42] |
mbed_official | 52:a51c77007319 | 234 | * @param Data: data to write |
mbed_official | 52:a51c77007319 | 235 | * @retval None |
mbed_official | 52:a51c77007319 | 236 | */ |
mbed_official | 52:a51c77007319 | 237 | void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data) |
mbed_official | 52:a51c77007319 | 238 | { |
mbed_official | 52:a51c77007319 | 239 | __IO uint32_t tmp = 0; |
mbed_official | 52:a51c77007319 | 240 | |
mbed_official | 52:a51c77007319 | 241 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 242 | assert_param(IS_BKP_DR(BKP_DR)); |
mbed_official | 52:a51c77007319 | 243 | |
mbed_official | 52:a51c77007319 | 244 | tmp = (uint32_t)BKP_BASE; |
mbed_official | 52:a51c77007319 | 245 | tmp += BKP_DR; |
mbed_official | 52:a51c77007319 | 246 | |
mbed_official | 52:a51c77007319 | 247 | *(__IO uint32_t *) tmp = Data; |
mbed_official | 52:a51c77007319 | 248 | } |
mbed_official | 52:a51c77007319 | 249 | |
mbed_official | 52:a51c77007319 | 250 | /** |
mbed_official | 52:a51c77007319 | 251 | * @brief Reads data from the specified Data Backup Register. |
mbed_official | 52:a51c77007319 | 252 | * @param BKP_DR: specifies the Data Backup Register. |
mbed_official | 52:a51c77007319 | 253 | * This parameter can be BKP_DRx where x:[1, 42] |
mbed_official | 52:a51c77007319 | 254 | * @retval The content of the specified Data Backup Register |
mbed_official | 52:a51c77007319 | 255 | */ |
mbed_official | 52:a51c77007319 | 256 | uint16_t BKP_ReadBackupRegister(uint16_t BKP_DR) |
mbed_official | 52:a51c77007319 | 257 | { |
mbed_official | 52:a51c77007319 | 258 | __IO uint32_t tmp = 0; |
mbed_official | 52:a51c77007319 | 259 | |
mbed_official | 52:a51c77007319 | 260 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 261 | assert_param(IS_BKP_DR(BKP_DR)); |
mbed_official | 52:a51c77007319 | 262 | |
mbed_official | 52:a51c77007319 | 263 | tmp = (uint32_t)BKP_BASE; |
mbed_official | 52:a51c77007319 | 264 | tmp += BKP_DR; |
mbed_official | 52:a51c77007319 | 265 | |
mbed_official | 52:a51c77007319 | 266 | return (*(__IO uint16_t *) tmp); |
mbed_official | 52:a51c77007319 | 267 | } |
mbed_official | 52:a51c77007319 | 268 | |
mbed_official | 52:a51c77007319 | 269 | /** |
mbed_official | 52:a51c77007319 | 270 | * @brief Checks whether the Tamper Pin Event flag is set or not. |
mbed_official | 52:a51c77007319 | 271 | * @param None |
mbed_official | 52:a51c77007319 | 272 | * @retval The new state of the Tamper Pin Event flag (SET or RESET). |
mbed_official | 52:a51c77007319 | 273 | */ |
mbed_official | 52:a51c77007319 | 274 | FlagStatus BKP_GetFlagStatus(void) |
mbed_official | 52:a51c77007319 | 275 | { |
mbed_official | 52:a51c77007319 | 276 | return (FlagStatus)(*(__IO uint32_t *) CSR_TEF_BB); |
mbed_official | 52:a51c77007319 | 277 | } |
mbed_official | 52:a51c77007319 | 278 | |
mbed_official | 52:a51c77007319 | 279 | /** |
mbed_official | 52:a51c77007319 | 280 | * @brief Clears Tamper Pin Event pending flag. |
mbed_official | 52:a51c77007319 | 281 | * @param None |
mbed_official | 52:a51c77007319 | 282 | * @retval None |
mbed_official | 52:a51c77007319 | 283 | */ |
mbed_official | 52:a51c77007319 | 284 | void BKP_ClearFlag(void) |
mbed_official | 52:a51c77007319 | 285 | { |
mbed_official | 52:a51c77007319 | 286 | /* Set CTE bit to clear Tamper Pin Event flag */ |
mbed_official | 52:a51c77007319 | 287 | BKP->CSR |= BKP_CSR_CTE; |
mbed_official | 52:a51c77007319 | 288 | } |
mbed_official | 52:a51c77007319 | 289 | |
mbed_official | 52:a51c77007319 | 290 | /** |
mbed_official | 52:a51c77007319 | 291 | * @brief Checks whether the Tamper Pin Interrupt has occurred or not. |
mbed_official | 52:a51c77007319 | 292 | * @param None |
mbed_official | 52:a51c77007319 | 293 | * @retval The new state of the Tamper Pin Interrupt (SET or RESET). |
mbed_official | 52:a51c77007319 | 294 | */ |
mbed_official | 52:a51c77007319 | 295 | ITStatus BKP_GetITStatus(void) |
mbed_official | 52:a51c77007319 | 296 | { |
mbed_official | 52:a51c77007319 | 297 | return (ITStatus)(*(__IO uint32_t *) CSR_TIF_BB); |
mbed_official | 52:a51c77007319 | 298 | } |
mbed_official | 52:a51c77007319 | 299 | |
mbed_official | 52:a51c77007319 | 300 | /** |
mbed_official | 52:a51c77007319 | 301 | * @brief Clears Tamper Pin Interrupt pending bit. |
mbed_official | 52:a51c77007319 | 302 | * @param None |
mbed_official | 52:a51c77007319 | 303 | * @retval None |
mbed_official | 52:a51c77007319 | 304 | */ |
mbed_official | 52:a51c77007319 | 305 | void BKP_ClearITPendingBit(void) |
mbed_official | 52:a51c77007319 | 306 | { |
mbed_official | 52:a51c77007319 | 307 | /* Set CTI bit to clear Tamper Pin Interrupt pending bit */ |
mbed_official | 52:a51c77007319 | 308 | BKP->CSR |= BKP_CSR_CTI; |
mbed_official | 52:a51c77007319 | 309 | } |
mbed_official | 52:a51c77007319 | 310 | |
mbed_official | 52:a51c77007319 | 311 | /** |
mbed_official | 52:a51c77007319 | 312 | * @} |
mbed_official | 52:a51c77007319 | 313 | */ |
mbed_official | 52:a51c77007319 | 314 | |
mbed_official | 52:a51c77007319 | 315 | /** |
mbed_official | 52:a51c77007319 | 316 | * @} |
mbed_official | 52:a51c77007319 | 317 | */ |
mbed_official | 52:a51c77007319 | 318 | |
mbed_official | 52:a51c77007319 | 319 | /** |
mbed_official | 52:a51c77007319 | 320 | * @} |
mbed_official | 52:a51c77007319 | 321 | */ |
mbed_official | 52:a51c77007319 | 322 | |
mbed_official | 84:f54042cbc282 | 323 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |