hw/drivers/sensors/bmx160/src/bmx160.c
static int bmx160_bmm_reg_read(struct bmx160 *bmx160, uint8_t bmm_addr, void *data, unsigned int size)
{
    int err;
    uint8_t *bmm_data = data;
    for (unsigned int i = 0; i < size; i++) {

        err = bmx160_reg_write(bmx160, BMX160_REG_MAG_IF_1_RDA, &bmm_addr, 1);
        if (err)
            return err;

        err = bmx160_bmm_operation_wait(bmx160);
        if (err)
            return err;
        // assumes MAG_IF_0:mag_rd_burst=0b00=1byte (default) but should work regardless
        err = bmx160_reg_read(bmx160, BMX160_REG_MAG_DATA, bmm_data, 1);
        if (err)
            return err;

        bmm_addr++;
        bmm_data++;
    }

    return 0;
}
// read bmm/mag/aux register
read bmm/mag/aux register
read bmm / mag / aux register
static int bmx160_bmm_reg_read(struct bmx160 *bmx160, uint8_t bmm_addr, void *data, unsigned int size)
{
    int err;
    uint8_t *bmm_data = data;
    for (unsigned int i = 0; i < size; i++) {
        err = bmx160_reg_write(bmx160, BMX160_REG_MAG_IF_1_RDA, &bmm_addr, 1);
        if (err)
            return err;
        err = bmx160_bmm_operation_wait(bmx160);
        if (err)
            return err;
        err = bmx160_reg_read(bmx160, BMX160_REG_MAG_DATA, bmm_data, 1);
        if (err)
            return err;
        bmm_addr++;
        bmm_data++;
    }
    return 0;
}
static int bmx160_bmm_reg_read ( struct bmx160 * bmx160 , uint8_t bmm_addr , void * data , unsigned int size ) { int err ; uint8_t * bmm_data = data ; for ( unsigned int i = 0 ; i < size ; i ++ ) { err = bmx160_reg_write ( bmx160 , BMX160_REG_MAG_IF_1_RDA , & bmm_addr , 1 ) ; if ( err ) return err ; err = bmx160_bmm_operation_wait ( bmx160 ) ; if ( err ) return err ; err = bmx160_reg_read ( bmx160 , BMX160_REG_MAG_DATA , bmm_data , 1 ) ; if ( err ) return err ; bmm_addr ++ ; bmm_data ++ ; } return 0 ; }
read bmm/mag/aux register
read bmm / mag / aux register
// assumes MAG_IF_0:mag_rd_burst=0b00=1byte (default) but should work regardless