LibDriver BMP280
Loading...
Searching...
No Matches
driver_bmp280.c File Reference

driver bmp280 source file More...

#include "driver_bmp280.h"
Include dependency graph for driver_bmp280.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "Bosch BMP280"
 chip information definition
#define MANUFACTURER_NAME   "Bosch"
#define SUPPLY_VOLTAGE_MIN   1.71f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   1.12f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define BMP280_REG_NVM_PAR_T1_L   0x88
 chip register definition
#define BMP280_REG_NVM_PAR_T1_H   0x89
#define BMP280_REG_NVM_PAR_T2_L   0x8A
#define BMP280_REG_NVM_PAR_T2_H   0x8B
#define BMP280_REG_NVM_PAR_T3_L   0x8C
#define BMP280_REG_NVM_PAR_T3_H   0x8D
#define BMP280_REG_NVM_PAR_P1_L   0x8E
#define BMP280_REG_NVM_PAR_P1_H   0x8F
#define BMP280_REG_NVM_PAR_P2_L   0x90
#define BMP280_REG_NVM_PAR_P2_H   0x91
#define BMP280_REG_NVM_PAR_P3_L   0x92
#define BMP280_REG_NVM_PAR_P3_H   0x93
#define BMP280_REG_NVM_PAR_P4_L   0x94
#define BMP280_REG_NVM_PAR_P4_H   0x95
#define BMP280_REG_NVM_PAR_P5_L   0x96
#define BMP280_REG_NVM_PAR_P5_H   0x97
#define BMP280_REG_NVM_PAR_P6_L   0x98
#define BMP280_REG_NVM_PAR_P6_H   0x99
#define BMP280_REG_NVM_PAR_P7_L   0x9A
#define BMP280_REG_NVM_PAR_P7_H   0x9B
#define BMP280_REG_NVM_PAR_P8_L   0x9C
#define BMP280_REG_NVM_PAR_P8_H   0x9D
#define BMP280_REG_NVM_PAR_P9_L   0x9E
#define BMP280_REG_NVM_PAR_P9_H   0x9F
#define BMP280_REG_TEMP_XLSB   0xFC
#define BMP280_REG_TEMP_LSB   0xFB
#define BMP280_REG_TEMP_MSB   0xFA
#define BMP280_REG_PRESS_XLSB   0xF9
#define BMP280_REG_PRESS_LSB   0xF8
#define BMP280_REG_PRESS_MSB   0xF7
#define BMP280_REG_CONFIG   0xF5
#define BMP280_REG_CTRL_MEAS   0xF4
#define BMP280_REG_STATUS   0xF3
#define BMP280_REG_RESET   0xE0
#define BMP280_REG_ID   0xD0

Functions

uint8_t bmp280_set_addr_pin (bmp280_handle_t *handle, bmp280_address_t addr_pin)
 set the iic address pin
uint8_t bmp280_get_addr_pin (bmp280_handle_t *handle, bmp280_address_t *addr_pin)
 get the iic address pin
uint8_t bmp280_set_interface (bmp280_handle_t *handle, bmp280_interface_t interface)
 set the interface
uint8_t bmp280_get_interface (bmp280_handle_t *handle, bmp280_interface_t *interface)
 get the interface
uint8_t bmp280_init (bmp280_handle_t *handle)
 initialize the chip
uint8_t bmp280_deinit (bmp280_handle_t *handle)
 close the chip
uint8_t bmp280_soft_reset (bmp280_handle_t *handle)
 soft reset
uint8_t bmp280_get_status (bmp280_handle_t *handle, uint8_t *status)
 get status
uint8_t bmp280_set_temperatue_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
 set temperatue oversampling
uint8_t bmp280_get_temperatue_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
 get temperatue oversampling
uint8_t bmp280_set_pressure_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
 set pressure oversampling
