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

Sebastian Meiling notifications at github.com
Tue Jul 23 21:50:11 CEST 2019


smlng 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)) {

mhm, right but also `unsigned` might be unsafe here anyway, i.e., when running on atmega arduinos (8bit?) so better use `int32_t` instead an thus avoid the underflow too

-- 
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_r306501866
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190723/9b4ca056/attachment.htm>


More information about the notifications mailing list