📄 drvsys.c
字号:
/* User can check the status of Register Write-Protection Function */
/* with DrvSYS_IsProtectedRegLocked(). */
/*---------------------------------------------------------------------------------------------------------*/
void DrvSYS_DisableBODLowPowerMode(void)
{
SYS->BODCR.BOD_LPM = 0;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: DrvSYS_GetBODState */
/* */
/* Parameters: */
/* None */
/* */
/* Returns: */
/* BOD output status 1: the detected voltage is lower than BOD threshold voltage */
/* 0: the detected voltage is higher than BOD threshold voltage */
/* */
/* Description: */
/* Get Brown-Out Detector state */
/*---------------------------------------------------------------------------------------------------------*/
uint32_t DrvSYS_GetBODState(void)
{
return SYS->BODCR.BOD_OUT;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: DrvSYS_EnableLowVoltReset */
/* */
/* Parameters: */
/* None */
/* */
/* Returns: */
/* None */
/* */
/* Description: */
/* Enable low voltage reset function */
/* */
/* Note: */
/* Please make sure that Register Write-Protection Function has been disabled before using */
/* this function to enable low voltage reset. */
/* User can check the status of Register Write-Protection Function */
/* with DrvSYS_IsProtectedRegLocked(). */
/*---------------------------------------------------------------------------------------------------------*/
void DrvSYS_EnableLowVoltReset(void)
{
SYS->BODCR.LVR_EN = 1;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: DrvSYS_DisableLowVoltReset */
/* */
/* Parameters: */
/* None */
/* */
/* Returns: */
/* None */
/* */
/* Description: */
/* Disable low voltage reset function */
/* */
/* Note: */
/* Please make sure that Register Write-Protection Function has been disabled before using */
/* this function to disable low voltage reset. */
/* User can check the status of Register Write-Protection Function */
/* with DrvSYS_IsProtectedRegLocked(). */
/*---------------------------------------------------------------------------------------------------------*/
void DrvSYS_DisableLowVoltReset(void)
{
SYS->BODCR.LVR_EN = 0;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: DrvSYS_EnableTemperatureSensor */
/* */
/* Parameters: */
/* None */
/* */
/* Returns: */
/* None */
/* */
/* Description: */
/* Enable Temperature Sensor */
/*---------------------------------------------------------------------------------------------------------*/
void DrvSYS_EnableTemperatureSensor(void)
{
SYS->TEMPCR.VTEMP_EN = 1;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: DrvSYS_DisableTemperatureSensor */
/* */
/* Parameters: */
/* None */
/* */
/* Returns: */
/* None */
/* */
/* Description: */
/* Disable Temperature Sensor */
/*---------------------------------------------------------------------------------------------------------*/
void DrvSYS_DisableTemperatureSensor(void)
{
SYS->TEMPCR.VTEMP_EN = 0;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: DrvSYS_EnablePOR */
/* */
/* Parameters: */
/* None */
/* */
/* Returns: */
/* None */
/* */
/* Description: */
/* Enable power on reset (POR) control */
/* */
/* Note: */
/* Please make sure that Register Write-Protection Function has been disabled before using */
/* this function to enable POR control. */
/* User can check the status of Register Write-Protection Function */
/* with DrvSYS_IsProtectedRegLocked(). */
/*---------------------------------------------------------------------------------------------------------*/
void DrvSYS_EnablePOR(void)
{
SYS->PORCR = 0;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: DrvSYS_DisablePOR */
/* */
/* Parameters: */
/* None */
/* */
/* Returns: */
/* None */
/* */
/* Description: */
/* Disable power on reset (POR) control */
/* */
/* Note: */
/* Please make sure that Register Write-Protection Function has been disabled before using */
/* this function to disable POR control. */
/* User can check the status of Register Write-Protection Function */
/* with DrvSYS_IsProtectedRegLocked(). */
/*---------------------------------------------------------------------------------------------------------*/
void DrvSYS_DisablePOR(void)
{
SYS->PORCR = 0x5AA5;
}
/*---------------------------------------------------------------------------------------------------------*/
/* Function: <BOD_IRQHandler> */
/* */
/* Parameter: */
/* None */
/* Returns: */
/* None */
/* Side effects: */
/* */
/* Description: */
/* ISR to handle BOD interrupt event */
/*---------------------------------------------------------------------------------------------------------*/
void BOD_IRQHandler(void)
{
SYS->BODCR.BOD_INTF = 1;
if (BOD_callbackFn != NULL)
BOD_callbackFn();
}
/*---------------------------------------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -