Synopsis
typedef struct {
  CTL_TRANSPORT_t transport;
  CTL_STATUS_t (*measure)(CTL_MAGNETOMETER_s *, float *);
  CTL_STATUS_t (*set_bandwidth)(CTL_MAGNETOMETER_s *, float);
  float gain[];
  float bandwidth;
  void *extra;
  unsigned __mode;
} CTL_MAGNETOMETER_t;
Description

CTL_MAGNETOMETER_t is an abstract magnetometer interface that provides clients with a means to set the range and bandwidth of the magnetometer and to sample field strength in up to three axes.

Structure
transport
The underlying transport for the magnetometer which provides, typically, an I2C or SPI connection to the device and a means to read one or more registers from the device.
gain
The gain for the x, y, and z axes. Unlike accelerometers and gyroscopes, calibrating a magnetometer is more complex than simply setting bias and gain for each axis independently. This member is provided for use by the underlying magnetometer driver and client code should consider it private and no meaning should be ascribed its values.
bandwidth
Current bandwidth selected for the magnetometer, in hertz.
extra
Client-side data. You can use this to store additional information relating to the magnetometer instance.
measure
Method to sample the x, y, and z axes of the magnetometer.
set_bandwidth
Method to set the bandwidth of the magnetometer.