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 
29 #ifndef MPL3115A2_H
30 #define MPL3115A2_H
31 
32 #include <stdint.h>
33 #include <stdbool.h>
34 #include "periph/i2c.h"
35 
36 #ifdef __cplusplus
37 extern "C"
38 {
39 #endif
40 
44 enum {
49 };
50 
51 #ifndef MPL3115A2_I2C_ADDRESS
52 
55 #define MPL3115A2_I2C_ADDRESS (0x60)
56 #endif
57 
62 enum {
71 };
72 #define MPL3115A2_OS_RATIO_DEFAULT MPL3115A2_OS_RATIO_16
75 #ifndef MPL3115A2_CONVERSION_TIME
76 
81 #define MPL3115A2_CONVERSION_TIME (514000UL)
82 #endif
83 
87 typedef struct {
89  uint8_t addr;
90  uint8_t ratio;
92 
96 typedef struct {
98 } mpl3115a2_t;
99 
111 int mpl3115a2_init(mpl3115a2_t *dev, const mpl3115a2_params_t *params);
112 
121 int mpl3115a2_reset(const mpl3115a2_t *dev);
122 
131 int mpl3115a2_set_active(const mpl3115a2_t *dev);
132 
141 int mpl3115a2_set_standby(const mpl3115a2_t *dev);
142 
152 int mpl3115a2_is_ready(const mpl3115a2_t *dev);
153 
164 int mpl3115a2_read_pressure(const mpl3115a2_t *dev, uint32_t *pres, uint8_t *status);
165 
175 int mpl3115a2_read_temp(const mpl3115a2_t *dev, int16_t *temp);
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif /* MPL3115A2_H */
182 
Oversample Ratio 2, conversion 10ms.
Definition: mpl3115a2.h:64
int mpl3115a2_init(mpl3115a2_t *dev, const mpl3115a2_params_t *params)
Initialize the MPL3115A2 sensor driver.
int mpl3115a2_is_ready(const mpl3115a2_t *dev)
Check for new set of measurement data.
Oversample Ratio 64, conversion 258ms.
Definition: mpl3115a2.h:69
Device descriptor for MPL3115A2 sensors.
Definition: mpl3115a2.h:96
int mpl3115a2_read_temp(const mpl3115a2_t *dev, int16_t *temp)
Read sensor&#39;s temperature.
Device MPL3115A2 not found.
Definition: mpl3115a2.h:47
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:108
int mpl3115a2_read_pressure(const mpl3115a2_t *dev, uint32_t *pres, uint8_t *status)
Read sensor&#39;s data in pressure mode.
i2c_t i2c
I2C bus the device is connected to.
Definition: mpl3115a2.h:88
uint8_t ratio
MPL3115A2 oversampling ratio.
Definition: mpl3115a2.h:90
Device configuration failed.
Definition: mpl3115a2.h:48
Oversample Ratio 4, conversion 18ms.
Definition: mpl3115a2.h:65
Configuration parameters.
Definition: mpl3115a2.h:87
mpl3115a2_params_t params
device configuration parameters
Definition: mpl3115a2.h:97
all good
Definition: mpl3115a2.h:45
I2C communication failed.
Definition: mpl3115a2.h:46
int mpl3115a2_reset(const mpl3115a2_t *dev)
Reset the MPL3115A2 sensor.
uint8_t addr
I2C bus address of the device.
Definition: mpl3115a2.h:89
Oversample Ratio 8, conversion 34ms.
Definition: mpl3115a2.h:66
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 1, conversion 6ms.
Definition: mpl3115a2.h:63
Oversample Ratio 16, conversion 66ms.
Definition: mpl3115a2.h:67
Oversample Ratio 128, conversion 514ms.
Definition: mpl3115a2.h:70
Oversample Ratio 32, conversion 130ms.
Definition: mpl3115a2.h:68
Low-level I2C peripheral driver interface definition.