RocketLogger 2.1.3
tsl4531.h
Go to the documentation of this file.
1
32#ifndef SENSOR_TSL4531_H_
33#define SENSOR_TSL4531_H_
34
35#include <stdint.h>
36
37#define TSL4531_I2C_ADDRESS_LEFT 0x29
38#define TSL4531_I2C_ADDRESS_RIGHT 0x28
39
40#define TSL4531_I2C_ADDRESSES \
41 { (TSL4531_I2C_ADDRESS_LEFT), (TSL4531_I2C_ADDRESS_RIGHT) }
42
43#define TSL4531_CHANNEL_DEFAULT 0
44
45// register definitions
46#define TSL4531_ID 162
47
48#define TSL4531_COMMAND 0x80
49
50#define TSL4531_REG_CONTROL 0x00
51#define TSL4531_REG_CONFIG 0x01
52#define TSL4531_REG_DATALOW 0x04
53#define TSL4531_REG_DATAHIGH 0x05
54#define TSL4531_REG_ID 0x0A
55
56#define TSL4531_SAMPLE_OFF 0x00
57#define TSL4531_SAMPLE_SINGLE 0x2
58#define TSL4531_SAMPLE_CONTINUOUS 0x03
59
60#define TSL4531_HIGH_POWER 0x08
61#define TSL4531_LOW_POWER 0x00
62
63#define TSL4531_INT_TIME_100 0x02
64#define TSL4531_INT_TIME_200 0x01
65#define TSL4531_INT_TIME_400 0x00
66
67#define TSL4531_MULT_100 4
68#define TSL4531_MULT_200 2
69#define TSL4531_MULT_400 1
70
80
85
86#define TSL4531_RANGE_LOW_MAX 65000
87#define TSL4531_RANGE_MEDIUM_MAX 130000
88#define TSL4531_RANGE_HYSTERESIS 5000
89
96int tsl4531_init(int sensor_identifier);
97
103void tsl4531_deinit(int sensor_identifier);
104
111int tsl4531_read(int sensor_identifier);
112
120int32_t tsl4531_get_value(int sensor_identifier, int channel);
121
122#endif /* SENSOR_TSL4531_H_ */
enum tsl4531_range tsl4531_range_t
Definition tsl4531.h:84
int32_t tsl4531_get_value(int sensor_identifier, int channel)
Definition tsl4531.c:226
tsl4531_range
Definition tsl4531.h:74
@ TSL4531_RANGE_AUTO
Definition tsl4531.h:78
@ TSL4531_RANGE_LOW
Definition tsl4531.h:75
@ TSL4531_RANGE_HIGH
Definition tsl4531.h:77
@ TSL4531_RANGE_MEDIUM
Definition tsl4531.h:76
int tsl4531_init(int sensor_identifier)
Definition tsl4531.c:119
int tsl4531_read(int sensor_identifier)
Definition tsl4531.c:160
void tsl4531_deinit(int sensor_identifier)
Definition tsl4531.c:156