LibDriver TCS34725
Loading...
Searching...
No Matches
driver_tcs34725.c File Reference

driver tcs34725 source file More...

#include "driver_tcs34725.h"
Include dependency graph for driver_tcs34725.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "AMS TCS34725"
 chip information definition
#define MANUFACTURER_NAME   "AMS"
#define SUPPLY_VOLTAGE_MIN   2.7f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   20.0f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   2000
#define TCS34725_REG_ENABLE   0x80
 chip register definition
#define TCS34725_REG_ATIME   0x81
#define TCS34725_REG_WTIME   0x83
#define TCS34725_REG_AILTL   0xA4
#define TCS34725_REG_AILTH   0xA5
#define TCS34725_REG_AIHTL   0xA6
#define TCS34725_REG_AIHTH   0xA7
#define TCS34725_REG_PERS   0x8C
#define TCS34725_REG_CONFIG   0x8D
#define TCS34725_REG_CONTROL   0x8F
#define TCS34725_REG_ID   0x92
#define TCS34725_REG_STATUS   0x93
#define TCS34725_REG_CDATAL   0xB4
#define TCS34725_REG_CDATAH   0xB5
#define TCS34725_REG_RDATAL   0xB6
#define TCS34725_REG_RDATAH   0xB7
#define TCS34725_REG_GDATAL   0xB8
#define TCS34725_REG_GDATAH   0xB9
#define TCS34725_REG_BDATAL   0xBA
#define TCS34725_REG_BDATAH   0xBB
#define TCS34725_REG_CLEAR   0xE6
#define TCS34725_ADDRESS   (0x29 << 1)
 iic address definition

Functions

uint8_t tcs34725_set_rgbc_interrupt (tcs34725_handle_t *handle, tcs34725_bool_t enable)
 enable or disable the rgbc interrupt
uint8_t tcs34725_get_rgbc_interrupt (tcs34725_handle_t *handle, tcs34725_bool_t *enable)
 get the rgbc interrupt
uint8_t tcs34725_set_wait (tcs34725_handle_t *handle, tcs34725_bool_t enable)
 enable or disable the wait time
uint8_t tcs34725_get_wait (tcs34725_handle_t *handle, tcs34725_bool_t *enable)
 get the wait time
uint8_t tcs34725_set_rgbc (tcs34725_handle_t *handle, tcs34725_bool_t enable)
 enable or disable the rgbc adc
uint8_t tcs34725_get_rgbc (tcs34725_handle_t *handle, tcs34725_bool_t *enable)
 get the rgbc status
uint8_t tcs34725_set_power_on (tcs34725_handle_t *handle, tcs34725_bool_t enable)
 enable or disable the power
uint8_t tcs34725_get_power_on (tcs34725_handle_t *handle, tcs34725_bool_t *enable)
 get the power status
uint8_t tcs34725_set_rgbc_integration_time (tcs34725_handle_t *handle, tcs34725_integration_time_t t)
 set the rgbc adc integration time
uint8_t tcs34725_get_rgbc_integration_time (tcs34725_handle_t *handle, tcs34725_integration_time_t *t)
 get the rgbc adc integration time
uint8_t tcs34725_set_wait_time (tcs34725_handle_t *handle, tcs34725_wait_time_t t)
 set the wait time
uint8_t tcs34725_get_wait_time (tcs34725_handle_t *handle, tcs34725_wait_time_t *t)
 get the wait time
uint8_t tcs34725_set_rgbc_clear_low_interrupt_threshold (tcs34725_handle_t *handle, uint16_t threshold)
 set the rgbc clear low interrupt threshold
uint8_t tcs34725_get_rgbc_clear_low_interrupt_threshold (tcs34725_handle_t *handle, uint16_t *threshold)
 get the rgbc clear low interrupt threshold
uint8_t tcs34725_set_rgbc_clear_high_interrupt_threshold (tcs34725_handle_t *handle, uint16_t threshold)
 set the rgbc clear high interrupt threshold
uint8_t tcs34725_get_rgbc_clear_high_interrupt_threshold (tcs34725_handle_t *handle, uint16_t *threshold)
 get the rgbc clear high interrupt threshold
uint8_t tcs34725_set_interrupt_mode (tcs34725_handle_t *handle, tcs34725_interrupt_mode_t mode)
 set the interrupt mode
uint8_t tcs34725_get_interrupt_mode (tcs34725_handle_t *handle, tcs34725_interrupt_mode_t *mode)
 get the interrupt mode
uint8_t tcs34725_set_gain (tcs34725_handle_t *handle, tcs34725_gain_t gain)
 set the adc gain
uint8_t tcs34725_get_gain (tcs34725_handle_t *handle, tcs34725_gain_t *gain)
 get the adc gain
uint8_t tcs34725_read_rgbc (tcs34725_handle_t *handle, uint16_t *red, uint16_t *green, uint16_t *blue, uint16_t *clear)
 read the rgbc data
uint8_t tcs34725_read_rgb (tcs34725_handle_t *handle, uint16_t *red, uint16_t *green, uint16_t *blue)
 read the rgb data
