1
yincheng.zhong
2023-08-04 58d4ffeb779fbd8dec7dcf0659ec9fa7d0539b1a
Src/ExternalDevices/bmp3.c
@@ -880,7 +880,7 @@
                temp_len = len;
            }
            dev->intf_rslt = dev->write(reg_addr[0], temp_buff, temp_len, dev->intf_ptr);
            dev->intf_rslt = dev->write(reg_addr[0], reg_data, temp_len, dev->intf_ptr);
            /* Check for communication error */
            if (dev->intf_rslt != BMP3_INTF_RET_SUCCESS)
@@ -1782,14 +1782,14 @@
/*!
 * @brief This internal API reads the calibration data from the sensor, parse
 * it then compensates it and store in the device structure.
 */
 */uint8_t calib_data[BMP3_LEN_CALIB_DATA] = { 0 };
static int8_t get_calib_data(struct bmp3_dev *dev)
{
    int8_t rslt;
    uint8_t reg_addr = BMP3_REG_CALIB_DATA;
    /* Array to store calibration data */
    uint8_t calib_data[BMP3_LEN_CALIB_DATA] = { 0 };
    /* Read the calibration data from the sensor */
    rslt = bmp3_get_regs(reg_addr, calib_data, BMP3_LEN_CALIB_DATA, dev);
@@ -1881,7 +1881,7 @@
    /* Move index to 0x1F register */
    index = index + 2;
    settings->iir_filter = BMP3_GET_BITS(reg_data[index], BMP3_IIR_FILTER);
  //  settings->iir_filter = BMP3_GET_BITS(reg_data[index], BMP3_IIR_FILTER);
}
/*!
@@ -1933,7 +1933,7 @@
    uint8_t reg_addr[3] = { 0 };
    /* No of register data to be read is 4 */
    uint8_t reg_data[4];
    uint8_t reg_data[4],reg_data2[4];
    uint8_t len = 0;
    rslt = bmp3_get_regs(BMP3_REG_OSR, reg_data, 4, dev);
@@ -1972,7 +1972,9 @@
        {
            /* Burst write the over sampling, ODR and filter
             * settings in the register */
                  rslt = bmp3_get_regs(reg_addr[0], reg_data2, len, dev);
            rslt = bmp3_set_regs(reg_addr, reg_data, len, dev);
                  rslt = bmp3_get_regs(reg_addr[0], reg_data2, len, dev);
        }
    }
@@ -2725,17 +2727,17 @@
{
    int8_t rslt;
    if ((dev == NULL) || (dev->read == NULL) || (dev->write == NULL) || (dev->delay_us == NULL) ||
        (dev->intf_ptr == NULL))
    {
        /* Device structure pointer is not valid */
        rslt = BMP3_E_NULL_PTR;
    }
    else
    {
//    if ((dev == NULL) || (dev->read == NULL) || (dev->write == NULL) || (dev->delay_us == NULL) ||
//        (dev->intf_ptr == NULL))
//    {
//        /* Device structure pointer is not valid */
//        rslt = BMP3_E_NULL_PTR;
//    }
//    else
//    {
        /* Device structure is fine */
        rslt = BMP3_OK;
    }
   // }
    return rslt;
}