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

benpicco notifications at github.com
Mon May 31 12:35:26 CEST 2021


@benpicco 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++) {

maybe also define an xtimer fallback…

Also mind you that each loop iteration is at least 3 instructions, so this will be more like `3 * HM3301_RESET_TIME_US`

-- 
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_r642391553
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210531/5a0ed66e/attachment.htm>


More information about the notifications mailing list