Quote:
Originally Posted by nickdigger
Did you have to do any debouncing-type of trick for this? I tried switching to the CHANGE trigger, and wondered if it failed because the level hadn't yet fully risen to "high" when the int fired.
|
Nope. All I had to do was to be able to read pin D, and act on it.
Code:
uint8_t injDir = (PIND ^ injDirection) & (1 << PIND2);
if (injDir) { // handle fuel injector opening event
...
} else { // handle fuel injector closing event
...
}
injDirection is a volatile uint8_t which is set to either 0x00 or 0xFF, depending on the state of the injector edge trigger flag parameter.
Quote:
Originally Posted by nickdigger
I think the space savings was only about 80 bytes, by combining the interrupts, but potentially the free pin could be more valuable.
|
Indeed. Every little bit helps, and that interrupt pin is now freed up for other things.