![]() |
LibDriver TSL2561
|
driver tsl2561 source file More...
#include "driver_tsl2561.h"Go to the source code of this file.
Functions | |
| uint8_t | tsl2561_init (tsl2561_handle_t *handle) |
| initialize the chip | |
| uint8_t | tsl2561_deinit (tsl2561_handle_t *handle) |
| close the chip | |
| uint8_t | tsl2561_set_addr_pin (tsl2561_handle_t *handle, tsl2561_address_t addr_pin) |
| set the iic address pin | |
| uint8_t | tsl2561_get_addr_pin (tsl2561_handle_t *handle, tsl2561_address_t *addr_pin) |
| get the iic address pin | |
| uint8_t | tsl2561_read (tsl2561_handle_t *handle, uint16_t *channel_0_raw, uint16_t *channel_1_raw, uint32_t *lux) |
| read data from the chip | |
| uint8_t | tsl2561_set_gain (tsl2561_handle_t *handle, tsl2561_gain_t gain) |
| set the adc gain | |
| uint8_t | tsl2561_get_gain (tsl2561_handle_t *handle, tsl2561_gain_t *gain) |
| get the adc gain | |
| uint8_t | tsl2561_set_integration_time (tsl2561_handle_t *handle, tsl2561_integration_time_t t) |
| set the integration time | |
| uint8_t | tsl2561_get_integration_time (tsl2561_handle_t *handle, tsl2561_integration_time_t *t) |
| get the integration time | |
| uint8_t | tsl2561_set_interrupt_mode (tsl2561_handle_t *handle, tsl2561_interrupt_mode_t mode) |
| set the interrupt mode | |
| uint8_t | tsl2561_get_interrupt_mode (tsl2561_handle_t *handle, tsl2561_interrupt_mode_t *mode) |
| get the interrupt mode | |
| uint8_t | tsl2561_set_interrupt (tsl2561_handle_t *handle, tsl2561_bool_t enable) |
| enable or disable the chip interrupt | |
| uint8_t | tsl2561_get_interrupt (tsl2561_handle_t *handle, tsl2561_bool_t *enable) |
| get the chip interrupt | |
| uint8_t | tsl2561_set_interrupt_high_threshold (tsl2561_handle_t *handle, uint16_t ch0_raw) |
| set the interrupt high threshold | |
| uint8_t | tsl2561_get_interrupt_high_threshold (tsl2561_handle_t *handle, uint16_t *ch0_raw) |
| get the interrupt high threshold | |
| uint8_t | tsl2561_set_interrupt_low_threshold (tsl2561_handle_t *handle, uint16_t ch0_raw) |
| set the interrupt low threshold | |
| uint8_t | tsl2561_get_interrupt_low_threshold (tsl2561_handle_t *handle, uint16_t *ch0_raw) |
| get the interrupt low threshold | |
| uint8_t | tsl2561_power_down (tsl2561_handle_t *handle) |
| power down the chip | |
| uint8_t | tsl2561_wake_up (tsl2561_handle_t *handle) |
| wake up the chip | |
| uint8_t | tsl2561_set_reg (tsl2561_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len) |
| set the chip register | |
| uint8_t | tsl2561_get_reg (tsl2561_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len) |
| get the chip register | |
| uint8_t | tsl2561_info (tsl2561_info_t *info) |
| get chip's information | |
driver tsl2561 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.
| Date | Version | Author | Description |
|---|---|---|---|
| 2021/02/26 | 2.0 | Shifeng Li | format the code |
| 2020/10/28 | 1.0 | Shifeng Li | first upload |
Definition in file driver_tsl2561.c.
| #define CHIP_NAME "AMS TSL2561" |
| #define DRIVER_VERSION 2000 |
driver version
Definition at line 50 of file driver_tsl2561.c.
| #define MANUFACTURER_NAME "AMS" |
manufacturer name
Definition at line 44 of file driver_tsl2561.c.
| #define MAX_CURRENT 0.60f |
chip max current
Definition at line 47 of file driver_tsl2561.c.
| #define SUPPLY_VOLTAGE_MAX 3.6f |
chip max supply voltage
Definition at line 46 of file driver_tsl2561.c.
| #define SUPPLY_VOLTAGE_MIN 2.7f |
chip min supply voltage
Definition at line 45 of file driver_tsl2561.c.
| #define TEMPERATURE_MAX 85.0f |
chip max operating temperature
Definition at line 49 of file driver_tsl2561.c.
| #define TEMPERATURE_MIN -40.0f |
chip min operating temperature
Definition at line 48 of file driver_tsl2561.c.
| #define TSL2561_CONTROL_POWEROFF 0x00 |
power off
Definition at line 72 of file driver_tsl2561.c.
| #define TSL2561_CONTROL_POWERON 0x03 |
| #define TSL2561_GAIN_0X 0x00 |
gain 0x
Definition at line 102 of file driver_tsl2561.c.
| #define TSL2561_GAIN_16X 0x10 |
gain 16x
Definition at line 103 of file driver_tsl2561.c.
| #define TSL2561_LUX_B1T 0x01F2U |
0.0304 * 2^LUX_SCALE
Definition at line 79 of file driver_tsl2561.c.
| #define TSL2561_LUX_B2T 0x0214U |
0.0325 * 2^LUX_SCALE
Definition at line 82 of file driver_tsl2561.c.
| #define TSL2561_LUX_B3T 0x023FU |
0.0351 * 2^LUX_SCALE
Definition at line 85 of file driver_tsl2561.c.
| #define TSL2561_LUX_B4T 0x0270U |
0.0381 * 2^LUX_SCALE
Definition at line 88 of file driver_tsl2561.c.
| #define TSL2561_LUX_B5T 0x016FU |
0.0224 * 2^LUX_SCALE
Definition at line 91 of file driver_tsl2561.c.
| #define TSL2561_LUX_B6T 0x00D2U |
0.0128 * 2^LUX_SCALE
Definition at line 94 of file driver_tsl2561.c.
| #define TSL2561_LUX_B7T 0x0018U |
0.00146 * 2^LUX_SCALE
Definition at line 97 of file driver_tsl2561.c.
| #define TSL2561_LUX_B8T 0x0000U |
0.000 * 2^LUX_SCALE
Definition at line 100 of file driver_tsl2561.c.
| #define TSL2561_LUX_CHSCALE 10 |
scale channel values by 2^10
Definition at line 75 of file driver_tsl2561.c.
| #define TSL2561_LUX_CHSCALE_TINT0 0x7517U |
322/11 * 2^TSL2561_LUX_CHSCALE
Definition at line 76 of file driver_tsl2561.c.
| #define TSL2561_LUX_CHSCALE_TINT1 0x0FE7U |
322/81 * 2^TSL2561_LUX_CHSCALE
Definition at line 77 of file driver_tsl2561.c.
| #define TSL2561_LUX_K1T 0x0040U |
0.125 * 2^RATIO_SCALE
Definition at line 78 of file driver_tsl2561.c.
| #define TSL2561_LUX_K2T 0x0080U |
0.250 * 2^RATIO_SCALE
Definition at line 81 of file driver_tsl2561.c.
| #define TSL2561_LUX_K3T 0x00C0U |
0.375 * 2^RATIO_SCALE
Definition at line 84 of file driver_tsl2561.c.
| #define TSL2561_LUX_K4T 0x0100U |
0.50 * 2^RATIO_SCALE
Definition at line 87 of file driver_tsl2561.c.
| #define TSL2561_LUX_K5T 0x0138U |
0.61 * 2^RATIO_SCALE
Definition at line 90 of file driver_tsl2561.c.
| #define TSL2561_LUX_K6T 0x019AU |
0.80 * 2^RATIO_SCALE
Definition at line 93 of file driver_tsl2561.c.
| #define TSL2561_LUX_K7T 0x029AU |
1.3 * 2^RATIO_SCALE
Definition at line 96 of file driver_tsl2561.c.
| #define TSL2561_LUX_K8T 0x029AU |
1.3 * 2^RATIO_SCALE
Definition at line 99 of file driver_tsl2561.c.
| #define TSL2561_LUX_LUXSCALE 14 |
scale by 2^14
Definition at line 73 of file driver_tsl2561.c.
| #define TSL2561_LUX_M1T 0x01BEU |
0.0272 * 2^LUX_SCALE
Definition at line 80 of file driver_tsl2561.c.
| #define TSL2561_LUX_M2T 0x02D1U |
0.0440 * 2^LUX_SCALE
Definition at line 83 of file driver_tsl2561.c.
| #define TSL2561_LUX_M3T 0x037BU |
0.0544 * 2^LUX_SCALE
Definition at line 86 of file driver_tsl2561.c.
| #define TSL2561_LUX_M4T 0x03FEU |
0.0624 * 2^LUX_SCALE
Definition at line 89 of file driver_tsl2561.c.
| #define TSL2561_LUX_M5T 0x01FCU |
0.0310 * 2^LUX_SCALE
Definition at line 92 of file driver_tsl2561.c.
| #define TSL2561_LUX_M6T 0x00FBU |
0.0153 * 2^LUX_SCALE
Definition at line 95 of file driver_tsl2561.c.
| #define TSL2561_LUX_M7T 0x0012U |
0.00112 * 2^LUX_SCALE
Definition at line 98 of file driver_tsl2561.c.
| #define TSL2561_LUX_M8T 0x0000U |
0.000 * 2^LUX_SCALE
Definition at line 101 of file driver_tsl2561.c.
| #define TSL2561_LUX_RATIOSCALE 9 |
scale ratio by 2^9
Definition at line 74 of file driver_tsl2561.c.
| #define TSL2561_REG_CONTROL 0x80 |
| #define TSL2561_REG_DATA0HIGH 0xED |
data 0 high register
Definition at line 64 of file driver_tsl2561.c.
| #define TSL2561_REG_DATA0LOW 0xEC |
data 0 low register
Definition at line 63 of file driver_tsl2561.c.
| #define TSL2561_REG_DATA1HIGH 0xEF |
data 1 high register
Definition at line 66 of file driver_tsl2561.c.
| #define TSL2561_REG_DATA1LOW 0xEE |
data 1 low register
Definition at line 65 of file driver_tsl2561.c.
| #define TSL2561_REG_ID 0x8A |
id register
Definition at line 62 of file driver_tsl2561.c.
| #define TSL2561_REG_INTERRUPT 0x86 |
interrupt register
Definition at line 61 of file driver_tsl2561.c.
| #define TSL2561_REG_THRESHHIGHHIGH 0xA5 |
thresh-high high register
Definition at line 60 of file driver_tsl2561.c.
| #define TSL2561_REG_THRESHHIGHLOW 0xA4 |
thresh-high low register
Definition at line 59 of file driver_tsl2561.c.
| #define TSL2561_REG_THRESHLOWHIGH 0xA3 |
thresh-low high register
Definition at line 58 of file driver_tsl2561.c.
| #define TSL2561_REG_THRESHLOWLOW 0xA2 |
thresh-low low register
Definition at line 57 of file driver_tsl2561.c.
| #define TSL2561_REG_TIMING 0x81 |
timing register
Definition at line 56 of file driver_tsl2561.c.