PebbleOS
Loading...
Searching...
No Matches
pbl_mag_ops Struct Reference

Magnetometer driver operations, called with the device lock held. More...

#include <mag.h>

Data Fields

int(* init )(const struct pbl_mag *mag)
 Bring the hardware up.
 
int(* set_rotated )(const struct pbl_mag *mag, bool rotated)
 Optional.
 
int(* set_sampling_interval )(const struct pbl_mag *mag, uint32_t interval_us, uint32_t *actual_us)
 Set the sampling interval, 0 to stop sampling, returning the one used in actual_us.
 
int(* peek )(const struct pbl_mag *mag, MagData *sample)
 Read the most recent sample.
 

Detailed Description

Magnetometer driver operations, called with the device lock held.

Field Documentation

◆ init

int(* pbl_mag_ops::init) (const struct pbl_mag *mag)

Bring the hardware up.

Returns 0, -ENODEV if the part does not answer, or a negative errno.

◆ peek

int(* pbl_mag_ops::peek) (const struct pbl_mag *mag, MagData *sample)

Read the most recent sample.

Returns -ENODATA when not sampling.

◆ set_rotated

int(* pbl_mag_ops::set_rotated) (const struct pbl_mag *mag, bool rotated)

Optional.

Set whether the sensor is mounted rotated by 180 degrees.

◆ set_sampling_interval

int(* pbl_mag_ops::set_sampling_interval) (const struct pbl_mag *mag, uint32_t interval_us, uint32_t *actual_us)

Set the sampling interval, 0 to stop sampling, returning the one used in actual_us.


The documentation for this struct was generated from the following file: