PebbleOS
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
ambient_light.h File Reference
#include <stdbool.h>
#include <stdint.h>

Macros

#define AMBIENT_LIGHT_LEVEL_ENUM_COUNT   (AmbientLightLevelVeryLight + 1)
 Number of AmbientLightLevel values.
 

Enumerations

enum  AmbientLightLevel {
  AmbientLightLevelUnknown = 0 , AmbientLightLevelVeryDark , AmbientLightLevelDark , AmbientLightLevelLight ,
  AmbientLightLevelVeryLight
}
 Light level enum. More...
 

Functions

void ambient_light_init (void)
 Initialize the ambient light sensor.
 
uint32_t ambient_light_get_light_level (void)
 Read the light level.
 
void ambient_light_prime (void)
 Announce that readings will be wanted soon.
 
void ambient_light_release (void)
 Drop a reference taken with ambient_light_prime().
 
void ambient_light_suspend (void)
 Stop sampling until the matching ambient_light_resume().
 
void ambient_light_resume (void)
 Drop a reference taken with ambient_light_suspend().
 
void ambient_light_common_init (void)
 Initialize the reference counting common to all drivers.
 
void ambient_light_driver_set_state (bool active, bool sampling)
 Apply the sampling state computed by the common code.
 
uint32_t ambient_light_get_dark_threshold (void)
 Get the threshold between light and dark.
 
void ambient_light_set_dark_threshold (uint32_t new_threshold)
 Set the threshold between light and dark.
 
bool ambient_light_is_light ()
 Check whether it is light.
 
AmbientLightLevel ambient_light_level_to_enum (uint32_t light_level)
 Classify a light level against the dark threshold.
 
bool ambient_light_lux_available (void)
 Check whether the board has raw-count to lux coefficients.
 
uint32_t ambient_light_level_to_lux (uint32_t light_level)
 Convert a light level to lux using the board coefficients.
 

Variables

static const uint32_t AMBIENT_LIGHT_LEVEL_MAX = (1U << CONFIG_AMBIENT_LIGHT_BITS)
 Upper bound of the raw light level scale (CONFIG_AMBIENT_LIGHT_BITS bits).