pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • PebbleOS
  • Mobile App
  • Examples
  • Index 01
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

PebbleOS

  • Overview
  • Start here
    • Getting started guide
    • Playground
  • Development
    • The pbl CLI
    • Build system
    • Samples
    • Emulator and simulator
    • Testing
    • Debugging
    • Conventions
  • System
    • Architecture overview
    • Kernel
    • Subsystems
    • Drivers
      • Device model
      • Simulators
      • CRC
      • Crypto
      • Clocks
    • Services
    • Libraries
    • Third-party
    • Application SDK
  • Hardware
    • Boards
    • Programmers
  • Community
    • Contribution Guidelines
  • Reference
    • Reference
    • Kconfig options

Simulators

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

ACCEL_SIM

SIM_ACCEL

pbl/drivers/imu/sim.h

Ambient light

ALS_SIM

SIM_ALS

pbl/drivers/als/sim.h

Audio capture

AUDIO_SIM_MIC

SIM_MIC

pbl/drivers/audio/sim.h

Battery

BATTERY_SIM

pbl/drivers/battery/sim.h

Magnetometer

MAG_SIM

SIM_MAG

pbl/drivers/imu/sim.h

Temperature

TEMP_SIM

SIM_TEMP

pbl/drivers/temp/sim.h

Vibration

VIBE_SIM

SIM_VIBE

pbl/drivers/vibe/sim.h

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.