PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
mag.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <pbl/device.h>
#include <pbl/kernel/compiler.h>
#include <pbl/kernel/mutex.h>

Data Structures

struct  MagData
 Magnetometer sample, in milligauss, in the watch frame. More...
 
struct  pbl_mag_listener
 Magnetometer listener. More...
 
struct  pbl_mag_ops
 Magnetometer driver operations, called with the device lock held. More...
 
struct  pbl_mag_state
 Magnetometer runtime state. More...
 
struct  pbl_mag
 Magnetometer. More...
 

Macros

#define PBL_MAG_STATE_DEFINE(sym)
 Define the class state of a magnetometer.
 
#define PBL_MAG_INIT(sym, _name, _parent, _ops)
 Initialize a struct pbl_mag.
 

Functions

void pbl_mag_lock (const struct pbl_mag *mag)
 Take the device lock.
 
void pbl_mag_unlock (const struct pbl_mag *mag)
 Release the device lock.
 
int pbl_mag_set_listener (const struct pbl_mag *mag, const struct pbl_mag_listener *listener)
 Set the listener.
 
int pbl_mag_set_rotated (const struct pbl_mag *mag, bool rotated)
 Set whether the watch is mounted rotated by 180 degrees.
 
int pbl_mag_set_sampling_interval (const struct pbl_mag *mag, uint32_t interval_us, uint32_t *actual_us)
 Set the sampling interval.
 
uint32_t pbl_mag_get_sampling_interval (const struct pbl_mag *mag)
 Get the sampling interval.
 
int pbl_mag_peek (const struct pbl_mag *mag, MagData *sample)
 Read the most recent sample.
 
void pbl_mag_report_sample (const struct pbl_mag *mag, const MagData *sample)
 Report a new sample to the listener.
 

Variables

const struct pbl_mag *const MAG
 The board's magnetometer.