You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.1 KiB
C

#ifndef BMP180_H
#define BMP180_H
// --- DIRECCIÓN I2C ---
#define BMP180_I2C_ADDR 0x77
// --- REGISTROS DEL BMP180 ---
#define BMP180_REG_CTRL_MEAS 0xF4 // Registro de control para iniciar mediciones
#define BMP180_REG_ADC_MSB 0xF6 // Registro de salida de datos: Byte Más Significativo
#define BMP180_REG_ADC_LSB 0xF7 // Registro de salida de datos: Byte Menos Significativo
#define BMP180_REG_ADC_XLSB 0xF8 // Registro de salida de datos: Byte Extendido
// --- COMANDOS DE CONTROL (REGISTRO 0xF4) ---
#define BMP180_CMD_TEMP 0x2E // Orden de medir temperatura.
#define BMP180_CMD_PRES_OSS2 0xB4 // Presión: High Resolution (oss=2)
// Estructura para almacenar los datos de calibración de fábrica
typedef struct {
short ac1, ac2, ac3;
unsigned short ac4, ac5, ac6;
short b1, b2, mb, mc, md;
} BMP180_CalibData;
// --- DECLARACIÓN DE MÉTODOS PARA bmp180.c ---
int bmp180_init(int fd, BMP180_CalibData *calib); // Calibración
int bmp180_get_temperature(int fd, double *temperature); // Temperatura
int bmp180_get_pressure(int fd, BMP180_CalibData *calib, int oss, double *pressure); // Presión
#endif // BMP180_H