PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
Simulators

Simulated sensors, measuring what their simulator API sets. More...

Data Structures

struct  pbl_accel_sim_sample
 Simulated accelerometer sample. More...
 

Macros

#define SIM_TEMP   (&pbl_temp_sim)
 The simulated temperature sensor, at 25 degrees Celsius until set.
 
#define SIM_MAG   (&pbl_mag_sim)
 The simulated magnetometer, measuring no field until set.
 
#define PBL_ACCEL_SIM_QUEUE_SIZE   256U
 Number of samples the replay queue of the simulated accelerometer holds.
 
#define SIM_ACCEL   (&pbl_accel_sim)
 The simulated accelerometer, replaying the samples and events it is fed.
 

Functions

void pbl_temp_sim_set (const struct pbl_sensor *sensor, int32_t millicelsius)
 Set the temperature the simulated temperature sensor reads.
 
void pbl_mag_sim_set (const struct pbl_sensor *sensor, int32_t x, int32_t y, int32_t z)
 Set the magnetic field the simulated magnetometer measures.
 
size_t pbl_accel_sim_feed (const struct pbl_sensor *sensor, const struct pbl_accel_sim_sample *samples, size_t count)
 Queue samples for the simulated accelerometer to replay.
 
void pbl_accel_sim_flush (const struct pbl_sensor *sensor)
 Drop the queued samples, keeping the last one replayed latched.
 
void pbl_accel_sim_report_event (const struct pbl_sensor *sensor, const struct pbl_sensor_event *event)
 Report an event, as if the simulated accelerometer detected it.
 

Detailed Description

Simulated sensors, measuring what their simulator API sets.


Data Structure Documentation

◆ pbl_accel_sim_sample

struct pbl_accel_sim_sample

Simulated accelerometer sample.

Data Fields
int16_t x Acceleration along the x axis, in milli-g.
int16_t y Acceleration along the y axis, in milli-g.
int16_t z Acceleration along the z axis, in milli-g.

Macro Definition Documentation

◆ PBL_ACCEL_SIM_QUEUE_SIZE

#define PBL_ACCEL_SIM_QUEUE_SIZE   256U

Number of samples the replay queue of the simulated accelerometer holds.

◆ SIM_ACCEL

#define SIM_ACCEL   (&pbl_accel_sim)

The simulated accelerometer, replaying the samples and events it is fed.

Fed samples are replayed one per sampling interval, the last one being latched once the queue runs out: a device lying still, face up, until the first one. The simulated part has no FIFO: it reports every frame while it has a sampling frequency and a report latency.

◆ SIM_MAG

#define SIM_MAG   (&pbl_mag_sim)

The simulated magnetometer, measuring no field until set.

While sampling, the field is reported once per sampling interval, whatever the report latency.

◆ SIM_TEMP

#define SIM_TEMP   (&pbl_temp_sim)

The simulated temperature sensor, at 25 degrees Celsius until set.

Function Documentation

◆ pbl_accel_sim_feed()

size_t pbl_accel_sim_feed ( const struct pbl_sensor *  sensor,
const struct pbl_accel_sim_sample *  samples,
size_t  count 
)

Queue samples for the simulated accelerometer to replay.

Samples that do not fit in the queue are dropped.

Parameters
sensorSensor.
samplesSamples, in the device frame.
countNumber of samples.
Returns
Number of samples queued.

◆ pbl_accel_sim_flush()

void pbl_accel_sim_flush ( const struct pbl_sensor *  sensor)

Drop the queued samples, keeping the last one replayed latched.

Parameters
sensorSensor.

◆ pbl_accel_sim_report_event()

void pbl_accel_sim_report_event ( const struct pbl_sensor *  sensor,
const struct pbl_sensor_event *  event 
)

Report an event, as if the simulated accelerometer detected it.

Dropped while detection of that event type is disabled, as on real hardware. The event is timed as it is reported.

Parameters
sensorSensor.
eventEvent, in the device frame.

◆ pbl_mag_sim_set()

void pbl_mag_sim_set ( const struct pbl_sensor *  sensor,
int32_t  x,
int32_t  y,
int32_t  z 
)

Set the magnetic field the simulated magnetometer measures.

Parameters
sensorSensor.
xField along the device X axis, in nanotesla.
yField along the device Y axis, in nanotesla.
zField along the device Z axis, in nanotesla.

◆ pbl_temp_sim_set()

void pbl_temp_sim_set ( const struct pbl_sensor *  sensor,
int32_t  millicelsius 
)

Set the temperature the simulated temperature sensor reads.

Parameters
sensorSensor.
millicelsiusTemperature in millidegrees Celsius.