I have connected a BMX160 to an STM32 Nucleo board and have managed to obtain accelerometer and gyroscope readings via existing BMI160 Mbed library: https://os.mbed.com/teams/MaximIntegrated/code/BMI160/#4949e9b15b6e
However, no such library exists for BMM150, so I was thinking of implementing my own using the sensor driver provided by Bosch (https://github.com/BoschSensortec/BMI160_driver) but I am having a bit of a difficulty understanding how to implement the user i2c read and write for my particular board in Mbed. I did find a platform-agnostic solution here, but it leaves out how to implement the I2c/Spi reads and writes: https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BMX160-magnetometer-problem/m-p/7692#M61...
Any help would be appreciated.
Please refer to accessing-auxiliary-bmm150-with-bmm150-apis-via-bmi160-secondary-interface .
In fact, BMX160 contain bmi160 and bmm150, bmm150 connected via bmi160 aux interface. So you could follow this workflow to get bmm150 data.
Thanks. If you see my post I have already posted the same link. My problem is implementing the i2c reads and writes.
Please remap read/write function in API to your platform. From bmi160.c, you could get read() format in bmi160_get_regs().
Example in BMX160-magnetometer-problem :
bmi.read = spi_read_transfer; bmi.write = spi_write_transfer;
int8_t spi_read_transfer(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len);
int8_t spi_write_transfer(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len);