PebbleOS v4.47.0-512-g5285d4236
Loading...
Searching...
No Matches
MMC5603NJ

MEMSIC MMC5603NJ Magnetometer driver. More...

Modules

 MMC5603NJ registers
 MMC5603NJ register map, from the MEMSIC datasheet (Rev.
 

Data Structures

struct  pbl_mmc5603nj_state
 MMC5603NJ driver state, owned by the driver. More...
 
struct  pbl_mmc5603nj
 MMC5603NJ magnetometer. More...
 

Macros

#define PBL_MMC5603NJ_DEFINE(sym, _bus, _addr, ...)
 Define an MMC5603NJ.
 

Detailed Description

MEMSIC MMC5603NJ Magnetometer driver.

The part has no data-ready interrupt line: while sampling, the driver polls it at the output data rate.

PBL_MMC5603NJ_DEFINE(s_mmc5603nj, &s_i2c2, 0x30,
.axis_map = {1, 0, 2},
.axis_dir = {1, -1, 1});
const struct pbl_mag *const MAG = &s_mmc5603nj;
#define PBL_MMC5603NJ_DEFINE(sym, _bus, _addr,...)
Define an MMC5603NJ.
Definition mmc5603nj.h:70
Magnetometer.
Definition mag.h:82
const struct pbl_mag *const MAG
The board's magnetometer.

Data Structure Documentation

◆ pbl_mmc5603nj_state

struct pbl_mmc5603nj_state

MMC5603NJ driver state, owned by the driver.

Data Fields
struct pbl_delayed_work poll_timer Polling work.
uint8_t rate_hz Output data rate in Hz, 0 when not sampling.
bool rotated Watch mounted rotated 180 degrees: X and Y are inverted.

◆ pbl_mmc5603nj

struct pbl_mmc5603nj

MMC5603NJ magnetometer.

Data Fields
int8_t axis_dir[3] Direction of each watch axis: 1 or -1.
uint8_t axis_map[3] Sensor axis feeding each watch axis (0: X, 1: Y, 2: Z).
struct pbl_i2c_dev i2c I2C device.
struct pbl_mag mag Magnetometer, child of the I2C bus.
struct pbl_mmc5603nj_state * state Driver state.

Macro Definition Documentation

◆ PBL_MMC5603NJ_DEFINE

#define PBL_MMC5603NJ_DEFINE (   sym,
  _bus,
  _addr,
  ... 
)
Value:
static struct pbl_mmc5603nj_state sym##_mmc5603nj_state; \
PBL_DEVICE_INSTANCE(sym, struct pbl_mmc5603nj, struct pbl_mag, mag) { \
.mag = PBL_MAG_INIT(sym, "mmc5603nj", &(_bus)->dev, &pbl_mmc5603nj_ops), \
.state = &sym##_mmc5603nj_state, .i2c = PBL_I2C_DEV(_bus, _addr), __VA_ARGS__, \
}
#define PBL_I2C_DEV(_bus, _addr)
Initializer for a struct pbl_i2c_dev.
Definition i2c.h:136
MMC5603NJ magnetometer.
Definition mmc5603nj.h:43
MMC5603NJ driver state, owned by the driver.
Definition mmc5603nj.h:33
#define PBL_MAG_INIT(sym, _name, _parent, _ops)
Initialize a struct pbl_mag.
Definition mag.h:115
#define PBL_MAG_STATE_DEFINE(sym)
Define the class state of a magnetometer.
Definition mag.h:99

Define an MMC5603NJ.

Only one instance is supported.

Parameters
symSymbol of the instance, a struct pbl_mag.
_busI2C bus.
_addr7-bit I2C address.
...Designated initializers of the remaining fields: axis_map and axis_dir.