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

Parks Projets notifications at github.com
Thu May 16 15:15:06 CEST 2019


ParksProjets approved this pull request.

I reviewed the code and tested serveral resolutions using an IM880-A board and everything seems to work well.

> +    puts("Initialization successful\n");
+
+    printf("\n+--------Starting Measurements--------+\n");
+    int16_t temperature;
+    while (1) {
+        ds75lx_wakeup(&dev);
+        /* Get temperature in degrees celsius */
+        ds75lx_read_temperature(&dev, &temperature);
+        ds75lx_shutdown(&dev);
+
+        bool negative = (temperature < 0);
+        if (negative) {
+            temperature = -temperature;
+        }
+
+        printf("Temperature [°C]: %c%d.%d\n",

The only thing I noticed is when for example `temperature` is `25.06` this `printf` displays `25.6`. To fix that, just display a fixed number of digits after the decimal point as following.

```c
printf("... : %c%d.%02d", ...);
```

-- 
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-238378393
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190516/2b81fb1e/attachment-0001.html>


More information about the notifications mailing list