Loading...
Searching...
No Matches
tsl4531x.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
39
40#include <stdint.h>
41
42#include "periph/i2c.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
51typedef enum {
52 TSL4531X_INTEGRATE_400MS = 0, /* 0b00 */
53 TSL4531X_INTEGRATE_200MS = 1, /* 0b01 */
54 TSL4531X_INTEGRATE_100MS = 2, /* 0b10 */
56
63#define TSL45311_PARTNO (0x8)
64#define TSL45313_PARTNO (0x9)
65#define TSL45315_PARTNO (0xA)
66#define TSL45317_PARTNO (0xB)
67
71#define TSL45311_ADDR (0x39)
72#define TSL45313_ADDR (0x39)
73#define TSL45315_ADDR (0x29)
74#define TSL45317_ADDR (0x29)
76
87
99
112
121int tsl4531x_set_low_power_mode(tsl4531x_t *dev, uint8_t low_power_on);
122
133
154
173
185
186#ifdef __cplusplus
187}
188#endif
189
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
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:51
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition tsl4531x.h:80
i2c_t i2c_dev
I2C device which is used.
Definition tsl4531x.h:81
tsl4531x_intgn_time_t integration_time
integration time
Definition tsl4531x.h:83
uint8_t part_number
part number, according to variant
Definition tsl4531x.h:85
i2c_t i2c_addr
I2C address of sensor.
Definition tsl4531x.h:82
uint8_t low_power_mode
low power mode
Definition tsl4531x.h:84
Device descriptor.
Definition tsl4531x.h:91
uint8_t high_power_mode_started_up
high power mode started up flag
Definition tsl4531x.h:96
i2c_t i2c_addr
I2C address of sensor.
Definition tsl4531x.h:93
uint32_t sample_start_time
sample start time
Definition tsl4531x.h:97
i2c_t i2c_dev
I2C device which is used.
Definition tsl4531x.h:92
tsl4531x_intgn_time_t integration_time
integration time
Definition tsl4531x.h:94
uint8_t low_power_mode
low power mode
Definition tsl4531x.h:95