Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_tag_lux_meter.c
1 #include <bc_tag_lux_meter.h>
2 
4 {
5  bc_opt3001_init(self, i2c_channel, (uint8_t) i2c_address);
6 }
7 
8 void bc_tag_lux_meter_set_event_handler(bc_tag_lux_meter_t *self, void (*event_handler)(bc_tag_lux_meter_t *, bc_tag_lux_meter_event_t, void *), void *event_param)
9 {
10  bc_opt3001_set_event_handler(self, (void (*)(bc_opt3001_t *, bc_opt3001_event_t, void *)) event_handler, event_param);
11 }
12 
14 {
15  bc_opt3001_set_update_interval(self, interval);
16 }
17 
19 {
20  return bc_opt3001_measure(self);
21 }
22 
24 {
25  return bc_opt3001_get_illuminance_raw(self, raw);
26 }
27 
29 {
30  return bc_opt3001_get_illuminance_lux(self, lux);
31 }
void bc_opt3001_set_event_handler(bc_opt3001_t *self, void(*event_handler)(bc_opt3001_t *, bc_opt3001_event_t, void *), void *event_param)
Set callback function.
Definition: bc_opt3001.c:26
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
bool bc_tag_lux_meter_measure(bc_tag_lux_meter_t *self)
Start measurement manually.
void bc_opt3001_set_update_interval(bc_opt3001_t *self, bc_tick_t interval)
Set measurement interval.
Definition: bc_opt3001.c:32
bool bc_opt3001_measure(bc_opt3001_t *self)
Start measurement manually.
Definition: bc_opt3001.c:48
void bc_tag_lux_meter_init(bc_tag_lux_meter_t *self, bc_i2c_channel_t i2c_channel, bc_tag_lux_meter_i2c_address_t i2c_address)
Initialize BigClown Lux Meter Tag.
bool bc_tag_lux_meter_get_illuminance_raw(bc_tag_lux_meter_t *self, uint16_t *raw)
Get measured illuminance as raw value.
bool bc_opt3001_get_illuminance_lux(bc_opt3001_t *self, float *lux)
Get measured illuminance in lux.
Definition: bc_opt3001.c:74
bc_tag_lux_meter_event_t
Callback events.
void bc_opt3001_init(bc_opt3001_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
Initialize OPT3001 driver.
Definition: bc_opt3001.c:11
bc_tag_lux_meter_i2c_address_t
I2C address.
bool bc_opt3001_get_illuminance_raw(bc_opt3001_t *self, uint16_t *raw)
Get measured illuminance as raw value.
Definition: bc_opt3001.c:62
bc_opt3001_t bc_tag_lux_meter_t
BigClown Lux Meter Tag instance.
bc_opt3001_event_t
Callback events.
Definition: bc_opt3001.h:13
void bc_tag_lux_meter_set_event_handler(bc_tag_lux_meter_t *self, void(*event_handler)(bc_tag_lux_meter_t *, bc_tag_lux_meter_event_t, void *), void *event_param)
Set callback function.
bc_i2c_channel_t
I2C channels.
Definition: bc_i2c.h:15
struct bc_opt3001_t bc_opt3001_t
OPT3001 instance.
Definition: bc_opt3001.h:25
bool bc_tag_lux_meter_get_illuminance_lux(bc_tag_lux_meter_t *self, float *lux)
Get measured illuminance in lux.
void bc_tag_lux_meter_set_update_interval(bc_tag_lux_meter_t *self, bc_tick_t interval)
Set measurement interval.