I2C_Drivers (ARM) 1.1
SMFSW collection of HAL I2C Drivers for ARM
Loading...
Searching...
No Matches
TCS3472.h File Reference

TCS3472 Driver. More...

#include "sarmfsw.h"
#include "I2C_component.h"
#include "I2C_peripheral.h"
#include "TCS3472_proc.h"
#include "TCS3472_ex.h"
Include dependency graph for TCS3472.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  uTCS3472_CMD
 Union for COMMAND register of TCS3472. More...
 
union  uTCS3472_REG__ENABLE
 Union for ENABLE register of TCS3472. More...
 
union  uTCS3472_REG__PERSIST
 Union for PERSIST register of TCS3472. More...
 
union  uTCS3472_REG__CONFIG
 Union for CONFIG register of TCS3472. More...
 
union  uTCS3472_REG__CONTROL
 Union for CONTROL register of TCS3472. More...
 
union  uTCS3472_REG__STATUS
 Union for STATUS register of TCS3472. More...
 

Macros

#define I2C_TCS3472_NB   1U
 Number of TCS3472 peripherals.
 
#define TCS34721_ADDR   0x39U
 TCS34721 Base address.
 
#define TCS34723_ADDR   0x39U
 TCS34723 Base address.
 
#define TCS34725_ADDR   0x29U
 TCS34725 Base address.
 
#define TCS34727_ADDR   0x29U
 TCS34727 Base address.
 
#define TCS3472_BASE_ADDR   TCS34725_ADDR
 TCS3472 Base address.
 

Enumerations

enum  TCS3472_reg {
  TCS3472__ENABLE = 0U , TCS3472__ATIME , TCS3472__WTIME = 0x03U , TCS3472__AILTL ,
  TCS3472__AILTH , TCS3472__AIHTL , TCS3472__AIHTH , TCS3472__PERSIST = 0x0CU ,
  TCS3472__CONFIG , TCS3472__CONTROL = 0x0FU , TCS3472__ID = 0x12U , TCS3472__STATUS ,
  TCS3472__CDATAL , TCS3472__CDATAH , TCS3472__RDATAL , TCS3472__RDATAH ,
  TCS3472__GDATAL , TCS3472__GDATAH , TCS3472__BDATAL , TCS3472__BDATAH
}
 Register map enum of TCS3472. More...
 
enum  TCS3472_transaction { TCS3472__TRANS_NORMAL_OP = 1U , TCS3472__TRANS_SPECIAL_FUNC = 3U }
 Transaction types of TCS3472. More...
 
enum  TCS3472_spec_func { TCS3472__SF_CLR_IT = 6U }
 Special functions of TCS3472. More...
 
enum  TCS3472_gain { TCS3472__LOW_GAIN = 0U , TCS3472__MEDIUM_GAIN , TCS3472__HIGH_GAIN , TCS3472__MAXIMUM_GAIN }
 Gain values of TCS3472. More...
 
enum  TCS3472_it_persist {
  TCS3472__PERSIST_EVERY_RGBC_CYCLE = 0U , TCS3472__PERSIST_1_IT_PERIODS , TCS3472__PERSIST_2_IT_PERIODS , TCS3472__PERSIST_3_IT_PERIODS ,
  TCS3472__PERSIST_5_IT_PERIODS , TCS3472__PERSIST_10_IT_PERIODS , TCS3472__PERSIST_15_IT_PERIODS , TCS3472__PERSIST_20_IT_PERIODS ,
  TCS3472__PERSIST_25_IT_PERIODS , TCS3472__PERSIST_30_IT_PERIODS , TCS3472__PERSIST_35_IT_PERIODS , TCS3472__PERSIST_40_IT_PERIODS ,
  TCS3472__PERSIST_45_IT_PERIODS , TCS3472__PERSIST_50_IT_PERIODS , TCS3472__PERSIST_55_IT_PERIODS , TCS3472__PERSIST_60_IT_PERIODS
}
 Persistence control of TCS3472. More...
 

