A simulator is a driver of a class with no hardware behind it: tests set what it reads, feed it data or watch what it is told to do through a simulator API next to its class. The emulator and native boards use them for the devices they do not emulate, and any board can swap one in for testing.
Class |
Kconfig |
Device |
API |
|---|---|---|---|
Accelerometer |
|
|
|
Ambient light |
|
|
|
Audio capture |
|
|
|
Battery |
|
|
|
Magnetometer |
|
|
|
Temperature |
|
|
|
Vibration |
|
|
|
Each simulator is a single device its driver defines, with no devicetree
node. A board or an application selects it for a role in its roles.yml
(see Devicetree) and enables it in
Kconfig:
accel:
symbol: SIM_ACCEL
include: pbl/drivers/imu/sim.h
Simulators know nothing of where their data comes from. On the emulator and
native boards, the QEMU host channel (pebble/comm/qemu/serial.c) decodes
the host’s messages and calls the simulator APIs, so the host tools drive
them unchanged. Unit tests call the same APIs directly.
Generated from PebbleOS f4926c952. This page is maintained in the pebbleos repository: docs/drivers/simulators.md.