Loading...
Searching...
No Matches
tsl4531x.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Freie Universität Berlin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
41#ifndef TSL4531X_H
42#define TSL4531X_H
43
44#include <stdint.h>
45
46#include "periph/i2c.h"
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
55typedef enum {
56 TSL4531X_INTEGRATE_400MS = 0, /* 0b00 */
57 TSL4531X_INTEGRATE_200MS = 1, /* 0b01 */
58 TSL4531X_INTEGRATE_100MS = 2, /* 0b10 */
60
67#define TSL45311_PARTNO (0x8)
68#define TSL45313_PARTNO (0x9)
69#define TSL45315_PARTNO (0xA)
70#define TSL45317_PARTNO (0xB)
71
75#define TSL45311_ADDR (0x39)
76#define TSL45313_ADDR (0x39)
77#define TSL45315_ADDR (0x29)
78#define TSL45317_ADDR (0x29)
91
103
116
125int tsl4531x_set_low_power_mode(tsl4531x_t *dev, uint8_t low_power_on);
126
137
158
177
189
190#ifdef __cplusplus
191}
192#endif
193
194#endif /* TSL4531X_H */
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
int tsl4531x_get_sample(const tsl4531x_t *dev)
Reads the sample from the device immediately.
int tsl4531x_init(tsl4531x_t *dev, const tsl4531x_params_t *params)
Initialize the TSL4531x device.
int tsl4531x_start_sample(tsl4531x_t *dev)
Start collecting sample in low power mode.
int tsl4531x_set_low_power_mode(tsl4531x_t *dev, uint8_t low_power_on)
Set the low power mode of the driver on or off.
uint32_t tsl4531x_time_until_sample_ready(tsl4531x_t *dev)
Deliver time in microseconds until sample is ready, or zero if it is ready.
int tsl4531x_simple_read(tsl4531x_t *dev)
Reads the sample from the device.
tsl4531x_intgn_time_t
Integration times.
Definition tsl4531x.h:55
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition tsl4531x.h:84
i2c_t i2c_dev
I2C device which is used.
Definition tsl4531x.h:85
tsl4531x_intgn_time_t integration_time
integration time
Definition tsl4531x.h:87
uint8_t part_number
part number, according to variant
Definition tsl4531x.h:89
i2c_t i2c_addr
I2C address of sensor.
Definition tsl4531x.h:86
uint8_t low_power_mode
low power mode
Definition tsl4531x.h:88
Device descriptor.
Definition tsl4531x.h:95
uint8_t high_power_mode_started_up
high power mode started up flag
Definition tsl4531x.h:100
i2c_t i2c_addr
I2C address of sensor.
Definition tsl4531x.h:97
uint32_t sample_start_time
sample start time
Definition tsl4531x.h:101
i2c_t i2c_dev
I2C device which is used.
Definition tsl4531x.h:96
tsl4531x_intgn_time_t integration_time
integration time
Definition tsl4531x.h:98
uint8_t low_power_mode
low power mode
Definition tsl4531x.h:99