Fix debouncing code to work on pins 0-7 in addition to pins 8-15

pull/18/head
Jesse Vincent 10 years ago
parent 6666ec7f24
commit db7f0993a1

@ -371,10 +371,16 @@ void sx1509Class::debounceConfig(byte configValue)
void sx1509Class::debounceEnable(byte pin) void sx1509Class::debounceEnable(byte pin)
{ {
if (pin<8) {
unsigned int debounceEnable = readWord(REG_DEBOUNCE_ENABLE_A);
debounceEnable |= (1<<pin);
writeWord(REG_DEBOUNCE_ENABLE_A, debounceEnable);
} else {
unsigned int debounceEnable = readWord(REG_DEBOUNCE_ENABLE_B); unsigned int debounceEnable = readWord(REG_DEBOUNCE_ENABLE_B);
debounceEnable |= (1<<pin); debounceEnable |= (1<<pin);
writeWord(REG_DEBOUNCE_ENABLE_B, debounceEnable); writeWord(REG_DEBOUNCE_ENABLE_B, debounceEnable);
} }
}
void sx1509Class::enableInterrupt(byte pin, byte riseFall) void sx1509Class::enableInterrupt(byte pin, byte riseFall)
{ {

Loading…
Cancel
Save