Digital pressure sensor driver. More...

#include <stdint.h>
#include "BMP180.h"
#include "MCAL.h"
Include dependency graph for BMP180.c:

Go to the source code of this file.

Data Structures

struct  BMP180_CalibCoefficients
 BMP180 Calibration coefficients. More...
 
struct  BMP180_Data
 BMP180 driver data. More...
 

Enumerations

enum  BMP180_Register {
  E2PROM_AC1 = 0xAA, E2PROM_AC2 = 0xAC, E2PROM_AC3 = 0xAE, E2PROM_AC4 = 0xB0,
  E2PROM_AC5 = 0xB2, E2PROM_AC6 = 0xB4, E2PROM_B1 = 0xB6, E2PROM_B2 = 0xB8,
  E2PROM_MB = 0xBA, E2PROM_MC = 0xBC, E2PROM_MD = 0xBE, CHIP_ID = 0xD0,
  SOFT_RESET = 0xE0, CTRL_MEAS = 0xF4, OUT_MSB = 0xF6, OUT_LSB = 0xF7,
  OUT_XLSB = 0xF8
}
 BMP180 register (global memory map) More...
 

Functions

static int16_t _BMP180_GetB5 (int32_t s32UT)
 Convert uncompensated temperature to B5. More...
 
static int _BMP180_ReadRegister (const BMP180_Register eReg, int16_t *ps16Value)
 Read register. More...
 
int BMP180_Init (void)
 Initialise BMP180 driver. More...
 
int BMP180_ReadTemperature (int8_t *ps8Temp)
 Read current temperature. More...
 

Variables

static BMP180_Data _stBMP180Data = { 0 }
 BMP180 driver private data.
 

Detailed Description

Digital pressure sensor driver.

Bosch Sensortec BMP180 I²C digital pressure sensor

Definition in file BMP180.c.

Enumeration Type Documentation

◆ BMP180_Register

BMP180 register (global memory map)

Enumerator
E2PROM_AC1 

Calibration coeff. AC1.

E2PROM_AC2 

Calibration coeff. AC2.

E2PROM_AC3 

Calibration coeff. AC3.

E2PROM_AC4 

Calibration coeff. AC4.

E2PROM_AC5 

Calibration coeff. AC5.

E2PROM_AC6 

Calibration coeff. AC6.

E2PROM_B1 

Calibration coeff. B1.

E2PROM_B2 

Calibration coeff. BS.

E2PROM_MB 

Calibration coeff. MB.

E2PROM_MC 

Calibration coeff. MC.

E2PROM_MD 

Calibration coeff. MD.

CHIP_ID 

Chip-ID, can be checked against BMP180_CHIP_ID.

SOFT_RESET 

Soft reset if set to 0xB6.

CTRL_MEAS 

Measurement control.

OUT_MSB 

ADC out LSB.

OUT_LSB 

ADC out MSB.

OUT_XLSB 

ADC out XLSB.

Definition at line 22 of file BMP180.c.

Function Documentation

◆ _BMP180_GetB5()

static int16_t _BMP180_GetB5 ( int32_t  s32UT)
static

Convert uncompensated temperature to B5.

As required to calculate true temperature and true pressure

Parameters
s32UTUncompensated temperature
Returns
B5

Definition at line 173 of file BMP180.c.

Here is the caller graph for this function:

◆ _BMP180_ReadRegister()

static int _BMP180_ReadRegister ( const BMP180_Register  eReg,
int16_t *  ps16Value 
)
static

Read register.

Parameters
eRegBMP180 E²PROM register
ps16ValueRegister value
Returns
Error code
Return values
0OK
-1Error

Definition at line 194 of file BMP180.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BMP180_Init()

int BMP180_Init ( void  )

Initialise BMP180 driver.

Returns
Error code
Return values
0OK
-1Error

Definition at line 90 of file BMP180.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BMP180_ReadTemperature()

int BMP180_ReadTemperature ( int8_t *  ps8Temp)

Read current temperature.

Parameters
ps8TempTemperature in 1°C
Returns
Error code
Return values
0OK
-1Error

Definition at line 132 of file BMP180.c.

Here is the call graph for this function:
Here is the caller graph for this function: