PebbleOS v4.48.0-75-g7416f78a1
Loading...
Searching...
No Matches
sensing.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <pbl/drivers/sensor.h>

Data Structures

struct  pbl_sensing_client
 A client of a sensor. More...
 

Functions

int pbl_sensing_client_add (struct pbl_sensing_client *client)
 Add a client.
 
void pbl_sensing_client_remove (struct pbl_sensing_client *client)
 Remove a client.
 
void pbl_sensing_client_set_frequency (struct pbl_sensing_client *client, uint32_t frequency_mhz)
 Change the sampling frequency of a client.
 
void pbl_sensing_client_set_batch (struct pbl_sensing_client *client, uint16_t batch)
 Change the batch size of a client.
 
void pbl_sensing_client_set_events (struct pbl_sensing_client *client, uint8_t events)
 Change the events a client wants.
 
void pbl_sensing_lock (const struct pbl_sensor *sensor)
 Take the lock of a sensor's clients.
 
void pbl_sensing_unlock (const struct pbl_sensor *sensor)
 Release the lock of a sensor's clients.
 
uint32_t pbl_sensing_sampling_frequency (const struct pbl_sensing_client *client)
 Get the frequency the sensor samples a client's type at.
 
void pbl_sensing_arm (struct pbl_sensing_client *client, uint16_t frames)
 Notify the client once a number of frames are waiting.
 
uint32_t pbl_sensing_available (struct pbl_sensing_client *client)
 Count the frames waiting for a client.
 
uint16_t pbl_sensing_read (struct pbl_sensing_client *client, int32_t *out, uint16_t max, uint64_t *timestamp_us)
 Read the oldest frames waiting for a client.
 
void pbl_sensing_discard (struct pbl_sensing_client *client)
 Discard the frames waiting for a client.
 
uint32_t pbl_sensing_lost (struct pbl_sensing_client *client)
 Get and clear the number of frames a client lost by falling behind.
 
int pbl_sensing_latest (const struct pbl_sensor *sensor, enum pbl_sensor_type type, uint32_t scale, int32_t *val, uint64_t *timestamp_us)
 Get the latest frame of a type, without accessing the sensor.
 
uint32_t pbl_sensing_count (const struct pbl_sensor *sensor, enum pbl_sensor_type type)
 Count the frames of a type acquired since the first client read them.
 
void pbl_sensing_suspend (const struct pbl_sensor *sensor, bool suspend)
 Suspend or resume a sensor.