PebbleOS
Loading...
Searching...
No Matches

TI OPT3001 Ambient light sensor driver. More...

Data Structures

struct  pbl_opt3001
 OPT3001 ambient light sensor. More...
 

Macros

#define PBL_OPT3001_DEFINE(sym, _bus, _addr, _scale, ...)
 Define an OPT3001.
 

Detailed Description

TI OPT3001 Ambient light sensor driver.

PBL_OPT3001_DEFINE(s_opt3001, &s_i2c.bus, 0x44, nullptr, .always_on = true);
const struct pbl_als *const ALS = &s_opt3001.als;
#define PBL_OPT3001_DEFINE(sym, _bus, _addr, _scale,...)
Define an OPT3001.
Definition opt3001.h:47
Ambient light sensor.
Definition als.h:90
const struct pbl_als *const ALS
The board's ambient light sensor.

Data Structure Documentation

◆ pbl_opt3001

struct pbl_opt3001

OPT3001 ambient light sensor.

Data Fields
struct pbl_als als Ambient light sensor, child of the I2C bus.
bool always_on Convert continuously instead of once per read.
struct pbl_i2c_dev i2c I2C device.

Macro Definition Documentation

◆ PBL_OPT3001_DEFINE

#define PBL_OPT3001_DEFINE (   sym,
  _bus,
  _addr,
  _scale,
  ... 
)
Value:
const struct pbl_opt3001 sym = { \
.als = PBL_ALS_INIT(sym, "opt3001", &(_bus)->dev, &pbl_opt3001_ops, (_scale)), \
.i2c = PBL_I2C_DEV(_bus, _addr), \
__VA_ARGS__ \
}; \
PBL_DEVICE_REGISTER(sym, &sym.als.dev)
struct pbl_als als
Ambient light sensor, child of the I2C bus.
Definition opt3001.h:27
OPT3001 ambient light sensor.
Definition opt3001.h:25
struct pbl_device dev
Device.
Definition als.h:92
#define PBL_ALS_INIT(sym, _name, _parent, _ops, _scale)
Initialize a struct pbl_als.
Definition als.h:122
#define PBL_ALS_STATE_DEFINE(sym)
Define the class state of an ambient light sensor.
Definition als.h:109
#define PBL_I2C_DEV(_bus, _addr)
Initializer for a struct pbl_i2c_dev.
Definition i2c.h:135

Define an OPT3001.

Parameters
symSymbol of the instance; the sensor is sym.als.
_busI2C bus.
_addr7-bit I2C address.
_scaleLux calibration (const struct pbl_als_scale *), or nullptr.
...Designated initializers of the remaining fields: always_on.