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
9#pragma once
10
42
43#include <stdint.h>
44
45#include "periph/i2c.h"
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
54typedef enum {
55 TSL4531X_INTEGRATE_400MS = 0, /* 0b00 */
56 TSL4531X_INTEGRATE_200MS = 1, /* 0b01 */
57 TSL4531X_INTEGRATE_100MS = 2, /* 0b10 */
59
66#define TSL45311_PARTNO (0x8)
67#define TSL45313_PARTNO (0x9)
68#define TSL45315_PARTNO (0xA)
69#define TSL45317_PARTNO (0xB)
70
74#define TSL45311_ADDR (0x39)
75#define TSL45313_ADDR (0x39)
76#define TSL45315_ADDR (0x29)
77#define TSL45317_ADDR (0x29)
79
90
102
115
124int tsl4531x_set_low_power_mode(tsl4531x_t *dev, uint8_t low_power_on);
125
136
157
176
188
189#ifdef __cplusplus
190}
191#endif
192
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:144
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:54
Low-level I2C peripheral driver interface definition.
Device initialization parameters.
Definition tsl4531x.h:83
i2c_t i2c_dev
I2C device which is used.
Definition tsl4531x.h:84
tsl4531x_intgn_time_t integration_time
integration time
Definition tsl4531x.h:86
uint8_t part_number
part number, according to variant
Definition tsl4531x.h:88
i2c_t i2c_addr
I2C address of sensor.
Definition tsl4531x.h:85
uint8_t low_power_mode
low power mode
Definition tsl4531x.h:87
Device descriptor.
Definition tsl4531x.h:94
uint8_t high_power_mode_started_up
high power mode started up flag
Definition tsl4531x.h:99
i2c_t i2c_addr
I2C address of sensor.
Definition tsl4531x.h:96
uint32_t sample_start_time
sample start time
Definition tsl4531x.h:100
i2c_t i2c_dev
I2C device which is used.
Definition tsl4531x.h:95
tsl4531x_intgn_time_t integration_time
integration time
Definition tsl4531x.h:97
uint8_t low_power_mode
low power mode
Definition tsl4531x.h:98