-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathms5803-14ba.h
59 lines (44 loc) · 1.18 KB
/
ms5803-14ba.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* File: ms5803-14ba.h
* Author: Markus Backes
*
* Created on 8. August 2012
*
* contains functions to calculate pressure and temperature
*/
#ifndef MS5803_14BA_H
#define MS5803_14BA_H
#ifdef __cplusplus
extern "C" {
#endif
#include <math.h>
#include <inttypes.h>
struct calibrated {
uint16_t C1;
uint16_t C2;
uint16_t C3;
uint16_t C4;
uint16_t C5;
uint16_t C6;
};
typedef struct calibrated CalibrationData;
struct measured {
uint32_t D1; //DIGITAL PRESSURE
uint32_t D2; //DIGITAL TEMPERATUR
};
typedef struct measured MeasurementData;
struct calculated {
int32_t dT;
int32_t TEMP;
int64_t OFF;
int64_t SENS;
int32_t P;
};
typedef struct calculated CalculatedValues;
void calculateTemperature(CalibrationData CB_DATA, MeasurementData MM_DATA, CalculatedValues *values);
void doSecondOrderTemperatureCompensation(CalculatedValues *values);
void calculateTemperatureCompensatedPressure(CalibrationData CB_DATA, MeasurementData MM_DATA, CalculatedValues *values);
#ifdef __cplusplus
}
#endif
#endif /* MS5803_14BA_H */