Firmware SDK
twr_tag_lux_meter.c
1 #include <twr_tag_lux_meter.h>
2 
4 {
5  twr_opt3001_init(self, i2c_channel, (uint8_t) i2c_address);
6 }
7 
8 void twr_tag_lux_meter_set_event_handler(twr_tag_lux_meter_t *self, void (*event_handler)(twr_tag_lux_meter_t *, twr_tag_lux_meter_event_t, void *), void *event_param)
9 {
10  twr_opt3001_set_event_handler(self, (void (*)(twr_opt3001_t *, twr_opt3001_event_t, void *)) event_handler, event_param);
11 }
12 
14 {
15  twr_opt3001_set_update_interval(self, interval);
16 }
17 
19 {
20  return twr_opt3001_measure(self);
21 }
22 
24 {
25  return twr_opt3001_get_illuminance_raw(self, raw);
26 }
27 
29 {
30  return twr_opt3001_get_illuminance_lux(self, lux);
31 }
twr_i2c_channel_t
I2C channels.
Definition: twr_i2c.h:16
void twr_opt3001_init(twr_opt3001_t *self, twr_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize OPT3001 driver.
Definition: twr_opt3001.c:11
void twr_opt3001_set_event_handler(twr_opt3001_t *self, void(*event_handler)(twr_opt3001_t *, twr_opt3001_event_t, void *), void *event_param)
Set callback function.
Definition: twr_opt3001.c:35
struct twr_opt3001_t twr_opt3001_t
OPT3001 instance.
Definition: twr_opt3001.h:25
void twr_opt3001_set_update_interval(twr_opt3001_t *self, twr_tick_t interval)
Set measurement interval.
Definition: twr_opt3001.c:41
bool twr_opt3001_get_illuminance_lux(twr_opt3001_t *self, float *lux)
Get measured illuminance in lux.
Definition: twr_opt3001.c:83
bool twr_opt3001_measure(twr_opt3001_t *self)
Start measurement manually.
Definition: twr_opt3001.c:57
twr_opt3001_event_t
Callback events.
Definition: twr_opt3001.h:14
bool twr_opt3001_get_illuminance_raw(twr_opt3001_t *self, uint16_t *raw)
Get measured illuminance as raw value.
Definition: twr_opt3001.c:71
bool twr_tag_lux_meter_get_illuminance_raw(twr_tag_lux_meter_t *self, uint16_t *raw)
Get measured illuminance as raw value.
twr_opt3001_t twr_tag_lux_meter_t
HARDWARIO Lux Meter Module instance.
bool twr_tag_lux_meter_measure(twr_tag_lux_meter_t *self)
Start measurement manually.
bool twr_tag_lux_meter_get_illuminance_lux(twr_tag_lux_meter_t *self, float *lux)
Get measured illuminance in lux.
twr_tag_lux_meter_event_t
Callback events.
void twr_tag_lux_meter_set_event_handler(twr_tag_lux_meter_t *self, void(*event_handler)(twr_tag_lux_meter_t *, twr_tag_lux_meter_event_t, void *), void *event_param)
Set callback function.
void twr_tag_lux_meter_init(twr_tag_lux_meter_t *self, twr_i2c_channel_t i2c_channel, twr_tag_lux_meter_i2c_address_t i2c_address)
Initialize HARDWARIO Lux Meter Module.
twr_tag_lux_meter_i2c_address_t
I2C address.
void twr_tag_lux_meter_set_update_interval(twr_tag_lux_meter_t *self, twr_tick_t interval)
Set measurement interval.
uint64_t twr_tick_t
Timestamp data type.
Definition: twr_tick.h:16