I've been doing some testing with the driver, trying to optimize it, and noticed that when using Digital pin 8 as the interrupt some weird stuff happens, but the board still functions properly. zg_process_isr() seems to continually run because of this code
- Code: Select all
#ifdef USE_DIG8_INTR
// PCINT0 supports only edge triggered INT
if (PORTB & 0x01) {
intr_occured = 0;
ZG2100_ISR_ENABLE();
}else {
intr_occured = 1;
}
#else
intr_occured = 0;
ZG2100_ISR_ENABLE();
#endif
So I threw some print statements in there and saw that 'if (PORTB & 0x01)' is NEVER true, so intr_occured is always 1 which makes zg_process_isr() continually run ( from drv_process() ).
Now, this doesn't hurt the functionality of the chip, I just thought maybe it was overlooked, or maybe I'm just imagining things

It appears the interrupt pin on the Zg2100 is normally high, pulled low when an interrupt occurs ( based on attachInterrupt(0, zg_isr, LOW); ). Since Dig8 uses a pin change interrupt, the interrupt is fired when the pin transitions from HIGH to LOW, then again from LOW to HIGH. So...if Dig8 is normally HIGH, the ISR executes when its being pulled to LOW, meaning that 'if (PORTB & 0x01)', or 'is Dig8 HIGH', never equates to TRUE. Can this be correct??? Shouldn't it be something like
- Code: Select all
if(PORTB & ~(0x01))
Sorry if I'm not making sense...
To sum up: either change it to 'if(PORTB & ~(0x01))' or just remove it?
---Jared