Functions

FctERR TCS3472_Init (const uint8_t idx, I2C_HandleTypeDef *const hi2c, const uint16_t devAddress)
 Initialization for TCS3472 peripheral.
 
FctERR TCS3472_Init_Single (void)
 Initialization for TCS3472 peripheral.
 
FctERR TCS3472_Write (I2C_slave_t *const pSlave, const uint8_t *data, const uint16_t addr, const uint16_t nb)
 I2C Write function for TCS3472.
 
FctERR TCS3472_Read (I2C_slave_t *const pSlave, uint8_t *data, const uint16_t addr, const uint16_t nb)
 I2C Read function for TCS3472.
 
FctERR TCS3472_Write_Word (I2C_slave_t *const pSlave, const uint16_t *data, const uint16_t addr)
 I2C Word Write (little endian) function for TCS3472.
 
FctERR TCS3472_Read_Word (I2C_slave_t *const pSlave, uint16_t *data, const uint16_t addr)
 I2C Word Read (little endian) function for TCS3472.
 
FctERR TCS3472_Write_Special (I2C_slave_t *const pSlave, const TCS3472_spec_func func)
 I2C Special function Write function for TCS3472.
 

Detailed Description

TCS3472 Driver.

Author
SMFSW

TCS3472: Color light-to-digital converter with IR filter

Macro Definition Documentation

◆ I2C_TCS3472_NB

#define I2C_TCS3472_NB   1U

Number of TCS3472 peripherals.

Note
Define I2C_TCS3472_NB to enable multiple peripherals of this type

◆ TCS34721_ADDR

#define TCS34721_ADDR   0x39U

TCS34721 Base address.

◆ TCS34723_ADDR

#define TCS34723_ADDR   0x39U

TCS34723 Base address.

◆ TCS34725_ADDR

#define TCS34725_ADDR   0x29U

TCS34725 Base address.

◆ TCS34727_ADDR

#define TCS34727_ADDR   0x29U

TCS34727 Base address.

◆ TCS3472_BASE_ADDR

#define TCS3472_BASE_ADDR   TCS34725_ADDR

TCS3472 Base address.

Note
Define TCS3472_BASE_ADDR to change default device base address

Enumeration Type Documentation

◆ TCS3472_gain

Gain values of TCS3472.

Enumerator
TCS3472__LOW_GAIN 

Low gain mode (x1)

TCS3472__MEDIUM_GAIN 

Medium gain mode (x4)

TCS3472__HIGH_GAIN 

High gain mode (x16)

TCS3472__MAXIMUM_GAIN 

Maximum gain mode (x60)

◆ TCS3472_it_persist

Persistence control of TCS3472.

Enumerator
TCS3472__PERSIST_EVERY_RGBC_CYCLE 

Every RGBC cycle generates interrupt.

TCS3472__PERSIST_1_IT_PERIODS 

1 integration time periods out of range

TCS3472__PERSIST_2_IT_PERIODS 

2 integration time periods out of range

TCS3472__PERSIST_3_IT_PERIODS 

3 integration time periods out of range

TCS3472__PERSIST_5_IT_PERIODS 

5 integration time periods out of range

TCS3472__PERSIST_10_IT_PERIODS 

10 integration time periods out of range

TCS3472__PERSIST_15_IT_PERIODS 

15 integration time periods out of range

TCS3472__PERSIST_20_IT_PERIODS 

20 integration time periods out of range

TCS3472__PERSIST_25_IT_PERIODS 

25 integration time periods out of range

TCS3472__PERSIST_30_IT_PERIODS 

30 integration time periods out of range

TCS3472__PERSIST_35_IT_PERIODS 

35 integration time periods out of range

TCS3472__PERSIST_40_IT_PERIODS 

40 integration time periods out of range

TCS3472__PERSIST_45_IT_PERIODS 

45 integration time periods out of range

TCS3472__PERSIST_50_IT_PERIODS 

