]> git.earman.xyz Git - sensor-watch.git/commitdiff
fix (most) external interrupts on the 9-pin connector
authorJoey Castillo <joeycastillo@utexas.edu>
Tue, 30 Nov 2021 22:02:42 +0000 (17:02 -0500)
committerJoey Castillo <joeycastillo@utexas.edu>
Tue, 30 Nov 2021 22:02:42 +0000 (17:02 -0500)
watch-library/config/hpl_eic_config.h
watch-library/hal/src/hal_ext_irq.c
watch-library/hpl/eic/hpl_eic.c
watch-library/watch/watch_extint.h

index 53fee6cf098a089e57bb40f711f8f5c7a30a66f9..be54c2e123e8068f16bb935f01b2ffa8fd85207a 100644 (file)
 
 // </e>
 
-// my god this is a hack. need to refactor this out of ASF and into our driver. - joey 10/19
+// this is still a hack: if the user wants to use PA02 (alarm button) as an RTC interrupt pin and PB02 (9-pin A2) on the EIC, we don't support that.
+// TODO item: refactor out our reliance on the ASF external interrupt driver. - joey 11/30
 #ifdef CRYSTALLESS
-#define CONFIG_EIC_EXTINT_MAP {2, PIN_PA02}, {5, PIN_PB05}, {7, PIN_PA07},
+#define CONFIG_EIC_EXTINT_MAP {0, PIN_PB00}, {1, PIN_PB01}, {2, PIN_PA02}, {3, PIN_PB03}, {5, PIN_PB05}, {7, PIN_PA07},
 #else
-#define CONFIG_EIC_EXTINT_MAP {2, PIN_PA02}, {6, PIN_PA22}, {7, PIN_PA23},
+#define CONFIG_EIC_EXTINT_MAP {0, PIN_PB00}, {1, PIN_PB01}, {2, PIN_PA02}, {3, PIN_PB03}, {6, PIN_PA22}, {7, PIN_PA23},
 #endif
 
 // <<< end of configuration section >>>
index d0b929276c56da26095911809e4f2f0bd803232f..2c383b4b0f38ebf08b038f52d576c0af1e3b11f0 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "hal_ext_irq.h"
 
-#define EXT_IRQ_AMOUNT 3
+#define EXT_IRQ_AMOUNT 6
 
 /**
  * \brief Driver version
index 3b473ef578c018ba601d42ab7719981ea16f2d14..2bd31615341f2a8904539668b11d0360a4d0505c 100644 (file)
@@ -70,7 +70,7 @@ static int ffs(int v)
        }
 #endif
 
-#define EXT_IRQ_AMOUNT 3
+#define EXT_IRQ_AMOUNT 6
 
 /**
  * \brief EXTINTx and pin number map
index 758fe8bca3520eea2c040420f28c99c861402c93..cba6c5e17d975192fa87ada7e726d08e4fa1c836 100644 (file)
@@ -62,16 +62,17 @@ void watch_disable_external_interrupts();
   *          want to detect both rising and falling conditions (i.e. button down and button up), use
   *          INTERRUPT_TRIGGER_BOTH and use watch_get_pin_level to check the pin level in your callback
   *          to determine which condition caused the interrupt.
-  * @param pin One of pins BTN_LIGHT, BTN_MODE, BTN_ALARM, or A0-A4. If the pin parameter matches one of
+  * @param pin One of BTN_LIGHT, BTN_MODE, BTN_ALARM, A0, A1, A3 or A4. If the pin parameter matches one of
   *            the three button pins, this function will also enable an internal pull-down resistor. If
   *            the pin parameter is A0-A4, you are responsible for setting any required pull configuration
   *            using watch_enable_pull_up or watch_enable_pull_down.
   * @param callback The function you wish to have called when the button is pressed.
   * @param trigger The condition on which you wish to trigger: rising, falling or both.
-  * @note The alarm button and pin A2 share an external interrupt channel EXTINT[2]; you can only use one
-  *       or the other. However! These pins both have an alternate method of triggering via the RTC tamper
-  *       interrupt, which has the added benefit of not requiring the external interrupt controller at all.
-  * @see watch_register_extwake_callback
+  * @note Pins A2 and A4 can also generate interrupts via the watch_register_extwake_callback function, which
+  *       will allow them to trigger even when the watch is in deep sleep mode.
+  * @warning As of now, A2 is not usable via the watch_register_interrupt_callback function. To enable an
+  *          external interrupt on pin A2, use the watch_register_extwake_callback function. This issue will be
+  *          addressed in a future revision of the watch library.
   */
 void watch_register_interrupt_callback(const uint8_t pin, ext_irq_cb_t callback, watch_interrupt_trigger trigger);