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

Light service API. More...

#include <core/state.h>

Go to the source code of this file.

Macros

#define RECORD_LIGHT_SENSOR   "light_sensor"
 Record name for light sensor.
 

Typedefs

typedef struct LightSensor LightSensor
 LightSensor opaque pointer type.
 

Enumerations

enum  LightSensorLightWavelength { LightSensorLightWavelength600nm , LightSensorLightWavelength840nm }
 Light sensor wavelengths. More...
 

Functions

FuriState * light_sensor_get_state (LightSensor *instance)
 Get the state object containing the current light levels.
 
bool light_sensor_get_raw_data (LightSensor *instance, LightSensorLightWavelength wavelength, uint16_t *raw)
 Get the raw light sensor value.
 
bool light_sensor_sleep (LightSensor *instance, bool sleep)
 Enter low-power sleep mode.
 

Detailed Description

Light service API.

Enumeration Type Documentation

◆ LightSensorLightWavelength

Light sensor wavelengths.

Enumerator
LightSensorLightWavelength600nm 

600nm wavelength

LightSensorLightWavelength840nm 

840nm wavelength

Function Documentation

◆ light_sensor_get_raw_data()

bool light_sensor_get_raw_data ( LightSensor * instance,
LightSensorLightWavelength wavelength,
uint16_t * raw )

Get the raw light sensor value.

Parameters
[in]instancepointer to the LightSensor instance.
[in]wavelengthWavelength to read.
[out]rawRaw light sensor value.
Returns
True if successful, false otherwise.

◆ light_sensor_get_state()

FuriState * light_sensor_get_state ( LightSensor * instance)

Get the state object containing the current light levels.

The underlying data will be of LightSensorState type.

Parameters
[in]instancepointer to the LightSensor instance.
Returns
pointer to the state object

◆ light_sensor_sleep()

bool light_sensor_sleep ( LightSensor * instance,
bool sleep )

Enter low-power sleep mode.

Parameters
[in]instancepointer to the LightSensor instance.
[in]sleeptrue - sleep mode, false - normal operation mode.
Returns
True if successful, false otherwise.