no-OS
Loading...
Searching...
No Matches
tcs34725.h File Reference

Header file of TCS34725 Driver. More...

#include <stdint.h>
#include "no_os_i2c.h"
#include "no_os_util.h"
Include dependency graph for tcs34725.h:

Classes

struct  tcs34725_init_param
 Initialization parameter for the device descriptor. More...
 
struct  tcs34725_desc
 Device descriptor. More...
 

Macros

#define TCS34725_COMMAND_BIT   0x80
 
#define TCS34725_COMMAND_INC   0x20
 
#define TCS34725_ENABLE   0x00
 
#define TCS34725_ENABLE_PON   NO_OS_BIT(0)
 
#define TCS34725_ENABLE_AEN   NO_OS_BIT(1)
 
#define TCS34725_ATIME   0x01
 
#define TCS34725_WTIME   0x03
 
#define TCS34725_AILTL   0x04
 
#define TCS34725_AILTH   0x05
 
#define TCS34725_AIHTL   0x06
 
#define TCS34725_AIHTH   0x07
 
#define TCS34725_PERS   0x0C
 
#define TCS34725_CONFIG   0x0D
 
#define TCS34725_CONTROL   0x0F
 
#define TCS34725_ID   0x12
 
#define TCS34725_STATUS   0x13
 
#define TCS34725_CDATAL   0x14
 
#define TCS34725_CDATAH   0x15
 
#define TCS34725_RDATAL   0x16
 
#define TCS34725_RDATAH   0x17
 
#define TCS34725_GDATAL   0x18
 
#define TCS34725_GDATAH   0x19
 
#define TCS34725_BDATAL   0x1A
 
#define TCS34725_BDATAH   0x1B
 

Functions

int tcs34725_reg_write (struct tcs34725_desc *desc, uint8_t addr, uint8_t val)
 Write a raw value to a register.
 
int tcs34725_reg_read (struct tcs34725_desc *desc, uint8_t addr, uint8_t *val)
 Read the raw value of a register.
 
int tcs34725_get_rgbc (struct tcs34725_desc *desc, uint16_t *r, uint16_t *g, uint16_t *b, uint16_t *c)
 Read the current RGB color sample.
 
int tcs34725_init (struct tcs34725_desc **desc, struct tcs34725_init_param *param)
 Initialize the device structure.
 
int tcs34725_remove (struct tcs34725_desc *desc)
 Free the device descriptor.
 

Detailed Description

Header file of TCS34725 Driver.

Author
Monica Constandachi (monic.nosp@m.a.co.nosp@m.nstan.nosp@m.dach.nosp@m.i@ana.nosp@m.log..nosp@m.com)

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ TCS34725_AIHTH

#define TCS34725_AIHTH   0x07

◆ TCS34725_AIHTL

#define TCS34725_AIHTL   0x06

◆ TCS34725_AILTH

#define TCS34725_AILTH   0x05

◆ TCS34725_AILTL

#define TCS34725_AILTL   0x04

◆ TCS34725_ATIME

#define TCS34725_ATIME   0x01

◆ TCS34725_BDATAH

#define TCS34725_BDATAH   0x1B

◆ TCS34725_BDATAL

#define TCS34725_BDATAL   0x1A

◆ TCS34725_CDATAH

#define TCS34725_CDATAH   0x15

◆ TCS34725_CDATAL

#define TCS34725_CDATAL   0x14

◆ TCS34725_COMMAND_BIT

#define TCS34725_COMMAND_BIT   0x80

◆ TCS34725_COMMAND_INC

#define TCS34725_COMMAND_INC   0x20

◆ TCS34725_CONFIG

#define TCS34725_CONFIG   0x0D

◆ TCS34725_CONTROL

#define TCS34725_CONTROL   0x0F

◆ TCS34725_ENABLE

#define TCS34725_ENABLE   0x00

◆ TCS34725_ENABLE_AEN

#define TCS34725_ENABLE_AEN   NO_OS_BIT(1)

◆ TCS34725_ENABLE_PON

#define TCS34725_ENABLE_PON   NO_OS_BIT(0)

◆ TCS34725_GDATAH

#define TCS34725_GDATAH   0x19

◆ TCS34725_GDATAL

#define TCS34725_GDATAL   0x18

◆ TCS34725_ID

#define TCS34725_ID   0x12

◆ TCS34725_PERS

#define TCS34725_PERS   0x0C

◆ TCS34725_RDATAH

#define TCS34725_RDATAH   0x17

◆ TCS34725_RDATAL

#define TCS34725_RDATAL   0x16

◆ TCS34725_STATUS

#define TCS34725_STATUS   0x13

◆ TCS34725_WTIME

#define TCS34725_WTIME   0x03

Function Documentation

◆ tcs34725_get_rgbc()

int tcs34725_get_rgbc ( struct tcs34725_desc * desc,
uint16_t * r,
uint16_t * g,
uint16_t * b,
uint16_t * c )

Read the current RGB color sample.

Read the current RGBC sample (clear, red, green, blue).

Parameters
desc- The device structure.
r- The red component.
g- The green component.
b- The blue component.
c- The clear component.
Returns
0 in case of success, error code otherwise.

◆ tcs34725_init()

int tcs34725_init ( struct tcs34725_desc ** desc,
struct tcs34725_init_param * init_param )

Initialize the device structure.

Initialize the device structure

Parameters
desc- The device structure to be initialized.
init_param- Initialization parameter for the device descriptor.
Returns
0 in case of success, negative error code otherwise.

◆ tcs34725_reg_read()

int tcs34725_reg_read ( struct tcs34725_desc * desc,
uint8_t addr,
uint8_t * val )

Read the raw value of a register.

Read a register value

Parameters
desc- The device structure.
addr- The register's address.
val- The value to be read.
Returns
0 in case of success, negative error code otherwise

◆ tcs34725_reg_write()

int tcs34725_reg_write ( struct tcs34725_desc * desc,
uint8_t addr,
uint8_t val )

Write a raw value to a register.

Write a register value

Parameters
desc- The device structure.
addr- The register's address.
val- The value to be written.
Returns
0 in case of success, error code otherwise

◆ tcs34725_remove()

int tcs34725_remove ( struct tcs34725_desc * desc)

Free the device descriptor.

Free the device descriptor

Parameters
desc- The device structure.
Returns
0 in case of success, error code otherwise.