[riot-notifications] [RIOT-OS/RIOT] drivers: support for NXP PCA9685 I2C 16-channel, 12-bit PWM controller (#10556)

benpicco notifications at github.com
Sat Sep 7 10:43:46 CEST 2019


benpicco commented on this pull request.



> +    if (i2c_write_regs(dev->params.i2c_dev,
+                       dev->params.i2c_addr, reg, data, len, 0) != 0) {
+        i2c_release(dev->params.i2c_dev);
+        return -PCA9685_ERROR_I2C;
+    }
+
+    /* release the I2C device */
+    i2c_release(dev->params.i2c_dev);
+
+    return PCA9685_OK;
+}
+
+inline static int _write_word(const pca9685_t *dev, uint8_t reg, uint16_t data)
+{
+    uint8_t bytes[2] = { data & 0xff, (data >> 8) & 0xff };
+    return _write (dev, reg, (uint8_t*)&bytes, 2);

OK sorry, got confused about which way around the bytes should be.
You can still drop the `(uint8_t)&` from `bytes ` I think.

-- 
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/10556#discussion_r321961291
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190907/bcfecf29/attachment.htm>


More information about the notifications mailing list