-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBMP180_ex.h
83 lines (65 loc) · 2.58 KB
/
BMP180_ex.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
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
/*!\file BMP180_ex.h
** \author SMFSW
** \copyright MIT (c) 2017-2024, SMFSW
** \brief BMP180 Driver extensions
** \details BMP180: Digital pressure sensor
**/
/****************************************************************/
#ifndef __BMP180_EX_H__
#define __BMP180_EX_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "sarmfsw.h"
#include "BMP180.h"
#if defined(HAL_I2C_MODULE_ENABLED)
/****************************************************************/
// *****************************************************************************
// Section: Constants
// *****************************************************************************
#define BMP180_RESET_VAL 0xB6 //!< Reset value for "soft reset" register
// *****************************************************************************
// Section: Interface Routines
// *****************************************************************************
/****************************************/
/*** High level methods and functions ***/
/****************************************/
/*!\brief Start BMP180 Temperature/Pressure conversion
** \param[in] pCpnt - Pointer to BMP180 component
** \param[in] meas - Temperature / Pressure
** \return FctERR - error code
**/
FctERR NONNULL__ BMP180_Start_Conversion(BMP180_t * const pCpnt, const BMP180_meas meas);
/*!\brief Get BMP180 chip ID
** \param[in] pCpnt - Pointer to BMP180 component
** \param[in,out] id - pointer to chip ID result
** \return FctERR - error code
**/
__INLINE FctERR NONNULL_INLINE__ BMP180_Get_ChipID(BMP180_t * const pCpnt, uint8_t * id) {
return BMP180_Read(pCpnt->cfg.slave_inst, id, BMP180__ID, 1); }
/*!\brief Reset BMP180 chip
** \param[in] pCpnt - Pointer to BMP180 component
** \return FctERR - error code
**/
__INLINE FctERR NONNULL_INLINE__ BMP180_Reset(BMP180_t * const pCpnt) {
uint8_t rst = BMP180_RESET_VAL;
return BMP180_Write(pCpnt->cfg.slave_inst, &rst, BMP180__SOFT_RESET, 1); }
/*!\brief Get Raw Temperature
** \param[in] pCpnt - Pointer to BMP180 component
** \param[in,out] tp - pointer to raw temperature result
** \return FctERR - error code
**/
FctERR NONNULL__ BMP180_Get_Temperature_Raw(BMP180_t * const pCpnt, int32_t * tp);
/*!\brief Get Raw Pressure
** \param[in] pCpnt - Pointer to BMP180 component
** \param[in,out] pr - pointer to raw pressure result
** \return FctERR - error code
**/
FctERR NONNULL__ BMP180_Get_Pressure_Raw(BMP180_t * const pCpnt, int32_t * pr);
/****************************************************************/
#endif
#ifdef __cplusplus
}
#endif
#endif /* __BMP180_EX_H__ */
/****************************************************************/