31#define COUNT_DOWN false
32#define EDGE_TRIGGERED true
33#define LEVEL_TRIGGERED false
35hw_timer_t* timer0 = NULL;
37portMUX_TYPE timerMux0 = portMUX_INITIALIZER_UNLOCKED;
44unsigned int u16CountDown0 = 0;
45unsigned int u16CountDown1 = 0;
46unsigned int u16CountDown2 = 0;
47unsigned int u16CountDown3 = 0;
48unsigned int u16CountDown4 = 0;
50void TickService0(
void)
52 if (u16CountDown0) u16CountDown0--;
53 if (u16CountDown1) u16CountDown1--;
54 if (u16CountDown2) u16CountDown2--;
55 if (u16CountDown3) u16CountDown3--;
56 if (u16CountDown4) u16CountDown4--;
59void IRAM_ATTR onTimer0() {
60 portENTER_CRITICAL_ISR(&timerMux0);
62 portEXIT_CRITICAL_ISR(&timerMux0);
67 timer0 = timerBegin(0, PRESCALE0, COUNT_UP);
68 timerAttachInterrupt(timer0, &onTimer0, EDGE_TRIGGERED);
69 timerAlarmWrite(timer0, 1000,
true);
72 timerAlarmEnable(timer0);
85 if (millis() > 10000) {