I²C driver for the VEML7700 ambiant light sensor. More...
#include <stddef.h>#include <stdint.h>#include <string.h>#include "i2c_bus.h"#include "esp_err.h"#include "esp_log.h"Go to the source code of this file.
Data Structures | |
| struct | veml7700_config_t |
| Configuration structure for the VEML7700 sensor. More... | |
| struct | veml7700_dev_t |
| Device handle structure for the VEML7700 sensor. More... | |
Macros | |
| #define | VEML7700_I2C_ADDR (0x10) |
| Default I²C address for VEML7700 sensors. | |
Integration Time Constants | |
Integration times for the VEML7700 sensor. | |
| #define | VEML7700_INTEGRATION_TIME_25MS (0b1100) |
| 25 ms | |
| #define | VEML7700_INTEGRATION_TIME_50MS (0b1000) |
| 50 ms | |
| #define | VEML7700_INTEGRATION_TIME_100MS (0b0000) |
| 100 ms | |
| #define | VEML7700_INTEGRATION_TIME_200MS (0b0001) |
| 200 ms | |
| #define | VEML7700_INTEGRATION_TIME_400MS (0b0010) |
| 400 ms | |
| #define | VEML7700_INTEGRATION_TIME_800MS (0b0011) |
| 800 ms | |
Gain Constants | |
Gain settings for the VEML7700 sensor. | |
| #define | VEML7700_GAIN_1 (0b00) |
| x1 gain | |
| #define | VEML7700_GAIN_2 (0b01) |
| x2 gain | |
| #define | VEML7700_GAIN_DIV_8 (0b10) |
| /8 gain | |
| #define | VEML7700_GAIN_DIV_4 (0b11) |
| /4 gain | |
Power Saving Mode Constants | |
Power saving modes for the sensor. | |
| #define | VEML7700_POWER_SAVING_MODE_500MS (0b00) |
| 500 ms interval | |
| #define | VEML7700_POWER_SAVING_MODE_1000MS (0b01) |
| 1000 ms interval | |
| #define | VEML7700_POWER_SAVING_MODE_2000MS (0b10) |
| 2000 ms interval | |
| #define | VEML7700_POWER_SAVING_MODE_4000MS (0b11) |
| 4000 ms interval | |
Persistence Protection Constants | |
Number of consecutive samples before triggering an interrupt. | |
| #define | VEML7700_PERSISTENCE_PROTECTION_1 (0b00) |
| 1 sample | |
| #define | VEML7700_PERSISTENCE_PROTECTION_2 (0b01) |
| 2 samples | |
| #define | VEML7700_PERSISTENCE_PROTECTION_4 (0b10) |
| 4 samples | |
| #define | VEML7700_PERSISTENCE_PROTECTION_8 (0b11) |
| 8 samples | |
Typedefs | |
| typedef uint8_t | i2c_addr_t |
| Type for I²C addresses. | |
| typedef uint32_t | ill_lx_t |
| Type for illuminance [lx]. | |
| typedef void * | veml7700_handle_t |
| Opaque handle for a VEML7700 sensor. | |
Functions | |
| veml7700_handle_t | veml7700_i2c_create (i2c_bus_handle_t bus, i2c_addr_t dev_addr) |
| Create a VEML7700 device handle for I²C communication. | |
| veml7700_handle_t | veml7700_i2c_init (i2c_bus_handle_t bus, i2c_addr_t dev_addr) |
| Initialize the VEML7700 sensor over I²C. | |
| void | veml7700_i2c_delete (veml7700_handle_t sensor) |
| Deinitialize the VEML7700 sensor and free resources. | |
| esp_err_t | veml7700_i2c_probe (veml7700_handle_t sensor) |
| Probe if the sensor exist on the I²C bus. | |
| esp_err_t | veml7700_i2c_write_config (veml7700_handle_t sensor, veml7700_config_t *cfg) |
| Write the configuration to the sensor. | |
| esp_err_t | veml7700_i2c_read_config (veml7700_handle_t sensor, veml7700_config_t *cfg) |
| Read the sensor configuration. | |
| esp_err_t | veml7700_i2c_read_ambient_light (veml7700_handle_t sensor, ill_lx_t *val) |
| Read ambiant light value from the sensor. | |
| esp_err_t | veml7700_i2c_read_white_channel (veml7700_handle_t sensor, ill_lx_t *val) |
| Read white channel value from the sensor. | |
| esp_err_t | veml7700_i2c_read_interrupt_status (veml7700_handle_t sensor, bool *low, bool *high) |
| Read the interrupt status from the sensor. | |
I²C driver for the VEML7700 ambiant light sensor.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.