[riot-notifications] [RIOT-OS/RIOT] drivers/dht: Bugfixes (#11876)

Marian Buschsieweke notifications at github.com
Tue Jul 23 22:07:30 CEST 2019


maribu commented on this pull request.



>      uint16_t res = 0;
 
     for (int i = 0; i < bits; i++) {
         uint32_t start, end;
         res <<= 1;
         /* measure the length between the next rising and falling flanks (the
          * time the pin is high - smoke up :-) */
-        while (!gpio_read(pin)) {}
+        unsigned counter = 0;
+        while (!gpio_read(pin)) {

I refactored all four instances of waiting for the GPIO to reach a specific logic level with a timeout into `static inline` function and changed the logic to count down to zero, as you suggested.

-- 
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/11876#discussion_r306508953
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190723/122f3bd4/attachment.htm>


More information about the notifications mailing list