[riot-notifications] [RIOT] Driver for TCS3772 Color Light-to-Digital Converter (#3135)

Peter Kietzmann notifications at github.com
Mon Jun 1 09:55:50 CEST 2015


> +    if (dev->initialized == false) {
> +        return -1;
> +    }
> +
> +    i2c_acquire(dev->i2c);
> +
> +    if (i2c_read_regs(dev->i2c, dev->addr,
> +                      (TCS37727_INC_TRANS | TCS37727_CDATA), buf, 8) != 8) {
> +        i2c_release(dev->i2c);
> +        return -1;
> +    }
> +
> +    *rawclear = ((uint16_t)buf[1] << 8) | buf[0];
> +    *rawred = ((uint16_t)buf[3] << 8) | buf[2];
> +    *rawgreen = ((uint16_t)buf[5] << 8) | buf[4];
> +    *rawblue = ((uint16_t)buf[7] << 8) | buf[6];

See comment in header file

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/3135/files#r31405727
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20150601/6ae85b38/attachment.html>


More information about the notifications mailing list