For customer usage, you need to download the sensor driver package from the website to communicate with sensor after connecting the BMP388 chip to your developing board. You can find the information from the following link https://github.com/BoschSensortec/BMP3-Sensor-API.
The procedure of using BMP388 sensor API is presented in the following flow chart:
The detailed example code for integration of API could be found in:
https://github.com/BoschSensortec/BMP3-Sensor-API/blob/master/README.md
Following steps need to be considered to ensure the API/sensor configured correctly.
For reading the data information from API, the following example can follow
1.The following static function should be added into your own project
static int64_t compensate_temperature
static uint64_t compensate_pressure
static double bmp3_pow
static void parse_calib_data
static double compensate_temperature_d
static double compensate_pressure_d
2.Define the main function to print the data, the structure for BMP3 and put the trimming data into the correct position as follow. One example shown below
calib_data->reg_calib_data.par_t1 = (int16_t)27402;
calib_data->reg_calib_data.par_t2 = (int16_t)18868;
calib_data->reg_calib_data.par_t3 = (int8_t)-10;
calib_data->reg_calib_data.par_p1 = (int16_t)-244;
calib_data->reg_calib_data.par_p2 = (int16_t)-3254;
calib_data->reg_calib_data.par_p3 = (int8_t)35;
calib_data->reg_calib_data.par_p4 = (int8_t)0;
calib_data->reg_calib_data.par_p5 = (int16_t)25879;
calib_data->reg_calib_data.par_p6 = (int16_t)31477;
calib_data->reg_calib_data.par_p7 = (int8_t)-13;
calib_data->reg_calib_data.par_p8 = (int8_t)-10;
calib_data->reg_calib_data.par_p9 = (int16_t)16342;
calib_data->reg_calib_data.par_p10 = (int8_t)29;
calib_data->reg_calib_data.par_p11 = (int8_t)-60;
3.Give the correct default value to the uncompensated temperature and pressure, define the version to temperature and pressure.
uncomp_data->pressure = 8241776;
uncomp_data->temperature = 8329880;
double temp = compensate_temperature_d(uncomp_data, calib_data);
double press = compensate_pressure_d(uncomp_data, calib_data);
double tempurature = temp;
double pressure = press;
4.Print out the final value
printf("Temperature\t Pressure\t\n");
printf("%0.2f\t\t %0.2f\t\t\n", tempurature, pressure);
system("pause");