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