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

TCS3400 Driver. More...

#include "sarmfsw.h"
#include "I2C_component.h"
#include "I2C_peripheral.h"
#include "TCS3400_proc.h"
#include "TCS3400_ex.h"
Include dependency graph for TCS3400.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  uTCS3400_REG__ENABLE
 Union for ENABLE register of TCS3400. More...
 
union  uTCS3400_REG__PERSIST
 Union for PERSIST register of TCS3400. More...
 
union  uTCS3400_REG__CONFIG
 Union for CONFIG register of TCS3400. More...
 
union  uTCS3400_REG__CONTROL
 Union for CONTROL register of TCS3400. More...
 
union  uTCS3400_REG__AUX
 Union for AUX register of TCS3400. More...
 
union  uTCS3400_REG__STATUS
 Union for STATUS register of TCS3400. More...
 
union  uTCS3400_REG__IR
 Union for IR sensor access register of TCS3400. More...
 

Macros

#define I2C_TCS3400_NB   1U
 Number of TCS3400 peripherals.
 
#define TCS34001_ADDR   0x39U
 TCS34001 Base address.
 
#define TCS34003_ADDR   0x39U
 TCS34003 Base address.
 
#define TCS34005_ADDR   0x29U
 TCS34005 Base address.
 
#define TCS34007_ADDR   0x29U
 TCS34007 Base address.
 
#define TCS3400_BASE_ADDR   TCS34005_ADDR
 TCS3400 Base address.
 

Enumerations

enum  TCS3400_reg {
  TCS3400__ENABLE = 0x80U , TCS3400__ATIME , TCS3400__WTIME = 0x83U , TCS3400__AILTL ,
  TCS3400__AILTH , TCS3400__AIHTL , TCS3400__AIHTH , TCS3400__PERSIST = 0x8CU ,
  TCS3400__CONFIG , TCS3400__CONTROL = 0x8FU , TCS3400__AUX , TCS3400__REVID ,
  TCS3400__ID , TCS3400__STATUS , TCS3400__CDATAL , TCS3400__CDATAH ,
  TCS3400__RDATAL , TCS3400__RDATAH , TCS3400__GDATAL , TCS3400__GDATAH ,
  TCS3400__BDATAL , TCS3400__BDATAH , TCS3400__IR = 0xC0U , TCS3400__IFORCE = 0xE4U ,
  TCS3400__CICLEAR = 0xE6U , TCS3400__AICLEAR = 0xE7U
}
 Register map enum of TCS3400. More...
 
enum  TCS3400_gain { TCS3400__LOW_GAIN = 0U , TCS3400__MEDIUM_GAIN , TCS3400__HIGH_GAIN , TCS3400__MAXIMUM_GAIN }
 Gain values of TCS3400. More...
 
enum  TCS3400_it_persist {
  TCS3400__PERSIST_EVERY_RGBC_CYCLE = 0U , TCS3400__PERSIST_ANY_OUTSIDE_THRESHOLD , TCS3400__PERSIST_2_IT_PERIODS , TCS3400__PERSIST_3_IT_PERIODS ,
  TCS3400__PERSIST_5_IT_PERIODS , TCS3400__PERSIST_10_IT_PERIODS , TCS3400__PERSIST_15_IT_PERIODS , TCS3400__PERSIST_20_IT_PERIODS ,
  TCS3400__PERSIST_25_IT_PERIODS , TCS3400__PERSIST_30_IT_PERIODS , TCS3400__PERSIST_35_IT_PERIODS , TCS3400__PERSIST_40_IT_PERIODS ,
  TCS3400__PERSIST_45_IT_PERIODS , TCS3400__PERSIST_50_IT_PERIODS , TCS3400__PERSIST_55_IT_PERIODS , TCS3400__PERSIST_60_IT_PERIODS
}
 Persistence control of TCS3400. More...
 

Functions

FctERR TCS3400_Init (const uint8_t idx, I2C_HandleTypeDef *const hi2c, const uint16_t devAddress)
 Initialization for TCS3400 peripheral.
 
FctERR TCS3400_Init_Single (void)
 Initialization for TCS3400 peripheral.
 
FctERR TCS3400_Write (I2C_slave_t *const pSlave, const uint8_t *data, const uint16_t addr, const uint16_t nb)
 I2C Write function for TCS3400.
 
FctERR TCS3400_Read (I2C_slave_t *const pSlave, uint8_t *data, const uint16_t addr, const uint16_t nb)
 I2C Read function for TCS3400.
 
FctERR TCS3400_Write_Word (I2C_slave_t *const pSlave, const uint16_t *data, const uint16_t addr)
 I2C Word Write (little endian) function for TCS3400.
 
FctERR TCS3400_Read_Word (I2C_slave_t *const pSlave, uint16_t *data, const uint16_t addr)
 I2C Word Read (little endian) function for TCS3400.
 

Detailed Description

TCS3400 Driver.

Author
SMFSW

TCS3400: Color Light-to-Digital Converter

