chore: reorganize source organization to a more modern style
This commit is contained in:
parent
21cb610d31
commit
0425836642
12 changed files with 16 additions and 10 deletions
55
include/bmp.h
Normal file
55
include/bmp.h
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
#ifndef BMP_H
|
||||
#define BMP_H
|
||||
|
||||
#include "hardware/i2c.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define BMP_ADDR 0x77
|
||||
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
|
||||
|
||||
// instead of a bunch of defines
|
||||
enum {
|
||||
PAR_T1,
|
||||
PAR_T2,
|
||||
PAR_T3,
|
||||
PAR_P1,
|
||||
PAR_P2,
|
||||
PAR_P3,
|
||||
PAR_P4,
|
||||
PAR_P5,
|
||||
PAR_P6,
|
||||
PAR_P7,
|
||||
PAR_P8,
|
||||
PAR_P9,
|
||||
PAR_P10,
|
||||
PAR_P11
|
||||
};
|
||||
// raw calibration data
|
||||
typedef struct {
|
||||
uint16_t NVM_PAR_T1;
|
||||
uint16_t NVM_PAR_T2;
|
||||
int8_t NVM_PAR_T3;
|
||||
int16_t NVM_PAR_P1;
|
||||
int16_t NVM_PAR_P2;
|
||||
int8_t NVM_PAR_P3;
|
||||
int8_t NVM_PAR_P4;
|
||||
uint16_t NVM_PAR_P5;
|
||||
uint16_t NVM_PAR_P6;
|
||||
int8_t NVM_PAR_P7;
|
||||
int8_t NVM_PAR_P8;
|
||||
int16_t NVM_PAR_P9;
|
||||
int8_t NVM_PAR_P10;
|
||||
int8_t NVM_PAR_P11;
|
||||
} bmp_cal_data_t;
|
||||
|
||||
// floating point conversions
|
||||
extern float bmp_cal_data_fp[15];
|
||||
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue