ensaht/bmp.h

57 lines
981 B
C

#ifndef BMP_H
#define BMP_H
#include <stdint.h>
#define BMP_ADDR 0x77
#define BMP_STATUS 0x03
#define BMP_DATA 0x04
#define 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];
// 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 double bmp_cal_data_fp[15];
int getBMPCalData(bmp_cal_data_t *cal);
int initBMP(void);
#endif // BMP_H