Macro Definition Documentation

◆ I2C_TCS3400_NB

#define I2C_TCS3400_NB   1U

Number of TCS3400 peripherals.

Note
Define I2C_TCS3400_NB to enable multiple peripherals of this type

◆ TCS34001_ADDR

#define TCS34001_ADDR   0x39U

TCS34001 Base address.

◆ TCS34003_ADDR

#define TCS34003_ADDR   0x39U

TCS34003 Base address.

◆ TCS34005_ADDR

#define TCS34005_ADDR   0x29U

TCS34005 Base address.

◆ TCS34007_ADDR

#define TCS34007_ADDR   0x29U

TCS34007 Base address.

◆ TCS3400_BASE_ADDR

#define TCS3400_BASE_ADDR   TCS34005_ADDR

TCS3400 Base address.

Note
Define TCS3400_BASE_ADDR to change default device base address

Enumeration Type Documentation

◆ TCS3400_gain

Gain values of TCS3400.

Enumerator
TCS3400__LOW_GAIN 

Low gain mode (x1)

TCS3400__MEDIUM_GAIN 

Medium gain mode (x4)

TCS3400__HIGH_GAIN 

High gain mode (x16)

TCS3400__MAXIMUM_GAIN 

Maximum gain mode (x64)

◆ TCS3400_it_persist

Persistence control of TCS3400.

Enumerator
TCS3400__PERSIST_EVERY_RGBC_CYCLE 

Every RGBC cycle generates interrupt.

TCS3400__PERSIST_ANY_OUTSIDE_THRESHOLD 

Any value outside of threshold range.

TCS3400__PERSIST_2_IT_PERIODS 

2 consecutive values out of range

TCS3400__PERSIST_3_IT_PERIODS 

3 consecutive values out of range

TCS3400__PERSIST_5_IT_PERIODS 

5 consecutive values out of range

TCS3400__PERSIST_10_IT_PERIODS 

10 consecutive values out of range

TCS3400__PERSIST_15_IT_PERIODS 

15 consecutive values out of range

TCS3400__PERSIST_20_IT_PERIODS 

20 consecutive values out of range

TCS3400__PERSIST_25_IT_PERIODS 

25 consecutive values out of range

TCS3400__PERSIST_30_IT_PERIODS 

30 consecutive values out of range

TCS3400__PERSIST_35_IT_PERIODS 

35 consecutive values out of range

TCS3400__PERSIST_40_IT_PERIODS 

40 consecutive values out of range

TCS3400__PERSIST_45_IT_PERIODS 

45 consecutive values out of range

TCS3400__PERSIST_50_IT_PERIODS 

50 consecutive values out of range

TCS3400__PERSIST_55_IT_PERIODS 

55 consecutive values out of range

TCS3400__PERSIST_60_IT_PERIODS 

60 consecutive values out of range

◆ TCS3400_reg

Register map enum of TCS3400.

Enumerator
TCS3400__ENABLE 

Enables states and interrupts.

TCS3400__ATIME 

RGBC time.

TCS3400__WTIME 

Wait time.

TCS3400__AILTL 

Clear interrupt low threshold low byte.

TCS3400__AILTH 

Clear interrupt low threshold high byte.

TCS3400__AIHTL 

Clear interrupt high threshold low byte.

TCS3400__AIHTH 

Clear interrupt high threshold high byte.

TCS3400__PERSIST 

Interrupt persistence filter.

TCS3400__CONFIG 

Configuration.

TCS3400__CONTROL 

Control.

TCS3400__AUX 

Auxiliary control.

TCS3400__REVID 

Revision ID.

TCS3400__ID 

Device ID.

TCS3400__STATUS 

Device status.

TCS3400__CDATAL 

Clear / IR channel low data byte.

TCS3400__CDATAH 

Clear / IR channel high data byte.

TCS3400__RDATAL 

Red low data byte.

TCS3400__RDATAH 

Red high data byte.

TCS3400__GDATAL 

Green low data byte.

TCS3400__GDATAH 

Green high data byte.

TCS3400__BDATAL 

Blue low data byte.

TCS3400__BDATAH 

Blue high data byte.

TCS3400__IR 

Access IR channel.

TCS3400__IFORCE 

Force interrupt.

TCS3400__CICLEAR 

Clear channel interrupt clear.

TCS3400__AICLEAR 

Clear all interrupts.

Function Documentation

◆ TCS3400_Init()

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

Initialization for TCS3400 peripheral.

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

◆ TCS3400_Init_Single()

FctERR TCS3400_Init_Single ( void )

Initialization for TCS3400 peripheral.

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

◆ TCS3400_Read()

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

I2C Read function for TCS3400.

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:

◆ TCS3400_Read_Word()

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

I2C Word Read (little endian) function for TCS3400.

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:

◆ TCS3400_Write()

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

I2C Write function for TCS3400.

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:

◆ TCS3400_Write_Word()

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

I2C Word Write (little endian) function for TCS3400.

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: