mpl3115a2.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 PHYTEC Messtechnik GmbH
3  * 2017 HAW Hamburg
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
31 #ifndef MPL3115A2_H
32 #define MPL3115A2_H
33 
34 #include <stdint.h>
35 #include <stdbool.h>
36 #include "periph/i2c.h"
37 
38 #ifdef __cplusplus
39 extern "C"
40 {
41 #endif
42 
46 enum {
51 };
52 
53 #ifndef MPL3115A2_I2C_ADDRESS
54 
57 #define MPL3115A2_I2C_ADDRESS (0x60)
58 #endif
59 
64 enum {
73 };
74 #define MPL3115A2_OS_RATIO_DEFAULT MPL3115A2_OS_RATIO_16
77 #ifndef MPL3115A2_CONVERSION_TIME
78 
83 #define MPL3115A2_CONVERSION_TIME (514000UL)
84 #endif
85 
89 typedef struct {
91  uint8_t addr;
92  uint8_t ratio;
94 
98 typedef struct {
100 } mpl3115a2_t;
101 
113 int mpl3115a2_init(mpl3115a2_t *dev, const mpl3115a2_params_t *params);
114 
123 int mpl3115a2_reset(const mpl3115a2_t *dev);
124 
133 int mpl3115a2_set_active(const mpl3115a2_t *dev);
134 
143 int mpl3115a2_set_standby(const mpl3115a2_t *dev);
144 
154 int mpl3115a2_is_ready(const mpl3115a2_t *dev);
155 
166 int mpl3115a2_read_pressure(const mpl3115a2_t *dev, uint32_t *pres, uint8_t *status);
167 
177 int mpl3115a2_read_temp(const mpl3115a2_t *dev, int16_t *temp);
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #endif /* MPL3115A2_H */
184 
all good
Definition: mpl3115a2.h:47
Oversample Ratio 32, conversion 130ms.
Definition: mpl3115a2.h:70
int mpl3115a2_init(mpl3115a2_t *dev, const mpl3115a2_params_t *params)
Initialize the MPL3115A2 sensor driver.
Device MPL3115A2 not found.
Definition: mpl3115a2.h:49
int mpl3115a2_is_ready(const mpl3115a2_t *dev)
Check for new set of measurement data.
Device descriptor for MPL3115A2 sensors.
Definition: mpl3115a2.h:98
int mpl3115a2_read_temp(const mpl3115a2_t *dev, int16_t *temp)
Read sensor&#39;s temperature.
Oversample Ratio 4, conversion 18ms.
Definition: mpl3115a2.h:67
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:157
Oversample Ratio 16, conversion 66ms.
Definition: mpl3115a2.h:69
Oversample Ratio 2, conversion 10ms.
Definition: mpl3115a2.h:66
int mpl3115a2_read_pressure(const mpl3115a2_t *dev, uint32_t *pres, uint8_t *status)
Read sensor&#39;s data in pressure mode.
I2C communication failed.
Definition: mpl3115a2.h:48
i2c_t i2c
I2C bus the device is connected to.
Definition: mpl3115a2.h:90
Oversample Ratio 128, conversion 514ms.
Definition: mpl3115a2.h:72
uint8_t ratio
MPL3115A2 oversampling ratio.
Definition: mpl3115a2.h:92
Oversample Ratio 1, conversion 6ms.
Definition: mpl3115a2.h:65
Configuration parameters.
Definition: mpl3115a2.h:89
Oversample Ratio 64, conversion 258ms.
Definition: mpl3115a2.h:71
Device configuration failed.
Definition: mpl3115a2.h:50
mpl3115a2_params_t params
device configuration parameters
Definition: mpl3115a2.h:99
int mpl3115a2_reset(const mpl3115a2_t *dev)
Reset the MPL3115A2 sensor.
uint8_t addr
I2C bus address of the device.
Definition: mpl3115a2.h:91
int mpl3115a2_set_active(const mpl3115a2_t *dev)
Set active mode, this enables periodic measurements.
int mpl3115a2_set_standby(const mpl3115a2_t *dev)
Set standby mode.
Oversample Ratio 8, conversion 34ms.
Definition: mpl3115a2.h:68
Low-level I2C peripheral driver interface definition.