Support Complementary PWM mode
This commit is contained in:
@@ -666,6 +666,33 @@ void ACMP_Init() {
|
||||
/* Enable interrupt */
|
||||
ACMP_ENABLE_INT(ACMP01, 1);
|
||||
|
||||
}
|
||||
|
||||
int ShutdownCnt, pShutdown=-1, Shutdown = 0;
|
||||
int CHECK_SHUTDOWN() {
|
||||
|
||||
int V = ADC_GET_CONVERSION_DATA(ADC, 0);
|
||||
if(V >= SHUTDOWN_VOLT) {
|
||||
if(pShutdown != 1) {
|
||||
pShutdown = 1;
|
||||
ShutdownCnt = 0;
|
||||
}
|
||||
} else {
|
||||
if(pShutdown != 0) {
|
||||
pShutdown = 0;
|
||||
ShutdownCnt = 0;
|
||||
}
|
||||
}
|
||||
if(ShutdownCnt < SHUTDOWN_TIME) {
|
||||
if(++ShutdownCnt == SHUTDOWN_TIME) {
|
||||
if(Shutdown != pShutdown) {
|
||||
Shutdown = pShutdown;
|
||||
return Shutdown;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
|
||||
}
|
||||
/*** (C) COPYRIGHT 2016 Nuvoton Technology Corp. ***/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user