-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathms5837.h
More file actions
executable file
·88 lines (77 loc) · 2.14 KB
/
ms5837.h
File metadata and controls
executable file
·88 lines (77 loc) · 2.14 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/**
* \file ms5837.h
*
* \brief MS5837 Temperature sensor driver header file
*
* Copyright (c) 2016 Measurement Specialties. All rights reserved.
*
* \asf_license_start
*
* \page License
*
*
* \asf_license_stop
*
*/
#ifndef MS5837_H_INCLUDED
#define MS5837_H_INCLUDED
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
enum ms5837_resolution_osr {
ms5837_resolution_osr_256 = 0,
ms5837_resolution_osr_512,
ms5837_resolution_osr_1024,
ms5837_resolution_osr_2048,
ms5837_resolution_osr_4096,
ms5837_resolution_osr_8192
};
enum ms5837_status {
ms5837_status_ok,
ms5837_status_no_i2c_acknowledge,
ms5837_status_i2c_transfer_error,
ms5837_status_crc_error
};
// Functions
/**
* \brief Configures the SERCOM I2C master to be used with the ms5837 device.
*/
void ms5837_init(void);
/**
* \brief Check whether MS5837 device is connected
*
* \return bool : status of MS5837
* - true : Device is present
* - false : Device is not acknowledging I2C address
*/
bool ms5837_is_connected(void);
/**
* \brief Reset the MS5837 device
*
* \return ms5837_status : status of MS5837
* - ms5837_status_ok : I2C transfer completed successfully
* - ms5837_status_i2c_transfer_error : Problem with i2c transfer
* - ms5837_status_no_i2c_acknowledge : I2C did not acknowledge
*/
enum ms5837_status ms5837_reset(void);
/**
* \brief Set ADC resolution.
*
* \param[in] ms5837_resolution_osr : Resolution requested
*
*/
void ms5837_set_resolution(enum ms5837_resolution_osr );
/**
* \brief Reads the temperature and pressure ADC value and compute the compensated values.
*
* \param[out] float* : Celsius Degree temperature value
* \param[out] float* : mbar pressure value
*
* \return ms5837_status : status of MS5837
* - ms5837_status_ok : I2C transfer completed successfully
* - ms5837_status_i2c_transfer_error : Problem with i2c transfer
* - ms5837_status_no_i2c_acknowledge : I2C did not acknowledge
* - ms5837_status_crc_error : CRC check error on on the PROM coefficients
*/
enum ms5837_status ms5837_read_temperature_and_pressure(float *, float *);
#endif /* MS5837_H_INCLUDED */