|
RocketLogger 2.1.0
|
#include <errno.h>#include <stdint.h>#include <string.h>#include <i2c/smbus.h>#include "../log.h"#include "sensor.h"#include "tsl4531.h"
Include dependency graph for tsl4531.c:Go to the source code of this file.
Functions | |
| int | tsl4531_set_range (int sensor_identifier, int range) |
| int | tsl4531_get_range (int sensor_identifier) |
| int | tsl4531_get_id (void) |
| int | tsl4531_set_parameters (int sensor_identifier) |
| int | tsl4531_send_range (int sensor_identifier, int range) |
| int | tsl4531_get_index (int sensor_identifier) |
| int | tsl4531_init (int sensor_identifier) |
| void | tsl4531_deinit (int sensor_identifier) |
| int | tsl4531_read (int sensor_identifier) |
| int32_t | tsl4531_get_value (int sensor_identifier, int channel) |
Variables | |
| const int | tsl4531_sensors [] = TSL4531_I2C_ADDRESSES |
| tsl4531_range_t | tsl4531_range [sizeof(tsl4531_sensors)] = {TSL4531_RANGE_AUTO} |
| tsl4531_range_t | tsl4531_auto_range [sizeof(tsl4531_sensors)] |
| uint8_t | tsl4531_multiplier [sizeof(tsl4531_sensors)] = {TSL4531_MULT_200} |
| int32_t | tsl4531_values [sizeof(tsl4531_sensors)] = {0} |
| void tsl4531_deinit | ( | int | sensor_identifier | ) |
| int tsl4531_get_id | ( | void | ) |
Get the device ID.
| sensor_identifier | The I2C address of the sensor |
Definition at line 262 of file tsl4531.c.
References rl_log(), RL_LOG_ERROR, sensor_bus, sensors_get_bus(), TSL4531_COMMAND, and TSL4531_REG_ID.
Referenced by tsl4531_init().
Here is the call graph for this function:| int tsl4531_get_index | ( | int | sensor_identifier | ) |
Get the index of the sensor with specified address.
| sensor_identifier | The sensor address used to look up the index |
Definition at line 368 of file tsl4531.c.
References tsl4531_sensors.
Referenced by tsl4531_get_range(), tsl4531_get_value(), tsl4531_read(), tsl4531_send_range(), and tsl4531_set_range().
| int tsl4531_get_range | ( | int | sensor_identifier | ) |
Get current measurement range.
| sensor_identifier | The I2C address of the sensor |
tsl4531_range Definition at line 252 of file tsl4531.c.
References tsl4531_auto_range, tsl4531_get_index(), and TSL4531_RANGE_AUTO.
Here is the call graph for this function:| int32_t tsl4531_get_value | ( | int | sensor_identifier, |
| int | channel | ||
| ) |
Get the values read from the sensor.
| sensor_identifier | The I2C address of the sensor |
| channel | The channel of the sensor to get |
Definition at line 227 of file tsl4531.c.
References tsl4531_get_index(), and tsl4531_values.
Here is the call graph for this function:| int tsl4531_init | ( | int | sensor_identifier | ) |
Initialize the light sensor.
| sensor_identifier | The I2C address of the sensor |
Definition at line 120 of file tsl4531.c.
References rl_log(), RL_LOG_ERROR, sensor_bus, sensors_get_bus(), sensors_init_comm(), tsl4531_get_id(), TSL4531_ID, and tsl4531_set_parameters().
Here is the call graph for this function:| int tsl4531_read | ( | int | sensor_identifier | ) |
Read the sensor values.
| sensor_identifier | The I2C address of the sensor |
Definition at line 161 of file tsl4531.c.
References data, ERROR, rl_log(), RL_LOG_ERROR, sensor_bus, sensors_get_bus(), sensors_init_comm(), tsl4531_auto_range, TSL4531_COMMAND, tsl4531_get_index(), tsl4531_multiplier, TSL4531_RANGE_AUTO, TSL4531_RANGE_HIGH, TSL4531_RANGE_HYSTERESIS, TSL4531_RANGE_LOW, TSL4531_RANGE_LOW_MAX, TSL4531_RANGE_MEDIUM, TSL4531_RANGE_MEDIUM_MAX, TSL4531_REG_DATALOW, tsl4531_send_range(), and tsl4531_values.
Here is the call graph for this function:| int tsl4531_send_range | ( | int | sensor_identifier, |
| int | range | ||
| ) |
Configure the range of the sensor.
| sensor_identifier | The I2C address of the sensor |
| range | The range tsl4531_range to set |
Definition at line 299 of file tsl4531.c.
References rl_log(), RL_LOG_ERROR, sensor_bus, sensors_get_bus(), tsl4531_auto_range, TSL4531_COMMAND, tsl4531_get_index(), TSL4531_INT_TIME_100, TSL4531_INT_TIME_200, TSL4531_INT_TIME_400, TSL4531_LOW_POWER, TSL4531_MULT_100, TSL4531_MULT_200, TSL4531_MULT_400, tsl4531_multiplier, TSL4531_RANGE_AUTO, TSL4531_RANGE_HIGH, TSL4531_RANGE_LOW, TSL4531_RANGE_MEDIUM, and TSL4531_REG_CONFIG.
Referenced by tsl4531_read(), and tsl4531_set_range().
Here is the call graph for this function:| int tsl4531_set_parameters | ( | int | sensor_identifier | ) |
Set the sensor parameter to default for continuous sensing.
| sensor_identifier | The I2C address of the sensor |
Definition at line 274 of file tsl4531.c.
References rl_log(), RL_LOG_ERROR, sensor_bus, sensors_get_bus(), TSL4531_COMMAND, TSL4531_RANGE_AUTO, TSL4531_REG_CONTROL, TSL4531_SAMPLE_CONTINUOUS, and tsl4531_set_range().
Referenced by tsl4531_init().
Here is the call graph for this function:| int tsl4531_set_range | ( | int | sensor_identifier, |
| int | range | ||
| ) |
Set mesurement range of light sensor.
| sensor_identifier | The I2C address of the sensor |
| range | The range tsl4531_range to set |
Definition at line 237 of file tsl4531.c.
References rl_log(), RL_LOG_ERROR, tsl4531_get_index(), and tsl4531_send_range().
Referenced by tsl4531_set_parameters().
Here is the call graph for this function:| tsl4531_range_t tsl4531_auto_range[sizeof(tsl4531_sensors)] |
Dynamic sensor range currently set if auto ranging is used.
Definition at line 107 of file tsl4531.c.
Referenced by tsl4531_get_range(), tsl4531_read(), and tsl4531_send_range().
| uint8_t tsl4531_multiplier[sizeof(tsl4531_sensors)] = {TSL4531_MULT_200} |
The measurement range dependent sensor value multiplier to use.
Definition at line 113 of file tsl4531.c.
Referenced by tsl4531_read(), and tsl4531_send_range().
| tsl4531_range_t tsl4531_range[sizeof(tsl4531_sensors)] = {TSL4531_RANGE_AUTO} |
| const int tsl4531_sensors[] = TSL4531_I2C_ADDRESSES |
Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. List of potentially connected TSL4531 sensors.
Definition at line 46 of file tsl4531.c.
Referenced by tsl4531_get_index().
| int32_t tsl4531_values[sizeof(tsl4531_sensors)] = {0} |
The sensor value data buffer.
Definition at line 118 of file tsl4531.c.
Referenced by tsl4531_get_value(), and tsl4531_read().