1 /** 2 ****************************************************************************** 3 * @file tae32f53xx_ll_lvdctrl.c 4 * @author MCD Application Team 5 * @brief LVDCTRL LL Module Driver. 6 * 7 ****************************************************************************** 8 * @attention 9 * 10 * <h2><center>© Copyright (c) 2020 Tai-Action. 11 * All rights reserved.</center></h2> 12 * 13 * This software is licensed by Tai-Action under BSD 3-Clause license, 14 * the "License"; You may not use this file except in compliance with the 15 * License. You may obtain a copy of the License at: 16 * opensource.org/licenses/BSD-3-Clause 17 * 18 ****************************************************************************** 19 */ 20 21 /* Includes ------------------------------------------------------------------*/ 22 #include "tae32f53xx_ll.h" 23 24 25 #define DBG_TAG "LVD" 26 #define DBG_LVL DBG_ERROR 27 #include "dbg/tae32f53xx_dbg.h" 28 29 30 /** @addtogroup TAE32F53xx_LL_Driver 31 * @{ 32 */ 33 34 /** @defgroup LVDCTRL_LL LVDCTRL LL 35 * @brief LVDCTRL LL Module Driver 36 * @{ 37 */ 38 39 #ifdef LL_LVD_MODULE_ENABLED 40 41 /* Private typedef -----------------------------------------------------------*/ 42 /* Private define ------------------------------------------------------------*/ 43 /* Private macro -------------------------------------------------------------*/ 44 /* Private variables ---------------------------------------------------------*/ 45 /* Private function prototypes -----------------------------------------------*/ 46 /* Exported functions --------------------------------------------------------*/ 47 /** @defgroup LVDCTRL_LL_Exported_Functions LVDCTRL LL Exported Functions 48 * @brief LVDCTRL LL Exported Functions 49 * @{ 50 */ 51 52 /** @defgroup LVDCTRL_LL_Exported_Functions_Group1 Initialization and de-initialization functions 53 * @brief Initialization and de-initialization functions 54 * @{ 55 */ 56 57 /** 58 * @brief Initializes the LVD peripheral 59 * @param Instance Specifies LVD peripheral 60 * @return Status of the Initialization 61 */ LL_LVD_Init(LVD_TypeDef * Instance)62LL_StatusETypeDef LL_LVD_Init(LVD_TypeDef *Instance) 63 { 64 /* Init the low level hardware eg. Clock, NVIC */ 65 LL_LVD_MspInit(Instance); 66 67 //Enable LVD Module according to need 68 __LL_LVDCTRL_VCC_LowVolDet_En(Instance); 69 __LL_LVDCTRL_AVCC_LowVolDet_En(Instance); 70 __LL_LVDCTRL_VDD_OverCurDet_En(Instance); 71 __LL_LVDCTRL_VDD_LowVolDet_En(Instance); 72 73 return LL_OK; 74 } 75 76 /** 77 * @brief DeInitializes the LVD peripheral 78 * @param Instance Specifies LVD peripheral 79 * @return Status of the DeInitialization 80 */ LL_LVD_DeInit(LVD_TypeDef * Instance)81LL_StatusETypeDef LL_LVD_DeInit(LVD_TypeDef *Instance) 82 { 83 /* DeInit the low level hardware eg. Clock, NVIC */ 84 LL_LVD_MspDeInit(Instance); 85 86 //Disable LVD Module according to need 87 __LL_LVDCTRL_VCC_LowVolDet_Dis(Instance); 88 __LL_LVDCTRL_AVCC_LowVolDet_Dis(Instance); 89 __LL_LVDCTRL_VDD_OverCurDet_Dis(Instance); 90 __LL_LVDCTRL_VDD_LowVolDet_Dis(Instance); 91 92 return LL_OK; 93 } 94 95 /** 96 * @brief Initializes the LVD MSP 97 * @param Instance Specifies LVD peripheral 98 * @retval None 99 */ LL_LVD_MspInit(LVD_TypeDef * Instance)100__WEAK void LL_LVD_MspInit(LVD_TypeDef *Instance) 101 { 102 /* Prevent unused argument(s) compilation warning */ 103 LL_UNUSED(Instance); 104 /* NOTE: This function should not be modified, when the callback is needed, 105 the LL_LVD_MspInit could be implemented in the user file 106 */ 107 } 108 109 /** 110 * @brief DeInitializes the LVD MSP 111 * @param Instance Specifies LVD peripheral 112 * @retval None 113 */ LL_LVD_MspDeInit(LVD_TypeDef * Instance)114__WEAK void LL_LVD_MspDeInit(LVD_TypeDef *Instance) 115 { 116 /* Prevent unused argument(s) compilation warning */ 117 LL_UNUSED(Instance); 118 /* NOTE: This function should not be modified, when the callback is needed, 119 the LL_LVD_MspDeInit could be implemented in the user file 120 */ 121 } 122 /** 123 * @} 124 */ 125 126 127 /** @defgroup LVDCTRL_LL_Exported_Functions_Interrupt LVDCTRL Interrupt Management 128 * @brief LVDCTRL Interrupt Management 129 * @{ 130 */ 131 132 /** 133 * @brief LL LVDCTRL IRQ Handler 134 * @param Instance Specifies LVD peripheral 135 * @retval None 136 */ LL_LVD_CtrlIRQHandler(LVD_TypeDef * Instance)137void LL_LVD_CtrlIRQHandler(LVD_TypeDef *Instance) 138 { 139 if (__LL_LVDCTRL_IsVDDOverCur(Instance)) { 140 LOG_D("VDD Over Current INT.\n"); 141 //:TODO: add process code according to need 142 } 143 144 if (__LL_LVDCTRL_IsVDDLowVol(Instance)) { 145 LOG_D("VDD Low Voltage INT.\n"); 146 //:TODO: add process code according to need 147 } 148 149 if (__LL_LVDCTRL_IsVCCLowVol(Instance)) { 150 LOG_D("VCC Low Voltage INT.\n"); 151 //:TODO: add process code according to need 152 } 153 154 if (__LL_LVDCTRL_IsAVCCLowVol(Instance)) { 155 LOG_D("AVCC Low Voltage INT.\n"); 156 //:TODO: add process code according to need 157 } 158 } 159 160 /** 161 * @} 162 */ 163 164 /** 165 * @} 166 */ 167 168 169 /* Private functions ---------------------------------------------------------*/ 170 171 172 #endif /* LL_LVD_MODULE_ENABLED */ 173 174 175 /** 176 * @} 177 */ 178 179 /** 180 * @} 181 */ 182 183 184 /************************* (C) COPYRIGHT Tai-Action *****END OF FILE***********/ 185 186