summaryrefslogtreecommitdiffstats
path: root/watch-library/watch
diff options
context:
space:
mode:
authorJoey Castillo <jose.castillo@gmail.com>2021-10-19 10:14:24 -0400
committerJoey Castillo <jose.castillo@gmail.com>2021-10-19 10:14:24 -0400
commit52c5747d2e873d4946d211c548c03498b72c1fb5 (patch)
treed2c571b8583d75e956fe7b822ae9c9fdd637a21e /watch-library/watch
parent6210e1c233a3ee66274389e85889b0681102378d (diff)
downloadSensor-Watch-52c5747d2e873d4946d211c548c03498b72c1fb5.tar.gz
Sensor-Watch-52c5747d2e873d4946d211c548c03498b72c1fb5.tar.bz2
Sensor-Watch-52c5747d2e873d4946d211c548c03498b72c1fb5.zip
getting the sensor watch dev board working
Diffstat (limited to 'watch-library/watch')
-rw-r--r--watch-library/watch/watch_extint.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/watch-library/watch/watch_extint.c b/watch-library/watch/watch_extint.c
index dcaa0d80..d6ad5b60 100644
--- a/watch-library/watch/watch_extint.c
+++ b/watch-library/watch/watch_extint.c
@@ -65,18 +65,14 @@ void watch_register_interrupt_callback(const uint8_t pin, ext_irq_cb_t callback,
sense_pos = 4 * (WATCH_A4_EIC_CHANNEL % 8);
break;
case BTN_ALARM:
- // for the buttons, we need an internal pull-down.
- gpio_set_pin_pull_mode(pin, GPIO_PULL_DOWN);
config_index = (WATCH_BTN_ALARM_EIC_CHANNEL > 7) ? 1 : 0;
sense_pos = 4 * (WATCH_BTN_ALARM_EIC_CHANNEL % 8);
break;
case BTN_LIGHT:
- gpio_set_pin_pull_mode(pin, GPIO_PULL_DOWN);
config_index = (WATCH_BTN_LIGHT_EIC_CHANNEL > 7) ? 1 : 0;
sense_pos = 4 * (WATCH_BTN_LIGHT_EIC_CHANNEL % 8);
break;
case BTN_MODE:
- gpio_set_pin_pull_mode(pin, GPIO_PULL_DOWN);
config_index = (WATCH_BTN_MODE_EIC_CHANNEL > 7) ? 1 : 0;
sense_pos = 4 * (WATCH_BTN_MODE_EIC_CHANNEL % 8);
break;
@@ -85,7 +81,6 @@ void watch_register_interrupt_callback(const uint8_t pin, ext_irq_cb_t callback,
}
gpio_set_pin_direction(pin, GPIO_DIRECTION_IN);
- gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_A);
// EIC configuration register is enable-protected, so we have to disable it first...
if (hri_eic_get_CTRLA_reg(EIC, EIC_CTRLA_ENABLE)) {
@@ -98,6 +93,9 @@ void watch_register_interrupt_callback(const uint8_t pin, ext_irq_cb_t callback,
config &= ~(7 << sense_pos);
config |= trigger << (sense_pos);
hri_eic_write_CONFIG_reg(EIC, config_index, config);
+ // ...set the pin mode...
+ gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_A);
+ if (pin == BTN_ALARM || pin == BTN_LIGHT || pin == BTN_MODE) gpio_set_pin_pull_mode(pin, GPIO_PULL_DOWN);
// ...and re-enable the EIC
hri_eic_set_CTRLA_ENABLE_bit(EIC);