files: split sensors out into their own source files

This commit is contained in:
A.M. Rowsell 2026-06-27 21:28:41 -04:00
commit 657ee06eed
5 changed files with 167 additions and 32 deletions

23
bmp.h
View file

@ -1,17 +1,19 @@
#ifndef BMP_H
#define BMP_H
#include "hardware/i2c.h"
#include <math.h>
#include <stdint.h>
#define BMP_ADDR 0x77
#define BMP_STATUS 0x03
#define BMP_DATA 0x04
#define BMP_CAL_ADDR 0x31
static const uint8_t BMP_STATUS = 0x03;
static const uint8_t BMP_DATA = 0x04;
static const uint8_t BMP_CAL_ADDR = 0x31;
#define BMP_CAL_LEN 21
extern uint8_t BMP_RESET[2];
extern uint8_t BMP_CAL_DATA[21];
extern uint8_t BMP_SETUP[6];
extern uint8_t BMP_START[2];
static const uint8_t BMP_RESET[2];
static const uint8_t BMP_CAL_DATA[21];
static const uint8_t BMP_SETUP[6];
static const uint8_t BMP_START[2];
// instead of a bunch of defines
enum {
@ -49,9 +51,10 @@ typedef struct {
} bmp_cal_data_t;
// floating point conversions
extern double bmp_cal_data_fp[15];
extern float bmp_cal_data_fp[15];
int getBMPCalData(bmp_cal_data_t *cal);
int initBMP(void);
int getBMPData(i2c_inst_t *i2c, float *temperature, float *pressure);
int getBMPCalData(i2c_inst_t *i2c, bmp_cal_data_t *cal);
int initBMP(i2c_inst_t *i2c);
#endif // BMP_H