[riot-notifications] [RIOT-OS/RIOT] [WIP] cpu/atmega_common: pseudomodule-based pin change interrupt implementation (#11122)

Robert Hartung notifications at github.com
Thu Mar 7 13:42:39 CET 2019


roberthartung commented on this pull request.



> +#ifdef PCINT_NUM_BANKS
+/* inline function that is used by the PCINT ISR */
+static inline void pcint_handler(uint8_t bank, volatile uint8_t *mask_reg)
+{
+    __enter_isr();
+    /* Find right item */
+    uint8_t pin_num = 0;
+    uint8_t enabled_pcints = *mask_reg;
+
+    while (enabled_pcints > 0) {
+        /* check if this pin is enabled & has changed */
+        if (enabled_pcints & 0x1) {
+            uint8_t pin_mask = (1 << pin_num);
+            gpio_t pin = pcint_mapping[ bank ][ pin_num ];
+            uint8_t port_value = (_SFR_MEM8(_pin_addr( GPIO_PIN( _port_num(pin), pin_num ))));
+            uint8_t pin_value = (port_value & pin_mask) == 0 ? 0 : 1;

sounds like a good idea!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11122#discussion_r263364999
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190307/8bdc9caf/attachment.html>


More information about the notifications mailing list