|
RocketLogger
1.1
|
#include <errno.h>#include <math.h>#include <stdint.h>#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <linux/i2c-dev.h>#include <sys/ioctl.h>#include <sys/stat.h>#include <sys/types.h>#include "../log.h"#include "../types.h"
Include dependency graph for tsl4531.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | TSL4531_I2C_ADDRESS_LEFT 0x29 |
| #define | TSL4531_I2C_ADDRESS_RIGHT 0x28 |
| #define | TSL4531_I2C_ADDRESSES { (TSL4531_I2C_ADDRESS_LEFT), (TSL4531_I2C_ADDRESS_RIGHT) } |
| #define | TSL4531_CHANNEL_DEFAULT 0 |
| #define | TSL4531_ID 162 |
| #define | TSL4531_COMMAND 0x80 |
| #define | TSL4531_REG_CONTROL 0x00 |
| #define | TSL4531_REG_CONFIG 0x01 |
| #define | TSL4531_REG_DATALOW 0x04 |
| #define | TSL4531_REG_DATAHIGH 0x05 |
| #define | TSL4531_REG_ID 0x0A |
| #define | TSL4531_SAMPLE_OFF 0x00 |
| #define | TSL4531_SAMPLE_SINGLE 0x2 |
| #define | TSL4531_SAMPLE_CONTINUOUS 0x03 |
| #define | TSL4531_HIGH_POWER 0x08 |
| #define | TSL4531_LOW_POWER 0x00 |
| #define | TSL4531_INT_TIME_100 0x02 |
| #define | TSL4531_INT_TIME_200 0x01 |
| #define | TSL4531_INT_TIME_400 0x00 |
| #define | TSL4531_MULT_100 4 |
| #define | TSL4531_MULT_200 2 |
| #define | TSL4531_MULT_400 1 |
| #define | TSL4531_RANGE_LOW_MAX 65000 |
| #define | TSL4531_RANGE_MEDIUM_MAX 130000 |
| #define | TSL4531_RANGE_HYSTERESIS 5000 |
Enumerations | |
| enum | TSL4531_range { TSL4531_RANGE_LOW, TSL4531_RANGE_MEDIUM, TSL4531_RANGE_HIGH, TSL4531_RANGE_AUTO } |
Functions | |
| int | TSL4531_init (int) |
| void | TSL4531_close (int) |
| int | TSL4531_read (int) |
| int32_t | TSL4531_getValue (int, int) |
| int | TSL4531_setRange (int, int) |
| int | TSL4531_getRange (int) |
| int | TSL4531_getID (void) |
| int | TSL4531_setParameters (int) |
| int | TSL4531_sendRange (int, int) |
| int | TSL4531_getIndex (int) |
| #define TSL4531_COMMAND 0x80 |
Definition at line 60 of file tsl4531.h.
Referenced by TSL4531_getID(), TSL4531_read(), TSL4531_sendRange(), and TSL4531_setParameters().
| #define TSL4531_I2C_ADDRESS_LEFT 0x29 |
Copyright (c) 2016-2017, Swiss Federal Institute of Technology (ETH Zurich) 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.
| #define TSL4531_I2C_ADDRESSES { (TSL4531_I2C_ADDRESS_LEFT), (TSL4531_I2C_ADDRESS_RIGHT) } |
| #define TSL4531_ID 162 |
Definition at line 58 of file tsl4531.h.
Referenced by TSL4531_init().
| #define TSL4531_INT_TIME_100 0x02 |
Definition at line 75 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_INT_TIME_200 0x01 |
Definition at line 76 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_INT_TIME_400 0x00 |
Definition at line 77 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_LOW_POWER 0x00 |
Definition at line 73 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_MULT_100 4 |
Definition at line 79 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_MULT_200 2 |
Definition at line 80 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_MULT_400 1 |
Definition at line 81 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_RANGE_HYSTERESIS 5000 |
Definition at line 94 of file tsl4531.h.
Referenced by TSL4531_read().
| #define TSL4531_RANGE_LOW_MAX 65000 |
Definition at line 92 of file tsl4531.h.
Referenced by TSL4531_read().
| #define TSL4531_RANGE_MEDIUM_MAX 130000 |
Definition at line 93 of file tsl4531.h.
Referenced by TSL4531_read().
| #define TSL4531_REG_CONFIG 0x01 |
Definition at line 63 of file tsl4531.h.
Referenced by TSL4531_sendRange().
| #define TSL4531_REG_CONTROL 0x00 |
Definition at line 62 of file tsl4531.h.
Referenced by TSL4531_setParameters().
| #define TSL4531_REG_DATALOW 0x04 |
Definition at line 64 of file tsl4531.h.
Referenced by TSL4531_read().
| #define TSL4531_REG_ID 0x0A |
Definition at line 66 of file tsl4531.h.
Referenced by TSL4531_getID().
| #define TSL4531_SAMPLE_CONTINUOUS 0x03 |
Definition at line 70 of file tsl4531.h.
Referenced by TSL4531_setParameters().
| enum TSL4531_range |
| void TSL4531_close | ( | int | sensor_identifier | ) |
| int TSL4531_getID | ( | void | ) |
Get the device ID
| sensor_identifier | The I2C address of the sensor |
Definition at line 215 of file tsl4531.c.
References ERROR, rl_log(), sensor_bus, Sensors_getSharedBus(), TSL4531_COMMAND, and TSL4531_REG_ID.
Referenced by TSL4531_init().
Here is the call graph for this function:| int TSL4531_getIndex | ( | 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 321 of file tsl4531.c.
References TSL4531_sensors.
Referenced by TSL4531_getRange(), TSL4531_getValue(), TSL4531_read(), TSL4531_sendRange(), and TSL4531_setRange().
| int TSL4531_getRange | ( | int | sensor_identifier | ) |
Get current range
| sensor_identifier | The I2C address of the sensor |
Definition at line 200 of file tsl4531.c.
References TSL4531_auto_range, TSL4531_getIndex(), and TSL4531_RANGE_AUTO.
Here is the call graph for this function:| int32_t TSL4531_getValue | ( | 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 165 of file tsl4531.c.
References TSL4531_getIndex(), 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 51 of file tsl4531.c.
References ERROR, FAILURE, rl_log(), sensor_bus, Sensors_getSharedBus(), Sensors_initSharedComm(), SUCCESS, TSL4531_getID(), TSL4531_ID, and TSL4531_setParameters().
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 96 of file tsl4531.c.
References ERROR, FAILURE, rl_log(), sensor_bus, Sensors_getSharedBus(), Sensors_initSharedComm(), SUCCESS, TSL4531_auto_range, TSL4531_COMMAND, TSL4531_getIndex(), 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_sendRange(), and TSL4531_values.
Here is the call graph for this function:| int TSL4531_sendRange | ( | 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 260 of file tsl4531.c.
References ERROR, FAILURE, rl_log(), sensor_bus, Sensors_getSharedBus(), SUCCESS, TSL4531_auto_range, TSL4531_COMMAND, TSL4531_getIndex(), 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_setRange().
Here is the call graph for this function:| int TSL4531_setParameters | ( | int | sensor_identifier | ) |
Set the sensor parameter to default for continuous sensing.
| sensor_identifier | The I2C address of the sensor |
Definition at line 232 of file tsl4531.c.
References ERROR, FAILURE, rl_log(), sensor_bus, Sensors_getSharedBus(), SUCCESS, TSL4531_COMMAND, TSL4531_RANGE_AUTO, TSL4531_REG_CONTROL, TSL4531_SAMPLE_CONTINUOUS, and TSL4531_setRange().
Referenced by TSL4531_init().
Here is the call graph for this function:| int TSL4531_setRange | ( | int | sensor_identifier, |
| int | range | ||
| ) |
Set range of light sensor
| sensor_identifier | The I2C address of the sensor |
| range | The range TSL4531_range to set |
Definition at line 181 of file tsl4531.c.
References ERROR, FAILURE, rl_log(), SUCCESS, TSL4531_getIndex(), and TSL4531_sendRange().
Referenced by TSL4531_setParameters().
Here is the call graph for this function: