Interface for ambient light sensor drivers.
More...
Interface for ambient light sensor drivers.
A driver embeds a struct pbl_als in its instance, sets it up with PBL_ALS_STATE_DEFINE() and PBL_ALS_INIT(), and implements the struct pbl_als_ops the class calls.
◆ pbl_als_state
Ambient light sensor runtime state.
| Data Fields |
|
struct pbl_mutex |
lock |
Device lock. |
|
uint16_t |
prime_count |
Prime references. |
|
uint16_t |
suspend_count |
Suspend references. |
◆ pbl_als
◆ PBL_ALS_INIT
| #define PBL_ALS_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_ops, |
|
|
|
_scale |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_als_state, \
.scale = (_scale), \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
Initialize a struct pbl_als.
- Parameters
-
| sym | Symbol of the instance, as passed to PBL_ALS_STATE_DEFINE(). |
| _name | Device name. |
| _parent | Parent device. |
| _ops | Driver operations. |
| _scale | Lux calibration, or NULL. |
◆ PBL_ALS_STATE_DEFINE
| #define PBL_ALS_STATE_DEFINE |
( |
|
sym | ) |
|
Value:
struct pbl_mutex lock
Device lock.
Definition driver.h:40
Ambient light sensor runtime state.
Definition driver.h:38
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50
Define the class state of an ambient light sensor.
- Parameters
-
| sym | Symbol of the instance. |