[riot-notifications] [RIOT-OS/RIOT] drivers: Add AD7746 capacitance sensor driver (#10919)

Leandro Lanzieri notifications at github.com
Wed Feb 6 15:42:22 CET 2019


leandrolanzieri commented on this pull request.



> +                 (1 << AD7746_VT_SETUP_VTMD1_BIT));
+        reg |= (1 << AD7746_VT_SETUP_VTEN_BIT) |
+               (mode << AD7746_VT_SETUP_VTMD0_BIT);
+    }
+
+    if (i2c_write_reg(I2C, ADDR, AD7746_REG_VT_SETUP, reg, 0)) {
+        DEBUG("[ad7746] set_vt_ch - error: unable to set v/t channel mode\n");
+        goto release;
+    }
+
+release:
+    i2c_release(I2C);
+    return res;
+}
+
+int ad7746_read_raw_ch(const ad7746_t *dev, uint8_t ch, uint32_t *raw)

To avoid code duplication (as reading raw data is really similar for both channels) I did this function and implemented an specific one for each channel as inline in ad7746.h (`ad7746_read_raw_cap_ch` and `ad7746_read_raw_vt_ch`)

-- 
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/10919#discussion_r254297339
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190206/77d97233/attachment.html>


More information about the notifications mailing list