PebbleOS
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
mag.h File Reference
#include <pbl/kernel/compiler.h>
#include <stdbool.h>
#include <stdint.h>

Data Structures

struct  MagData
 3-axis magnetometer sample, in milligauss, in the watch frame. More...
 

Enumerations

enum  MagReadStatus {
  MagReadSuccess = 0 , MagReadClobbered = -1 , MagReadCommunicationFail = -2 , MagReadMagOff = -3 ,
  MagReadNoMag = -4
}
 Result of mag_read_data(). More...
 
enum  MagSampleRate { MagSampleRate20Hz , MagSampleRate5Hz }
 Magnetometer sampling rate. More...
 

Functions

void mag_init (void)
 Initialize the magnetometer.
 
void mag_use (void)
 Take a reference on the magnetometer hardware.
 
void mag_start_sampling (void)
 Take a reference on the magnetometer and start sampling at 5 Hz.
 
void mag_release (void)
 Drop a reference on the magnetometer hardware.
 
MagReadStatus mag_read_data (MagData *data)
 Read the latest sample.
 
bool mag_change_sample_rate (MagSampleRate rate)
 Change the sampling rate.