uint8_t bmp280_get_pressure_oversampling (bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
 get pressure oversampling
uint8_t bmp280_set_mode (bmp280_handle_t *handle, bmp280_mode_t mode)
 set mode
uint8_t bmp280_get_mode (bmp280_handle_t *handle, bmp280_mode_t *mode)
 get mode
uint8_t bmp280_set_standby_time (bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
 set standby time
uint8_t bmp280_get_standby_time (bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
 get standby time
uint8_t bmp280_set_filter (bmp280_handle_t *handle, bmp280_filter_t filter)
 set filter
uint8_t bmp280_get_filter (bmp280_handle_t *handle, bmp280_filter_t *filter)
 get filter
uint8_t bmp280_set_spi_wire (bmp280_handle_t *handle, bmp280_spi_wire_t spi)
 set spi wire
uint8_t bmp280_get_spi_wire (bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
 get spi wire
uint8_t bmp280_read_pressure (bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
 read the pressure data
uint8_t bmp280_read_temperature (bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
 read the temperature data
uint8_t bmp280_read_temperature_pressure (bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
 read the temperature and pressure data
uint8_t bmp280_set_reg (bmp280_handle_t *handle, uint8_t reg, uint8_t value)
 set the chip register
uint8_t bmp280_get_reg (bmp280_handle_t *handle, uint8_t reg, uint8_t *value)
 get the chip register
uint8_t bmp280_info (bmp280_info_t *info)
 get chip's information

Detailed Description

driver bmp280 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2024-01-15

history

Date Version Author Description
2024/01/15 1.0 Shifeng Li first upload

Definition in file driver_bmp280.c.

Macro Definition Documentation

◆ BMP280_REG_CONFIG

#define BMP280_REG_CONFIG   0xF5

config register

Definition at line 84 of file driver_bmp280.c.

◆ BMP280_REG_CTRL_MEAS

#define BMP280_REG_CTRL_MEAS   0xF4

ctrl meas register

Definition at line 85 of file driver_bmp280.c.

◆ BMP280_REG_ID

#define BMP280_REG_ID   0xD0

chip id register

Definition at line 88 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P1_H

#define BMP280_REG_NVM_PAR_P1_H   0x8F

NVM PAR P1 high register

Definition at line 61 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P1_L

#define BMP280_REG_NVM_PAR_P1_L   0x8E

NVM PAR P1 low register

Definition at line 60 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P2_H

#define BMP280_REG_NVM_PAR_P2_H   0x91

NVM PAR P2 high register

Definition at line 63 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P2_L

#define BMP280_REG_NVM_PAR_P2_L   0x90

NVM PAR P2 low register

Definition at line 62 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P3_H

#define BMP280_REG_NVM_PAR_P3_H   0x93

NVM PAR P3 high register

Definition at line 65 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P3_L

#define BMP280_REG_NVM_PAR_P3_L   0x92

NVM PAR P3 low register

Definition at line 64 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P4_H

#define BMP280_REG_NVM_PAR_P4_H   0x95

NVM PAR P4 high register

Definition at line 67 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P4_L

#define BMP280_REG_NVM_PAR_P4_L   0x94

NVM PAR P4 low register

Definition at line 66 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P5_H

#define BMP280_REG_NVM_PAR_P5_H   0x97

NVM PAR P5 high register

Definition at line 69 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P5_L

#define BMP280_REG_NVM_PAR_P5_L   0x96

NVM PAR P5 low register

Definition at line 68 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P6_H

#define BMP280_REG_NVM_PAR_P6_H   0x99

NVM PAR P6 high register

Definition at line 71 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P6_L

#define BMP280_REG_NVM_PAR_P6_L   0x98

NVM PAR P6 low register

Definition at line 70 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P7_H

#define BMP280_REG_NVM_PAR_P7_H   0x9B

NVM PAR P7 high register

Definition at line 73 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P7_L

#define BMP280_REG_NVM_PAR_P7_L   0x9A

NVM PAR P7 low register

Definition at line 72 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P8_H

#define BMP280_REG_NVM_PAR_P8_H   0x9D

NVM PAR P8 high register

Definition at line 75 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P8_L

#define BMP280_REG_NVM_PAR_P8_L   0x9C

NVM PAR P8 low register

Definition at line 74 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P9_H

#define BMP280_REG_NVM_PAR_P9_H   0x9F

NVM PAR P9 high register

Definition at line 77 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_P9_L

#define BMP280_REG_NVM_PAR_P9_L   0x9E

NVM PAR P9 low register

Definition at line 76 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_T1_H

#define BMP280_REG_NVM_PAR_T1_H   0x89

NVM PAR T1 high register

Definition at line 55 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_T1_L

#define BMP280_REG_NVM_PAR_T1_L   0x88

chip register definition

NVM PAR T1 low register

Definition at line 54 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_T2_H

#define BMP280_REG_NVM_PAR_T2_H   0x8B

NVM PAR T2 high register

Definition at line 57 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_T2_L

#define BMP280_REG_NVM_PAR_T2_L   0x8A

NVM PAR T2 low register

Definition at line 56 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_T3_H

#define BMP280_REG_NVM_PAR_T3_H   0x8D

NVM PAR T3 high register

Definition at line 59 of file driver_bmp280.c.

◆ BMP280_REG_NVM_PAR_T3_L

#define BMP280_REG_NVM_PAR_T3_L   0x8C

NVM PAR T3 low register

Definition at line 58 of file driver_bmp280.c.

◆ BMP280_REG_PRESS_LSB

#define BMP280_REG_PRESS_LSB   0xF8

press lsb register

Definition at line 82 of file driver_bmp280.c.

◆ BMP280_REG_PRESS_MSB

#define BMP280_REG_PRESS_MSB   0xF7

press msb register

Definition at line 83 of file driver_bmp280.c.

◆ BMP280_REG_PRESS_XLSB

#define BMP280_REG_PRESS_XLSB   0xF9

press xlsb register

Definition at line 81 of file driver_bmp280.c.

◆ BMP280_REG_RESET

#define BMP280_REG_RESET   0xE0

soft reset register

Definition at line 87 of file driver_bmp280.c.

◆ BMP280_REG_STATUS

#define BMP280_REG_STATUS   0xF3

status register

Definition at line 86 of file driver_bmp280.c.

◆ BMP280_REG_TEMP_LSB

#define BMP280_REG_TEMP_LSB   0xFB

temp lsb register

Definition at line 79 of file driver_bmp280.c.

◆ BMP280_REG_TEMP_MSB

#define BMP280_REG_TEMP_MSB   0xFA

temp msb register

Definition at line 80 of file driver_bmp280.c.

◆ BMP280_REG_TEMP_XLSB

#define BMP280_REG_TEMP_XLSB   0xFC

temp xlsb register

Definition at line 78 of file driver_bmp280.c.

◆ CHIP_NAME

#define CHIP_NAME   "Bosch BMP280"

chip information definition

chip name

Definition at line 42 of file driver_bmp280.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_bmp280.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Bosch"

manufacturer name

Definition at line 43 of file driver_bmp280.c.

◆ MAX_CURRENT

#define MAX_CURRENT   1.12f

chip max current

Definition at line 46 of file driver_bmp280.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_bmp280.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   1.71f

chip min supply voltage

Definition at line 44 of file driver_bmp280.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_bmp280.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_bmp280.c.