BSB Developer Docs
Loading...
Searching...
No Matches
light_sensor_data.h File Reference

Data structure containing various light sensor values. More...

Go to the source code of this file.

Macros

#define LIGHT_SENSOR_DATA_LUX_MIN   (1.0f)
 Minimum light intensity value, in lux.
 
#define LIGHT_SENSOR_DATA_LUX_MAX   (10000.0f)
 Maximum light intensity value, in lux.
 
#define LIGHT_SENSOR_DATA_WINDOW_SIZE   (5)
 Number of data points for the sliding average.
 

Typedefs

typedef struct LightSensorData LightSensorData
 Light sensor data structure.
 

Functions

LightSensorData * light_sensor_data_alloc (void)
 Allocate a new LightSensorData instance.
 
void light_sensor_data_add_measurement (LightSensorData *instance, float lux)
 Add a new light measurement.
 
void light_sensor_data_get_state (const LightSensorData *instance, LightSensorState *state)
 Get the current light sensor state.
 

Detailed Description

Data structure containing various light sensor values.

Function Documentation

◆ light_sensor_data_add_measurement()

void light_sensor_data_add_measurement ( LightSensorData * instance,
float lux )

Add a new light measurement.

Parameters
[in,out]instancePointer to the LightSensorData instance.
[in]luxLight level in lux.

◆ light_sensor_data_alloc()

LightSensorData * light_sensor_data_alloc ( void )

Allocate a new LightSensorData instance.

Returns
Pointer to the allocated LightSensorData instance.

◆ light_sensor_data_get_state()

void light_sensor_data_get_state ( const LightSensorData * instance,
LightSensorState * state )

Get the current light sensor state.

Parameters
[in]instancePointer to the LightSensorData instance.
[out]statePointer to the state object to be copied into (must be allocated).