CTL_STATUS_t ak8975_initialize_transport(CTL_MAGNETOMETER_t *self,
                                         CTL_TRANSPORT_t *transport);

ak8975_initialize_transport initializes the magnetometer interface self with an AK8975 magnetometer driver using the transport transport to transfer I2C data. The transport transport must already have been initialized with the I2C address of the target AK8975.

Once the magnetometer interface is initialized, you can use all standard magnetometer methods from the sensor API on the interface.

Return Value

ak8975_initialize_transport returns a standard status code.

Thread Safety

ak8975_initialize_transport is thread-safe if the transport transport is thread-safe. Typically, for SPI and I2C transports, you ensure thread safety by associating a mutex with the bus used by the transport.

See Also