mirror of
https://github.com/joeycastillo/second-movement.git
synced 2026-02-05 07:05:38 +00:00
enable filtering on button inputs
This commit is contained in:
2
gossamer
2
gossamer
Submodule gossamer updated: a82c20e780...16e66f04b3
@ -719,7 +719,7 @@ void app_setup(void) {
|
||||
lis2dw_configure_int1(LIS2DW_CTRL4_INT1_6D);
|
||||
HAL_GPIO_A3_in();
|
||||
HAL_GPIO_A3_pmuxen(HAL_GPIO_PMUX_EIC);
|
||||
eic_configure_pin(HAL_GPIO_A3_pin(), INTERRUPT_TRIGGER_RISING);
|
||||
eic_configure_pin(HAL_GPIO_A3_pin(), INTERRUPT_TRIGGER_RISING, false);
|
||||
// but rather than hooking it up to an interrupt callback, we'll have it trigger an event.
|
||||
eic_enable_event(HAL_GPIO_A3_pin());
|
||||
|
||||
|
||||
@ -43,14 +43,16 @@ void watch_disable_external_interrupts(void) {
|
||||
|
||||
void watch_register_interrupt_callback(const uint8_t pin, watch_cb_t callback, eic_interrupt_trigger_t trigger) {
|
||||
watch_enable_digital_input(pin);
|
||||
bool filten = false;
|
||||
|
||||
// check if this is a button pin
|
||||
if (pin == HAL_GPIO_BTN_LIGHT_pin() || pin == HAL_GPIO_BTN_MODE_pin() || pin == HAL_GPIO_BTN_ALARM_pin()) {
|
||||
// if so, enable the pull-down resistor
|
||||
watch_enable_pull_down(pin);
|
||||
filten = true;
|
||||
}
|
||||
|
||||
int8_t channel = eic_configure_pin(pin, trigger);
|
||||
int8_t channel = eic_configure_pin(pin, trigger, filten);
|
||||
if (channel >= 0 && channel < 16) {
|
||||
printf("Configured port %d pin %d on channel %d\n", pin >> 5, pin & 0x1F, channel);
|
||||
eic_enable_interrupt(pin);
|
||||
|
||||
Reference in New Issue
Block a user