[riot-notifications] [RIOT-OS/RIOT] periph/gpio: add gpio_set_cb() function (#12082)

Marian Buschsieweke notifications at github.com
Tue Sep 17 17:42:53 CEST 2019


maribu commented on this pull request.



> +    if (int_num < 0) {
+        return -1;
+    }
+
+    _gpio_update_cb(pin, &config[int_num].cb, cb);
+
+    return 0;
+}
+
+int gpio_update_cb_arg(gpio_t pin, void *arg)
+{
+    int8_t int_num = _int_num(pin);
+
+    if (int_num < 0) {
+        return -1;
+    }

One ATmega specific detail: The ATmegas only have individual interrupt vectors for about 3 pins, but shared interrupt vectors for a group of 8 pins (called pin changed interrupts). On top of the pin changed interrupts a RIOT compatible `gpio_init_int()` is implemented, when pseudomodule is used. `_int_num()` will however only work for "proper" interrupts, not for pin changed interrupts.

(But I'd say keep it like this for now. I'd even say that it is fine to merge the PR without support for this special case in order to not get lost in the implementation details of a dying platform. This can be easily added later on.)

-- 
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/12082#pullrequestreview-289362684
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190917/809736ba/attachment.htm>


More information about the notifications mailing list