[riot-notifications] [RIOT-OS/RIOT] saul/gpio: Low footprint handling of active-low signals + state initialization (#7586)

Gaƫtan Harter notifications at github.com
Tue Sep 19 11:26:28 CEST 2017


cladmi commented on this pull request.



>  
 
 static int read(const void *dev, phydat_t *res)
 {
-    gpio_t pin = *((const gpio_t *)dev);
-    res->val[0] = (gpio_read(pin)) ? 1 : 0;
+    const saul_gpio_params_t *p = (const saul_gpio_params_t *)dev;
+    int inverted = (p->flags | SAUL_GPIO_INVERTED);

I do this mistake all the time.

-- 
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/7586#discussion_r139640357
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20170919/724a7e12/attachment.html>


More information about the notifications mailing list