Loading...
Searching...
No Matches
si1133.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 iosabi
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
29
30#include "periph/i2c.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
47
51typedef enum {
52 SI1133_SENS_SMALL_IR = 1u << 0,
53 SI1133_SENS_MEDIUM_IR = 1u << 1,
54 SI1133_SENS_LARGE_IR = 1u << 2,
55 SI1133_SENS_WHITE = 1u << 3,
56 SI1133_SENS_LARGE_WHITE = 1u << 4,
57 SI1133_SENS_UV = 1u << 5,
58 SI1133_SENS_DEEP_UV = 1u << 6,
60
96
100typedef struct {
109 uint8_t address;
111
115typedef struct {
116 /* Initialization parameters */
118 uint8_t address;
119 /* Internal members */
120 uint8_t cmd_counter;
121 uint8_t num_channels;
123} si1133_t;
124
134
149 const si1133_channel_t *channels,
150 uint32_t num_channels);
151
172 si1133_sensor_t sensor_mask,
173 uint8_t sample_time_log,
174 uint8_t sw_gain);
175
199 uint32_t num_channels);
200
201#ifdef __cplusplus
202}
203#endif
204
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
si1133_sensor_t
Sensor (photodiode combination) in the Si1133 package.
Definition si1133.h:51
si1133_ret_code_t
Driver error return codes.
Definition si1133.h:39
si1133_ret_code_t si1133_configure_channels(si1133_t *dev, const si1133_channel_t *channels, uint32_t num_channels)
Configure the capture channels.
si1133_ret_code_t si1133_easy_configure(si1133_t *dev, si1133_sensor_t sensor_mask, uint8_t sample_time_log, uint8_t sw_gain)
Convenience function to configure all capture channels.
si1133_ret_code_t si1133_capture_sensors(si1133_t *dev, int32_t *values, uint32_t num_channels)
Perform a one-time blocking sample of the configured channels.
si1133_ret_code_t si1133_init(si1133_t *dev, const si1133_params_t *params)
Initialize the given Si1133 device.
@ SI1133_ERR_I2C
I2C communication error.
Definition si1133.h:42
@ SI1133_OK
No error.
Definition si1133.h:40
@ SI1133_ERR_PARAMS
Invalid parameters.
Definition si1133.h:41
@ SI1133_ERR_LOGIC
Device communication logic error.
Definition si1133.h:43
@ SI1133_ERR_NODEV
No SI1133 device detected.
Definition si1133.h:44
@ SI1133_ERR_OVERFLOW
ADC overflow when sampling.
Definition si1133.h:45
Low-level I2C peripheral driver interface definition.
Channel configuration the Si1133 sensor.
Definition si1133.h:91
uint8_t sample_time_log
Log2 of sampling time, 0 to 14.
Definition si1133.h:92
si1133_sensor_t sensor
Sensor to sample.
Definition si1133.h:94
uint8_t sw_gain
Software gain, 0 to 7.
Definition si1133.h:93
Device initialization parameters.
Definition si1133.h:100
uint8_t address
sensor address.
Definition si1133.h:109
i2c_t i2c_dev
I2C bus the sensor is connected to.
Definition si1133.h:101
Device descriptor for the Si1133 sensor.
Definition si1133.h:115
uint8_t cmd_counter
Si1133 command counter.
Definition si1133.h:120
si1133_channel_t channel[6]
Channel configuration.
Definition si1133.h:122
uint8_t address
sensor address
Definition si1133.h:118
uint8_t num_channels
Number of configured channels.
Definition si1133.h:121
i2c_t i2c_dev
I2C bus the sensor is connected to.
Definition si1133.h:117