Firmware SDK
twr_tag_lux_meter

Driver for HARDWARIO Lux Meter Module. More...

Typedefs

typedef twr_opt3001_t twr_tag_lux_meter_t
 HARDWARIO Lux Meter Module instance.
 

Enumerations

enum  twr_tag_lux_meter_i2c_address_t {
  TWR_TAG_LUX_METER_I2C_ADDRESS_DEFAULT = 0x44 ,
  TWR_TAG_LUX_METER_I2C_ADDRESS_ALTERNATE = 0x45
}
 I2C address. More...
 
enum  twr_tag_lux_meter_event_t {
  TWR_TAG_LUX_METER_EVENT_ERROR = TWR_OPT3001_EVENT_ERROR ,
  TWR_TAG_LUX_METER_EVENT_UPDATE = TWR_OPT3001_EVENT_UPDATE
}
 Callback events. More...
 

Functions

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. More...
 
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. More...
 
void twr_tag_lux_meter_set_update_interval (twr_tag_lux_meter_t *self, twr_tick_t interval)
 Set measurement interval. More...
 
bool twr_tag_lux_meter_measure (twr_tag_lux_meter_t *self)
 Start measurement manually. More...
 
bool twr_tag_lux_meter_get_illuminance_raw (twr_tag_lux_meter_t *self, uint16_t *raw)
 Get measured illuminance as raw value. More...
 
bool twr_tag_lux_meter_get_illuminance_lux (twr_tag_lux_meter_t *self, float *lux)
 Get measured illuminance in lux. More...
 

Detailed Description

Driver for HARDWARIO Lux Meter Module.

Enumeration Type Documentation

◆ twr_tag_lux_meter_event_t

Callback events.

Enumerator
TWR_TAG_LUX_METER_EVENT_ERROR 

Error event.

TWR_TAG_LUX_METER_EVENT_UPDATE 

Update event.

Definition at line 24 of file twr_tag_lux_meter.h.

◆ twr_tag_lux_meter_i2c_address_t

I2C address.

Enumerator
TWR_TAG_LUX_METER_I2C_ADDRESS_DEFAULT 

Default I2C address.

TWR_TAG_LUX_METER_I2C_ADDRESS_ALTERNATE 

Alternate I2C address.

Definition at line 12 of file twr_tag_lux_meter.h.

Function Documentation

◆ twr_tag_lux_meter_get_illuminance_lux()

bool twr_tag_lux_meter_get_illuminance_lux ( twr_tag_lux_meter_t self,
float *  lux 
)

Get measured illuminance in lux.

Parameters
[in]selfInstance
[in]luxPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 28 of file twr_tag_lux_meter.c.

Here is the call graph for this function:

◆ twr_tag_lux_meter_get_illuminance_raw()

bool twr_tag_lux_meter_get_illuminance_raw ( twr_tag_lux_meter_t self,
uint16_t *  raw 
)

Get measured illuminance as raw value.

Parameters
[in]selfInstance
[in]rawPointer to variable where result will be stored
Returns
true When value is valid
false When value is invalid

Definition at line 23 of file twr_tag_lux_meter.c.

Here is the call graph for this function:

◆ twr_tag_lux_meter_init()

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.

Parameters
[in]selfInstance
[in]i2c_channelI2C channel
[in]i2c_addressI2C device address

Definition at line 3 of file twr_tag_lux_meter.c.

Here is the call graph for this function:

◆ twr_tag_lux_meter_measure()

bool twr_tag_lux_meter_measure ( twr_tag_lux_meter_t self)

Start measurement manually.

Parameters
[in]selfInstance
Returns
true On success
false When other measurement is in progress

Definition at line 18 of file twr_tag_lux_meter.c.

Here is the call graph for this function:

◆ twr_tag_lux_meter_set_event_handler()

void twr_tag_lux_meter_set_event_handler ( twr_tag_lux_meter_t self,
void(*)(twr_tag_lux_meter_t *, twr_tag_lux_meter_event_t, void *)  event_handler,
void *  event_param 
)

Set callback function.

Parameters
[in]selfInstance
[in]event_handlerFunction address
[in]event_paramOptional event parameter (can be NULL)

Definition at line 8 of file twr_tag_lux_meter.c.

Here is the call graph for this function:

◆ twr_tag_lux_meter_set_update_interval()

void twr_tag_lux_meter_set_update_interval ( twr_tag_lux_meter_t self,
twr_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 13 of file twr_tag_lux_meter.c.

Here is the call graph for this function: