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

Marian Buschsieweke notifications at github.com
Tue Jul 23 22:34:32 CEST 2019

maribu commented on this pull request.

+ * @brief   Wait until the pin @p pin has level @p expect
+ *
+ * @param   pin     GPIO pin to wait for
+ * @param   expect  Wait until @p pin has this logic level
+ * @param   timeout Timeout in µs
+ *
+ * @retval  0       Success
+ * @retval  -1      Timeout occurred before level was reached
+ */
+static inline int _wait_for_level(gpio_t pin, int expect, unsigned timeout)

`unsinged` is guaranteed to be 16 bit by the C standard, so the timeout of 1000 fits quite fine. Also, `unsigned` makes sure that negative timeouts cannot be used, which makes sense. The loop is written to never count below zero.

On an AVR an `unsigned` will be faster than `int32_t`.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190723/c0d8efa4/attachment.htm>

More information about the notifications mailing list