LibDriver BMP180
Loading...
Searching...
No Matches
driver_bmp180.h
Go to the documentation of this file.
1
37
38#ifndef DRIVER_BMP180_H
39#define DRIVER_BMP180_H
40
41#include <stdio.h>
42#include <stdint.h>
43#include <string.h>
44
45#ifdef __cplusplus
46extern "C"{
47#endif
48
54
59
70
74typedef struct bmp180_handle_s
75{
76 uint8_t (*iic_init)(void);
77 uint8_t (*iic_deinit)(void);
78 uint8_t (*iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
79 uint8_t (*iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
80 void (*delay_ms)(uint32_t ms);
81 void (*debug_print)(const char *const fmt, ...);
82 uint8_t inited;
83 int16_t ac1;
84 int16_t ac2;
85 int16_t ac3;
86 uint16_t ac4;
87 uint16_t ac5;
88 uint16_t ac6;
89 int16_t b1;
90 int16_t b2;
91 int16_t mb;
92 int16_t mc;
93 int16_t md;
94 uint8_t oss;
96
112
116
123
130#define DRIVER_BMP180_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
131
138#define DRIVER_BMP180_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
139
146#define DRIVER_BMP180_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
147
154#define DRIVER_BMP180_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
155
162#define DRIVER_BMP180_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
163
170#define DRIVER_BMP180_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
171
178#define DRIVER_BMP180_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
179
183
190
199uint8_t bmp180_info(bmp180_info_t *info);
200
213uint8_t bmp180_init(bmp180_handle_t *handle);
214
225uint8_t bmp180_deinit(bmp180_handle_t *handle);
226
241uint8_t bmp180_read_temperature_pressure(bmp180_handle_t *handle, uint16_t *temperature_raw, float *temperature_c,
242 uint32_t *pressure_raw, uint32_t *pressure_pa);
243
256uint8_t bmp180_read_pressure(bmp180_handle_t *handle, uint32_t *raw, uint32_t *pa);
257
270uint8_t bmp180_read_temperature(bmp180_handle_t *handle, uint16_t *raw, float *c);
271
282uint8_t bmp180_set_mode(bmp180_handle_t *handle, bmp180_mode_t mode);
283
294uint8_t bmp180_get_mode(bmp180_handle_t *handle, bmp180_mode_t *mode);
295
299
306
319uint8_t bmp180_set_reg(bmp180_handle_t *handle, uint8_t reg, uint8_t value);
320
333uint8_t bmp180_get_reg(bmp180_handle_t *handle, uint8_t reg, uint8_t *value);
334
338
342
343#ifdef __cplusplus
344}
345#endif
346
347#endif
uint8_t bmp180_deinit(bmp180_handle_t *handle)
close the chip
struct bmp180_info_s bmp180_info_t
bmp180 information structure definition
bmp180_mode_t
bmp180 mode enumeration definition
struct bmp180_handle_s bmp180_handle_t
bmp180 handle structure definition
uint8_t bmp180_init(bmp180_handle_t *handle)
initialize the chip
uint8_t bmp180_info(bmp180_info_t *info)
get chip's information
uint8_t bmp180_read_temperature(bmp180_handle_t *handle, uint16_t *raw, float *c)
read the temperature data
uint8_t bmp180_read_pressure(bmp180_handle_t *handle, uint32_t *raw, uint32_t *pa)
read the pressure data
uint8_t bmp180_read_temperature_pressure(bmp180_handle_t *handle, uint16_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, uint32_t *pressure_pa)
read the temperature and pressure data
uint8_t bmp180_get_mode(bmp180_handle_t *handle, bmp180_mode_t *mode)
get the measurement mode
uint8_t bmp180_set_mode(bmp180_handle_t *handle, bmp180_mode_t mode)
set the measurement mode
@ BMP180_MODE_ULTRA_LOW
@ BMP180_MODE_STANDARD
@ BMP180_MODE_HIGH
@ BMP180_MODE_ULTRA_HIGH
uint8_t bmp180_set_reg(bmp180_handle_t *handle, uint8_t reg, uint8_t value)
set the chip register
uint8_t bmp180_get_reg(bmp180_handle_t *handle, uint8_t reg, uint8_t *value)
get the chip register
bmp180 handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
bmp180 information structure definition
float supply_voltage_max_v
uint32_t driver_version
char manufacturer_name[32]
float supply_voltage_min_v
char chip_name[32]