PebbleOS v4.48.0-75-g7416f78a1
Loading...
Searching...
No Matches

Sensortek W1160 Ambient light sensor driver. More...

Data Structures

struct  pbl_als_w1160_state
 W1160 driver state, owned by the driver. More...
 
struct  pbl_als_w1160
 W1160 ambient light sensor. More...
 

Macros

#define PBL_ALS_W1160_DEFINE(sym, _bus, _addr, _num, _den, _supply)
 Define a W1160.
 

Detailed Description

Sensortek W1160 Ambient light sensor driver.

While primed the sensor samples continuously and reads are plain register reads; otherwise each read is a one-shot conversion.


Data Structure Documentation

◆ pbl_als_w1160_state

struct pbl_als_w1160_state

W1160 driver state, owned by the driver.

Data Fields
bool active Primed.
bool cache_valid cached_level holds a reading from the current window.
uint16_t cached_level Last level read.
bool sampling Continuous sampling enabled.
uint64_t sampling_started_ticks Time continuous sampling was enabled.

◆ pbl_als_w1160

struct pbl_als_w1160

W1160 ambient light sensor.

Data Fields
struct pbl_als als Ambient light sensor, child of the I2C bus.
struct pbl_i2c_dev i2c I2C device.
struct pbl_als_w1160_state * state Driver state.
const struct pbl_regulator * supply Supply, or NULL.

Macro Definition Documentation

◆ PBL_ALS_W1160_DEFINE

#define PBL_ALS_W1160_DEFINE (   sym,
  _bus,
  _addr,
  _num,
  _den,
  _supply 
)
Value:
static struct pbl_als_w1160_state sym##_w1160_state; \
static const struct pbl_als_scale sym##_scale = {.num = (_num), .den = (_den)}; \
PBL_DEVICE_INSTANCE(sym, struct pbl_als_w1160, struct pbl_als, als) { \
.als = PBL_ALS_INIT(sym, "w1160", &(_bus)->dev, &pbl_als_w1160_ops, &sym##_scale), \
.state = &sym##_w1160_state, .i2c = PBL_I2C_DEV(_bus, _addr), .supply = (_supply), \
}
Ambient light sensor.
Definition driver.h:48
#define PBL_ALS_INIT(sym, _name, _parent, _ops, _scale)
Initialize a struct pbl_als.
Definition driver.h:81
#define PBL_ALS_STATE_DEFINE(sym)
Define the class state of an ambient light sensor.
Definition driver.h:64
W1160 ambient light sensor.
Definition w1160.h:38
W1160 driver state, owned by the driver.
Definition w1160.h:24
uint32_t num
Numerator.
Definition als.h:55
uint32_t den
Denominator.
Definition als.h:57
Raw count to lux calibration: lux = (raw - offset) * num / den.
Definition als.h:51
#define PBL_I2C_DEV(_bus, _addr)
Initializer for a struct pbl_i2c_dev.
Definition i2c.h:159

Define a W1160.

Parameters
symSymbol of the sensor.
_busI2C bus.
_addr7-bit I2C address.
_numNumerator of the lux per count, through the cover glass.
_denDenominator of the lux per count.
_supplySupply, or NULL.