Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_opt3001

Driver for OPT3001 ambient light sensor. More...

Typedefs

typedef struct bc_opt3001_t bc_opt3001_t
 OPT3001 instance.
 

Enumerations

enum  bc_opt3001_event_t {
  BC_OPT3001_EVENT_ERROR = 0,
  BC_OPT3001_EVENT_UPDATE = 1
}
 Callback events. More...
 

Functions

void bc_opt3001_init (bc_opt3001_t *self, bc_i2c_channel_t i2c_channel, uint8_t i2c_address)
 Initialize OPT3001 driver. More...
 
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. More...
 
void bc_opt3001_set_update_interval (bc_opt3001_t *self, bc_tick_t interval)
 Set measurement interval. More...
 
bool bc_opt3001_measure (bc_opt3001_t *self)
 Start measurement manually. More...
 
bool bc_opt3001_get_illuminance_raw (bc_opt3001_t *self, uint16_t *raw)
 Get measured illuminance as raw value. More...
 
bool bc_opt3001_get_illuminance_lux (bc_opt3001_t *self, float *lux)
 Get measured illuminance in lux. More...
 

Detailed Description

Driver for OPT3001 ambient light sensor.

Enumeration Type Documentation

Callback events.

Enumerator
BC_OPT3001_EVENT_ERROR 

Error event.

BC_OPT3001_EVENT_UPDATE 

Update event.

Definition at line 13 of file bc_opt3001.h.

Function Documentation

bool bc_opt3001_get_illuminance_lux ( bc_opt3001_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 74 of file bc_opt3001.c.

Referenced by bc_module_climate_get_illuminance_lux(), and bc_tag_lux_meter_get_illuminance_lux().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_opt3001_get_illuminance_raw ( bc_opt3001_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 62 of file bc_opt3001.c.

Referenced by bc_opt3001_get_illuminance_lux(), and bc_tag_lux_meter_get_illuminance_raw().

Here is the caller graph for this function:

void bc_opt3001_init ( bc_opt3001_t self,
bc_i2c_channel_t  i2c_channel,
uint8_t  i2c_address 
)

Initialize OPT3001 driver.

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

Definition at line 11 of file bc_opt3001.c.

Referenced by bc_module_climate_init(), and bc_tag_lux_meter_init().

Here is the call graph for this function:

Here is the caller graph for this function:

bool bc_opt3001_measure ( bc_opt3001_t self)

Start measurement manually.

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

Definition at line 48 of file bc_opt3001.c.

Referenced by bc_module_climate_measure_all_sensors(), bc_module_climate_measure_lux_meter(), bc_opt3001_set_update_interval(), and bc_tag_lux_meter_measure().

Here is the call graph for this function:

Here is the caller graph for this function:

void bc_opt3001_set_event_handler ( bc_opt3001_t self,
void(*)(bc_opt3001_t *, bc_opt3001_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 26 of file bc_opt3001.c.

Referenced by bc_module_climate_init(), and bc_tag_lux_meter_set_event_handler().

Here is the caller graph for this function:

void bc_opt3001_set_update_interval ( bc_opt3001_t self,
bc_tick_t  interval 
)

Set measurement interval.

Parameters
[in]selfInstance
[in]intervalMeasurement interval

Definition at line 32 of file bc_opt3001.c.

Referenced by bc_module_climate_set_update_interval_all_sensors(), bc_module_climate_set_update_interval_lux_meter(), and bc_tag_lux_meter_set_update_interval().

Here is the call graph for this function:

Here is the caller graph for this function: