/* This API writes the mention no of byte of data to the given register address of auxiliary sensor.  */
int8_t bmi160_aux_write(uint8_t reg_addr, uint8_t *aux_data, uint16_t len, const struct bmi160_dev *dev)
/* This API writes the mention no of byte of data to the given register address of auxiliary sensor.  */
int8_t bmi160_aux_write(uint8_t reg_addr, uint8_t *aux_data, uint16_t len, const struct bmi160_dev *dev)
{
    int8_t rslt = BMI160_OK;
    uint8_t count = 0;
    if ((dev == NULL) || (dev->write == NULL))
    {
        rslt = BMI160_E_NULL_PTR;
    }
    else
    {
        for (; count < len; count++)
        {
            rslt = bmi160_set_regs(BMI160_AUX_IF_4_ADDR, aux_data, 1, dev);
            dev->delay_ms(BMI160_AUX_COM_DELAY);
            if (rslt == BMI160_OK)
            {
                rslt = bmi160_set_regs(BMI160_AUX_IF_3_ADDR, &reg_addr, 1, dev);
                dev->delay_ms(BMI160_AUX_COM_DELAY);
                if (rslt == BMI160_OK && (count < len - 1))
                {
                    aux_data++;
                    reg_addr++;
                }
            }
        }
    }
    return rslt;
}