Hello Yegor,
If you use the sensor API, the code has implemented the conversion. https://github.com/BoschSensortec/BMI270-Sensor-API/blob/master/bmi2.c
static void unpack_accel_data(struct bmi2_sens_axes_data *acc, uint16_t data_start_index, const struct bmi2_fifo_frame *fifo, const struct bmi2_dev *dev) { /* Variables to store LSB value */ uint16_t data_lsb;
/* Variables to store MSB value */ uint16_t data_msb;
/* Accelerometer raw x data */ data_lsb = fifo->data[data_start_index++]; data_msb = fifo->data[data_start_index++]; acc->x = (int16_t)((data_msb << 😎 | data_lsb);
/* Accelerometer raw y data */ data_lsb = fifo->data[data_start_index++]; data_msb = fifo->data[data_start_index++]; acc->y = (int16_t)((data_msb << 😎 | data_lsb);
/* Accelerometer raw z data */ data_lsb = fifo->data[data_start_index++]; data_msb = fifo->data[data_start_index++]; acc->z = (int16_t)((data_msb << 😎 | data_lsb);
/* Get the re-mapped accelerometer data */ get_remapped_data(acc, dev); }
... View more