uint8_t tcs34725_read_c (tcs34725_handle_t *handle, uint16_t *clear)
 read the clear data
uint8_t tcs34725_init (tcs34725_handle_t *handle)
 initialize the chip
uint8_t tcs34725_deinit (tcs34725_handle_t *handle)
 close the chip
uint8_t tcs34725_set_reg (tcs34725_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t tcs34725_get_reg (tcs34725_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t tcs34725_info (tcs34725_info_t *info)
 get chip information

Detailed Description

driver tcs34725 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
2.0.0
Author
Shifeng Li
Date
2021-02-28

history

Date Version Author Description
2021/02/28 2.0 Shifeng Li format the code
2020/10/30 1.0 Shifeng Li first upload

Definition in file driver_tcs34725.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "AMS TCS34725"

chip information definition

chip name

Definition at line 43 of file driver_tcs34725.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   2000

driver version

Definition at line 50 of file driver_tcs34725.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "AMS"

manufacturer name

Definition at line 44 of file driver_tcs34725.c.

◆ MAX_CURRENT

#define MAX_CURRENT   20.0f

chip max current

Definition at line 47 of file driver_tcs34725.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 46 of file driver_tcs34725.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   2.7f

chip min supply voltage

Definition at line 45 of file driver_tcs34725.c.

◆ TCS34725_ADDRESS

#define TCS34725_ADDRESS   (0x29 << 1)

iic address definition

iic address

Definition at line 80 of file driver_tcs34725.c.

◆ TCS34725_REG_AIHTH

#define TCS34725_REG_AIHTH   0xA7

aihtl register

Definition at line 61 of file driver_tcs34725.c.

◆ TCS34725_REG_AIHTL

#define TCS34725_REG_AIHTL   0xA6

aihtl register

Definition at line 60 of file driver_tcs34725.c.

◆ TCS34725_REG_AILTH

#define TCS34725_REG_AILTH   0xA5

ailth register

Definition at line 59 of file driver_tcs34725.c.

◆ TCS34725_REG_AILTL

#define TCS34725_REG_AILTL   0xA4

ailtl register

Definition at line 58 of file driver_tcs34725.c.

◆ TCS34725_REG_ATIME

#define TCS34725_REG_ATIME   0x81

atime register

Definition at line 56 of file driver_tcs34725.c.

◆ TCS34725_REG_BDATAH

#define TCS34725_REG_BDATAH   0xBB

bdatah register

Definition at line 74 of file driver_tcs34725.c.

◆ TCS34725_REG_BDATAL

#define TCS34725_REG_BDATAL   0xBA

bdatal register

Definition at line 73 of file driver_tcs34725.c.

◆ TCS34725_REG_CDATAH

#define TCS34725_REG_CDATAH   0xB5

cdatah register

Definition at line 68 of file driver_tcs34725.c.

◆ TCS34725_REG_CDATAL

#define TCS34725_REG_CDATAL   0xB4

cdatal register

Definition at line 67 of file driver_tcs34725.c.

◆ TCS34725_REG_CLEAR

#define TCS34725_REG_CLEAR   0xE6

clear register

Definition at line 75 of file driver_tcs34725.c.

◆ TCS34725_REG_CONFIG

#define TCS34725_REG_CONFIG   0x8D

config register

Definition at line 63 of file driver_tcs34725.c.

◆ TCS34725_REG_CONTROL

#define TCS34725_REG_CONTROL   0x8F

control register

Definition at line 64 of file driver_tcs34725.c.

◆ TCS34725_REG_ENABLE

#define TCS34725_REG_ENABLE   0x80

chip register definition

enable register

Definition at line 55 of file driver_tcs34725.c.

◆ TCS34725_REG_GDATAH

#define TCS34725_REG_GDATAH   0xB9

gdatah register

Definition at line 72 of file driver_tcs34725.c.

◆ TCS34725_REG_GDATAL

#define TCS34725_REG_GDATAL   0xB8

gdatal register

Definition at line 71 of file driver_tcs34725.c.

◆ TCS34725_REG_ID

#define TCS34725_REG_ID   0x92

id register

Definition at line 65 of file driver_tcs34725.c.

◆ TCS34725_REG_PERS

#define TCS34725_REG_PERS   0x8C

pers register

Definition at line 62 of file driver_tcs34725.c.

◆ TCS34725_REG_RDATAH

#define TCS34725_REG_RDATAH   0xB7

rdatah register

Definition at line 70 of file driver_tcs34725.c.

◆ TCS34725_REG_RDATAL

#define TCS34725_REG_RDATAL   0xB6

rdatal register

Definition at line 69 of file driver_tcs34725.c.

◆ TCS34725_REG_STATUS

#define TCS34725_REG_STATUS   0x93

status register

Definition at line 66 of file driver_tcs34725.c.

◆ TCS34725_REG_WTIME

#define TCS34725_REG_WTIME   0x83

wtime register

Definition at line 57 of file driver_tcs34725.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 49 of file driver_tcs34725.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 48 of file driver_tcs34725.c.