diff options
author | David Crocker <dcrocker@eschertech.com> | 2020-08-13 16:49:09 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2020-08-13 16:49:09 +0300 |
commit | bf11b011723aac6c189e29a59fe95e42a1103bad (patch) | |
tree | 0f01e9167086f05a634adc1db1cb7595b6e63fa3 /src/DuetNG | |
parent | f6090a8eb8af044980fa86a2eda8e90a2e3a0538 (diff) |
Use 0.5ms debouncing when allowing SX1509B inputs to generate interrupts
Diffstat (limited to 'src/DuetNG')
-rw-r--r-- | src/DuetNG/SX1509.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/DuetNG/SX1509.cpp b/src/DuetNG/SX1509.cpp index 862dc568..3b725909 100644 --- a/src/DuetNG/SX1509.cpp +++ b/src/DuetNG/SX1509.cpp @@ -54,6 +54,7 @@ bool SX1509::begin(uint8_t address) noexcept { clock(DefaultOscDivider); writeWord(REG_HIGH_INPUT_B, 0xFFFF); // set all inputs to be 5V-tolerant + writeByte(REG_DEBOUNCE_CONFIG, 0); // debounce time set to minimum (0.5ms) } return ok; @@ -287,6 +288,7 @@ void SX1509::enableInterruptMultiple(uint16_t pins, uint8_t riseFall) noexcept writeDword(REG_SENSE_HIGH_B, pinMask); clearBitsInWord(REG_INTERRUPT_MASK_B, pins); + setBitsInWord(REG_DEBOUNCE_ENABLE_B, pins); // always use debouncing on pins with interrupts enabled, to avoid an excessive interrupt rate } uint16_t SX1509::interruptSource() noexcept |