Loading...
Searching...
No Matches
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
39extern "C"
40{
41#endif
42
46enum {
51};
52
56#define MPL3115A2_I2C_ADDRESS (0x60)
57
62enum {
71};
72#define MPL3115A2_OS_RATIO_DEFAULT MPL3115A2_OS_RATIO_16
85#ifndef MPL3115A2_CONVERSION_TIME
86#define MPL3115A2_CONVERSION_TIME (514000UL)
87#endif
93typedef struct {
95 uint8_t addr;
96 uint8_t ratio;
98
105
118
128
138
148
159
170int mpl3115a2_read_pressure(const mpl3115a2_t *dev, uint32_t *pres, uint8_t *status);
171
181int mpl3115a2_read_temp(const mpl3115a2_t *dev, int16_t *temp);
182
183#ifdef __cplusplus
184}
185#endif
186
187#endif /* MPL3115A2_H */
int mpl3115a2_reset(const mpl3115a2_t *dev)
Reset the MPL3115A2 sensor.
int mpl3115a2_read_pressure(const mpl3115a2_t *dev, uint32_t *pres, uint8_t *status)
Read sensor's data in pressure mode.
int mpl3115a2_set_standby(const mpl3115a2_t *dev)
Set standby mode.
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.
int mpl3115a2_set_active(const mpl3115a2_t *dev)
Set active mode, this enables periodic measurements.
int mpl3115a2_read_temp(const mpl3115a2_t *dev, int16_t *temp)
Read sensor's temperature.
@ MPL3115A2_OK
all good
Definition mpl3115a2.h:47
@ MPL3115A2_ERROR_DEV
Device MPL3115A2 not found.
Definition mpl3115a2.h:49
@ MPL3115A2_ERROR_CNF
Device configuration failed.
Definition mpl3115a2.h:50
@ MPL3115A2_ERROR_I2C
I2C communication failed.
Definition mpl3115a2.h:48
@ MPL3115A2_OS_RATIO_8
Oversample Ratio 8, conversion 34ms.
Definition mpl3115a2.h:66
@ MPL3115A2_OS_RATIO_1
Oversample Ratio 1, conversion 6ms.
Definition mpl3115a2.h:63
@ MPL3115A2_OS_RATIO_128
Oversample Ratio 128, conversion 514ms.
Definition mpl3115a2.h:70
@ MPL3115A2_OS_RATIO_2
Oversample Ratio 2, conversion 10ms.
Definition mpl3115a2.h:64
@ MPL3115A2_OS_RATIO_4
Oversample Ratio 4, conversion 18ms.
Definition mpl3115a2.h:65
@ MPL3115A2_OS_RATIO_32
Oversample Ratio 32, conversion 130ms.
Definition mpl3115a2.h:68
@ MPL3115A2_OS_RATIO_16
Oversample Ratio 16, conversion 66ms.
Definition mpl3115a2.h:67
@ MPL3115A2_OS_RATIO_64
Oversample Ratio 64, conversion 258ms.
Definition mpl3115a2.h:69
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
Configuration parameters.
Definition mpl3115a2.h:93
uint8_t ratio
MPL3115A2 oversampling ratio.
Definition mpl3115a2.h:96
uint8_t addr
I2C bus address of the device.
Definition mpl3115a2.h:95
i2c_t i2c
I2C bus the device is connected to.
Definition mpl3115a2.h:94
Device descriptor for MPL3115A2 sensors.
Definition mpl3115a2.h:102
mpl3115a2_params_t params
device configuration parameters
Definition mpl3115a2.h:103