Synopsis
CTL_STATUS_t bmm150_initialize_spi(CTL_MAGNETOMETER_t *self,
                                   CTL_SPI_DEVICE_t *dev);
Description

bmm150_initialize_spi initializes the magnetometer interface self with methods to communicate with an BMM150 magnetometer on the SPI bus associated with dev. The protocol for device dev is set to 1 MHz, 8-bit SPI mode 0. The maximum clock speed supported by the BMM150 in SPI mode is 10 MHz: you can increase the clock speed from the initial 1 MHz using ctl_spi_set_speed.

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

Return Value

bmm150_initialize_spi returns a standard status code.

Thread Safety

bmm150_initialize_spi is thread-safe if a mutex is associated with the SPI bus that dev is attached to.

See Also

<ctl_sensors.h>