50 integration time periods out of range

TCS3472__PERSIST_55_IT_PERIODS 

55 integration time periods out of range

TCS3472__PERSIST_60_IT_PERIODS 

60 integration time periods out of range

◆ TCS3472_reg

Register map enum of TCS3472.

Enumerator
TCS3472__ENABLE 

Enables states and interrupts.

TCS3472__ATIME 

RGBC time.

TCS3472__WTIME 

Wait time.

TCS3472__AILTL 

Interrupt low threshold low byte.

TCS3472__AILTH 

Interrupt low threshold high byte.

TCS3472__AIHTL 

Interrupt high threshold low byte.

TCS3472__AIHTH 

Interrupt high threshold high byte.

TCS3472__PERSIST 

Interrupt persistence filter.

TCS3472__CONFIG 

Configuration.

TCS3472__CONTROL 

Control.

TCS3472__ID 

Device ID.

TCS3472__STATUS 

Device status.

TCS3472__CDATAL 

Clear low data byte.

TCS3472__CDATAH 

Clear high data byte.

TCS3472__RDATAL 

Red low data byte.

TCS3472__RDATAH 

Red high data byte.

TCS3472__GDATAL 

Green low data byte.

TCS3472__GDATAH 

Green high data byte.

TCS3472__BDATAL 

Blue low data byte.

TCS3472__BDATAH 

Blue high data byte.

◆ TCS3472_spec_func

Special functions of TCS3472.

Enumerator
TCS3472__SF_CLR_IT 

Clear channel interrupt clear.

◆ TCS3472_transaction

Transaction types of TCS3472.

Enumerator
TCS3472__TRANS_NORMAL_OP 

Normal operation.

TCS3472__TRANS_SPECIAL_FUNC 

Special Function.

Function Documentation

◆ TCS3472_Init()

FctERR TCS3472_Init ( const uint8_t idx,
I2C_HandleTypeDef *const hi2c,
const uint16_t devAddress )

Initialization for TCS3472 peripheral.

Parameters
[in]idx- TCS3472 index
[in]hi2c- pointer to TCS3472 I2C instance
[in]devAddress- TCS3472 device address
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCS3472_Init_Single()

FctERR TCS3472_Init_Single ( void )

Initialization for TCS3472 peripheral.

Warning
In case multiple devices (defined by I2C_TCS3472_NB > 1), you shall use TCS3472_Init instead
Returns
FctERR - error code
Here is the call graph for this function:

◆ TCS3472_Read()

FctERR TCS3472_Read ( I2C_slave_t *const pSlave,
uint8_t * data,
const uint16_t addr,
const uint16_t nb )

I2C Read function for TCS3472.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in,out]data- pointer to read to
[in]addr- Address to read from
[in]nb- Number of bytes to read
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCS3472_Read_Word()

FctERR TCS3472_Read_Word ( I2C_slave_t *const pSlave,
uint16_t * data,
const uint16_t addr )

I2C Word Read (little endian) function for TCS3472.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in,out]data- pointer to read to
[in]addr- Address to read from
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCS3472_Write()

FctERR TCS3472_Write ( I2C_slave_t *const pSlave,
const uint8_t * data,
const uint16_t addr,
const uint16_t nb )

I2C Write function for TCS3472.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in]data- pointer to write from
[in]addr- Address to write to
[in]nb- Number of bytes to write
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCS3472_Write_Special()

FctERR TCS3472_Write_Special ( I2C_slave_t *const pSlave,
const TCS3472_spec_func func )

I2C Special function Write function for TCS3472.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in]func- special function to execute
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ TCS3472_Write_Word()

FctERR TCS3472_Write_Word ( I2C_slave_t *const pSlave,
const uint16_t * data,
const uint16_t addr )

I2C Word Write (little endian) function for TCS3472.

Parameters
[in,out]pSlave- Pointer to I2C slave instance
[in]data- pointer to write from
[in]addr- Address to write to
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function: