F439_CPP_MPL3115A2_Project_01 1.0
STM32F439 MPL3115A2 pressure and temperature tutorial
Loading...
Searching...
No Matches
mpl3115a2.h
1
11#ifndef MPL3115A2_H_
12#define MPL3115A2_H_
13
14#include <main.h>
15
17#define MPL3115A2_ADDRESS (0x60 << 1)
18
22enum {
23 MPL3115A2_REGISTER_STATUS = (0x00),
24
25 MPL3115A2_REGISTER_PRESSURE_MSB = (0x01),
26 MPL3115A2_REGISTER_PRESSURE_CSB = (0x02),
27 MPL3115A2_REGISTER_PRESSURE_LSB = (0x03),
28
29 MPL3115A2_REGISTER_TEMP_MSB = (0x04),
30 MPL3115A2_REGISTER_TEMP_LSB = (0x05),
31
32 MPL3115A2_WHOAMI = (0x0C),
33};
39enum {
40 MPL3115A2_REGISTER_STATUS_TDR = 0x02,
41 MPL3115A2_REGISTER_STATUS_PTDR = 0x08,
42};
48enum {
49 MPL3115A2_PT_DATA_CFG = 0x13,
50 MPL3115A2_PT_DATA_CFG_TDEFE = 0x01,
51 MPL3115A2_PT_DATA_CFG_PDEFE = 0x02,
52 MPL3115A2_PT_DATA_CFG_DREM = 0x04,
53};
59enum {
60 MPL3115A2_CTRL_REG1 = (0x26),
61};
67enum {
68 MPL3115A2_CTRL_REG1_SBYB = 0x01,
69};
75enum {
76 MPL3115A2_CTRL_REG1_OS128 = 0x38,
77};
91HAL_StatusTypeDef MPL3115A2_Init(I2C_HandleTypeDef *hi2c, uint16_t devAddr);
92
99HAL_StatusTypeDef MPL3115A2_GetStatus(uint8_t *data);
100
107HAL_StatusTypeDef MPL3115A2_ReadPressure(float *pressure_inHg);
108
115HAL_StatusTypeDef MPL3115A2_ReadTemperature(float *celsius);
116
117
118
119#endif /* MPL3115A2_H_ */
: Common application definitions for the MPL3115A2 tutorial.
HAL_StatusTypeDef MPL3115A2_Init(I2C_HandleTypeDef *hi2c, uint16_t devAddress)
Initialize and configure the MPL3115A2 sensor.
Definition mpl3115a2.c:40
HAL_StatusTypeDef MPL3115A2_ReadPressure(float *pressure_inHg)
Read and convert the MPL3115A2 pressure measurement.
Definition mpl3115a2.c:156
static uint16_t devAddr
STM32 HAL-formatted MPL3115A2 I2C address.
Definition mpl3115a2.c:17
HAL_StatusTypeDef MPL3115A2_GetStatus(uint8_t *retVal)
Read the MPL3115A2 STATUS register.
Definition mpl3115a2.c:99
HAL_StatusTypeDef MPL3115A2_ReadTemperature(float *celsius)
Read and convert the MPL3115A2 temperature measurement.
Definition mpl3115a2.c:125