enable filtering on button inputs
This commit is contained in:
parent
5059582e96
commit
956b8601f6
2
gossamer
2
gossamer
@ -1 +1 @@
|
|||||||
Subproject commit a82c20e78049a477236f795506c73f7c9d210394
|
Subproject commit 16e66f04b31d49f1f5fc67aeff5d61e9bdbbe5ca
|
||||||
@ -719,7 +719,7 @@ void app_setup(void) {
|
|||||||
lis2dw_configure_int1(LIS2DW_CTRL4_INT1_6D);
|
lis2dw_configure_int1(LIS2DW_CTRL4_INT1_6D);
|
||||||
HAL_GPIO_A3_in();
|
HAL_GPIO_A3_in();
|
||||||
HAL_GPIO_A3_pmuxen(HAL_GPIO_PMUX_EIC);
|
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.
|
// but rather than hooking it up to an interrupt callback, we'll have it trigger an event.
|
||||||
eic_enable_event(HAL_GPIO_A3_pin());
|
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) {
|
void watch_register_interrupt_callback(const uint8_t pin, watch_cb_t callback, eic_interrupt_trigger_t trigger) {
|
||||||
watch_enable_digital_input(pin);
|
watch_enable_digital_input(pin);
|
||||||
|
bool filten = false;
|
||||||
|
|
||||||
// check if this is a button pin
|
// 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 (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
|
// if so, enable the pull-down resistor
|
||||||
watch_enable_pull_down(pin);
|
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) {
|
if (channel >= 0 && channel < 16) {
|
||||||
printf("Configured port %d pin %d on channel %d\n", pin >> 5, pin & 0x1F, channel);
|
printf("Configured port %d pin %d on channel %d\n", pin >> 5, pin & 0x1F, channel);
|
||||||
eic_enable_interrupt(pin);
|
eic_enable_interrupt(pin);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user