Overview

Driver for an Asahi Kasei AK8975 electronic compass.

Resources

All correct at time of writing, but as always, manufacturers love to move things around on their website.

Web page

http://www.asahi-kasei.co.jp/akm/en/product/ak8975b/ak8975b.html

Datasheet

http://nexp.tistory.com/attachment/cfile10.uf@20418A044C7330720F6435.pdf

Test hardware

This code has been tested using an InvenSense MPU-6050 evaluation board with the MPU-6050 in bypass mode to attach the auxiliary I2C bus to the primary I2C bus.

http://invensense.com/mems/gyro/documents/AN-MPU-6000EVB-00_v1.0.pdf

The MPU-6050 evaluation board was attached to a SolderCore:

http://www.soldercore.com/

Notes

Although the AK8975 supports SPI mode, we have no way to test this and consequently do not offer an SPI initialization function.

Specification
Parameter Supported settings
Range (µT) ±1300
Communication up to 400 kHz (I2C) and 3 MHz (SPI)

API Summary

Macros
AK8975_I2C_ADDR AK8975 8-bit I2C address selected by CAD1:0
Functions
ak8975_initialize_i2c Initialize sensor on I2C bus
ak8975_initialize_transport Initialize sensor on a transport