[riot-notifications] [RIOT-OS/RIOT] drivers/hm3301: initial commit (#16333)

Francisco notifications at github.com
Tue Jun 1 10:38:57 CEST 2021


@fjmolinas commented on this pull request.



> +        .nc_pm_5    = (buf[24] << 8) | buf[25],
+        .nc_pm_10   = (buf[26] << 8) | buf[27],
+    };
+    memcpy(data, &tmp, sizeof(hm3301_data_t));
+
+    return 0;
+}
+
+void hm3301_reset(hm3301_t *dev)
+{
+    if (gpio_is_valid(dev->params.reset_pin)) {
+        gpio_clear(dev->params.reset_pin);
+#if IS_USED(MODULE_ZTIMER_USEC)
+        ztimer_sleep(ZTIMER_USEC, HM3301_RESET_TIME_US);
+#else
+        for (uint32_t i = 0; i < HM3301_RESET_TIME_US * (CLOCK_CORECLOCK / US_PER_SEC) ; i++) {

> But still, in some (rare) cases, CLOCK_CORECLOCK might not be defined, so this won't build in the case where ztimer is not used.

Currently, it's defined for all platforms, so I rather leave it like this for now. I added handling for xtimer.

-- 
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/16333#discussion_r642900327
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210601/f2519963/attachment.htm>


More information about the notifications mailing list