Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* https://github.com/ciastkolog/BMP280_STM32 */
- extern BMP280_HandleTypedef bmp280;
- ...
- /* Temperature sensor */
- bmp280_init_default_params(&bmp280.params);
- bmp280.addr = BMP280_I2C_ADDRESS_0;
- bmp280.i2c = &hi2c3;
- if (!bmp280_init(&bmp280, &bmp280.params)) {
- printf("[FAIL] BMP280\n");
- } else {
- float pressure, temperature, humidity;
- bool bme280p = bmp280.id == BME280_CHIP_ID;
- HAL_Delay(100);
- if (!bmp280_read_float(&bmp280, &temperature, &pressure, &humidity)) {
- printf("[FAIL] BMP280 Temperature/pressure reading failed\n");
- } else {
- if (bme280p) {
- printf(
- "[PASS] BME280: %.2fPa, %.2f°C, %.1f%%\n",
- pressure, temperature, humidity);
- } else {
- printf("[PASS] BMP280 %.2fPa, %.2f°C\n", pressure, temperature);
- }
- }
- }
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement