CTL_STATUS_t hmc6343_read_heading(CTL_I2C_BUS_t *bus,
                                  int address,
                                  float *heading,
                                  float *pitch,
                                  float *roll);

hmc6343_read_heading reads the heading, in degrees, from the HMC6352 compass on 8-bit address address using the I2C bus bus. The heading is written into the float pointed to by heading. Additionally, the pitch and roll in degrees are written to pitch and roll. heading, pitch, or roll can be null to indicate that the parameter is not of interest to the client.

The sensor delivers heading, pitch, and roll with resolutions of 0.1 degrees.

Return Value

hmc6343_read_heading returns a standard status code. If the status indicates an error, the returned sample data is undefined.

Thread Safety

hmc6343_read_heading is thread-safe if a mutex is associated with the I2C bus bus.