PebbleOS
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
accel.h File Reference
#include <pbl/services/imu/units.h>
#include <stdbool.h>
#include <stdint.h>

Data Structures

struct  AccelDriverSample
 Accelerometer sample. More...
 
struct  AccelRawBatch
 Batch of raw samples in a driver-owned buffer. More...
 
struct  AccelRawBatch.axis
 Per-axis source, indexed by IMUCoordinateAxis; encodes axis remapping and direction. More...
 

Typedefs

typedef void(* AccelOffloadCallback) (void)
 Driver work to be run from thread context.
 

Functions

void accel_init (void)
 Initialize the accelerometer.
 
void accel_set_rotated (bool rotated)
 Set whether the axes are rotated by 180 degrees.
 
uint32_t accel_set_sampling_interval (uint32_t interval_us)
 Set the sampling interval.
 
uint32_t accel_get_sampling_interval (void)
 Get the sampling interval.
 
void accel_set_num_samples (uint32_t num_samples)
 Set the maximum number of samples the driver may batch.
 
uint32_t accel_get_max_num_samples (void)
 Get the maximum number of samples the driver can batch.
 
int accel_peek (AccelDriverSample *data)
 Read the most recent sample.
 
void accel_enable_shake_detection (bool on)
 Enable or disable shake detection.
 
bool accel_get_shake_detection_enabled (void)
 Check whether shake detection is enabled.
 
void accel_enable_double_tap_detection (bool on)
 Enable or disable double tap detection.
 
bool accel_get_double_tap_detection_enabled (void)
 Check whether double tap detection is enabled.
 
void accel_cb_new_sample (AccelDriverSample const *data)
 Deliver a new sample to the service.
 
void accel_cb_new_samples (AccelRawBatch const *batch)
 Deliver a batch of new samples to the service.
 
void accel_cb_shake_detected (IMUCoordinateAxis axis, int32_t direction)
 Report a detected shake to the service.
 
void accel_cb_double_tap_detected (IMUCoordinateAxis axis, int32_t direction)
 Report a detected double tap to the service.
 
void accel_offload_work_from_isr (AccelOffloadCallback cb)
 Run driver work in thread context, from an ISR.
 
void accel_offload_work (AccelOffloadCallback cb)
 Run driver work in thread context.
 
void accel_set_shake_sensitivity_high (bool sensitivity_high)
 Select high or normal shake sensitivity.
 
void accel_set_shake_sensitivity_percent (uint8_t percent)
 Set the normal shake sensitivity.