Add Trace
This commit is contained in:
parent
ed5c02f142
commit
b30bcb6674
12
HIB.cpp
12
HIB.cpp
@ -34,18 +34,25 @@ static void (*ISRList[MAX_PIN+1])() = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void __timerCallback(void *data) {
|
void __timerCallback(void *data) {
|
||||||
|
Serial.printf("%s\n", __func__);
|
||||||
HIB *hib = static_cast<HIB *>(data);
|
HIB *hib = static_cast<HIB *>(data);
|
||||||
hib->debouncing = false;
|
hib->debouncing = false;
|
||||||
hib->invertState();
|
hib->invertState();
|
||||||
|
Serial.printf("New State %d \n", hib->state);
|
||||||
if (hib->state != digitalRead(hib->pin)){
|
if (hib->state != digitalRead(hib->pin)){
|
||||||
hib->state = !hib->state;
|
hib->state = !hib->state;
|
||||||
|
Serial.printf("%s. Debounce failed\n", __func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(hib->state != hib->initialState)
|
if(hib->state != hib->initialState){
|
||||||
|
Serial.printf("Button Pressed\n");
|
||||||
hib->onInternalButtonPressed();
|
hib->onInternalButtonPressed();
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
|
Serial.printf("Button Released\n");
|
||||||
hib->onInternalButtonReleased();
|
hib->onInternalButtonReleased();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
HIB::HIB(uint8_t p, uint8_t initState,
|
HIB::HIB(uint8_t p, uint8_t initState,
|
||||||
@ -68,6 +75,7 @@ HIB::HIB(uint8_t p, uint8_t initState,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HIB::IRQ_handler(){
|
void HIB::IRQ_handler(){
|
||||||
|
Serial.printf("IRQ_handler on pin %d, debouncing %d\n", pin, debouncing);
|
||||||
if(!debouncing){
|
if(!debouncing){
|
||||||
debouncing = true;
|
debouncing = true;
|
||||||
os_timer_arm(&timer, shortPressMsec, 0);
|
os_timer_arm(&timer, shortPressMsec, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user