bmi2_ois.c
/*!
 * @brief This API reads the data from the given OIS register address of bmi2
 * sensor.
 */
@brief This API reads the data from the given OIS register address of bmi2
sensor.
@brief This API reads the data from the given OIS register address of bmi2 sensor .
int8_t bmi2_ois_get_regs(uint8_t ois_reg_addr, uint8_t *ois_reg_data, uint16_t data_len, struct bmi2_ois_dev *ois_dev)
{
    int8_t rslt;
    uint8_t dummy_byte = 1;
    uint16_t temp_len = data_len + dummy_byte;
    uint8_t temp_buf[temp_len];
    uint16_t index = 0;
    rslt = null_ptr_check(ois_dev);
    if ((rslt == BMI2_OIS_OK) && (ois_reg_data != NULL))
    {
        ois_reg_addr = (ois_reg_addr | BMI2_OIS_SPI_RD_MASK);
        ois_dev->intf_rslt = ois_dev->ois_read(ois_reg_addr, temp_buf, temp_len, ois_dev->intf_ptr);
        if (ois_dev->intf_rslt == BMI2_INTF_RET_SUCCESS)
        {
            while (index < data_len)
            {
                ois_reg_data[index] = temp_buf[index + dummy_byte];
                index++;
            }
        }
        else
        {
            rslt = BMI2_OIS_E_COM_FAIL;
        }
    }
    else
    {
        rslt = BMI2_OIS_E_NULL_PTR;
    }
    return rslt;
}
int8_t bmi2_ois_get_regs ( uint8_t ois_reg_addr , uint8_t * ois_reg_data , uint16_t data_len , struct bmi2_ois_dev * ois_dev ) { int8_t rslt ; uint8_t dummy_byte = 1 ; uint16_t temp_len = data_len + dummy_byte ; uint8_t temp_buf [ temp_len ] ; uint16_t index = 0 ; rslt = null_ptr_check ( ois_dev ) ; if ( ( rslt == BMI2_OIS_OK ) && ( ois_reg_data != NULL ) ) { ois_reg_addr = ( ois_reg_addr | BMI2_OIS_SPI_RD_MASK ) ; ois_dev -> intf_rslt = ois_dev -> ois_read ( ois_reg_addr , temp_buf , temp_len , ois_dev -> intf_ptr ) ; if ( ois_dev -> intf_rslt == BMI2_INTF_RET_SUCCESS ) { while ( index < data_len ) { ois_reg_data [ index ] = temp_buf [ index + dummy_byte ] ; index ++ ; } } else { rslt = BMI2_OIS_E_COM_FAIL ; } } else { rslt = BMI2_OIS_E_NULL_PTR ; } return rslt ; }
@brief This API reads the data from the given OIS register address of bmi2
 sensor.
@brief This API reads the data from the given OIS register address of bmi2 sensor .
/* Variable to define error */ /* Variable to define dummy byte for SPI read */ /* Variable to define temporary length */ /* Variable to define temporary buffer */ /* Variable to index bytes read */ /* Null-pointer check */ /* Configuring reg_addr for SPI Interface */ /* Read from OIS register through OIS interface */ /* Read the data from the position next to dummy byte */