Support Complementary PWM mode

This commit is contained in:
murphy
2022-08-24 14:37:20 +08:00
parent 4a256414a2
commit dce9c6229e
40 changed files with 2080 additions and 4157 deletions
+27
View File
@@ -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. ***/