[riot-notifications] [RIOT-OS/RIOT] drivers/ds75lx: add basic driver for temperature sensor (#11505)

Sebastian Meiling notifications at github.com
Wed May 22 14:43:07 CEST 2019


smlng requested changes on this pull request.

nope, don't dismiss my review, bc:

> + *
+ * @author      Alexandre Abadie <alexandre.abadie at inria.fr>
+ *
+ * @}
+ */
+
+#include <string.h>
+
+#include "saul.h"
+#include "ds75lx.h"
+
+static int read_temperature(const void *dev, phydat_t *res)
+{
+    ds75lx_wakeup((const ds75lx_t *)dev);
+    if (ds75lx_read_temperature((const ds75lx_t *)dev, &res->val[0]) != DS75LX_OK) {
+        return -ECANCELED;

shouldn't you shutdown here too?

> +
+#ifndef DS75LX_H
+#define DS75LX_H
+
+#include "saul.h"
+#include "periph/i2c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief   Thermometer resolution
+ */
+typedef enum {
+    DS75LX_RESOLUTION_9 = 0,        /**< 9 bits resolution, 25ms max conversion time */

ah, okay

However, according to the [datasheet](https://datasheets.maximintegrated.com/en/ds/DS75LX.pdf) resolution times are 25, 50, 100, and **200** (not 250, for the latter). So it's doubling with every bit, and hence you don't need the array `_max_conversion_times` but could instead just to `25 << dev->params.resolution`

-- 
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/11505#pullrequestreview-240599291
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190522/d0b7c133/attachment.html>


More information about the notifications mailing list