IZAR Flight Controller 1.0.0
IZAR Flight Controller running with an ESP32.
ms5611.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Bernhard Guillon <Bernhard.Guillon@begu.org>
3 * Copyright (c) 2018 Ruslan V. Uss <unclerus@gmail.com>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of itscontributors
14 * may be used to endorse or promote products derived from this software without
15 * specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
43#ifndef __MS5611_H__
44#define __MS5611_H__
45
46#include <stdint.h>
47#include <i2cdev.h>
48#include <esp_err.h>
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54#define MS5611_ADDR_CSB_HIGH 0x76
55#define MS5611_ADDR_CSB_LOW 0x77
56
68
72typedef struct
73{
74 uint16_t sens;
75 uint16_t off;
76 uint16_t tcs;
77 uint16_t tco;
78 uint16_t t_ref;
79 uint16_t tempsens;
81
91
102esp_err_t ms5611_init_desc(ms5611_t *dev, uint8_t addr, i2c_port_t port, gpio_num_t sda_gpio, gpio_num_t scl_gpio);
103
110esp_err_t ms5611_free_desc(ms5611_t *dev);
111
121esp_err_t ms5611_init(ms5611_t *dev, ms5611_osr_t osr);
122
131esp_err_t ms5611_get_sensor_data(ms5611_t *dev, int32_t *pressure, float *temperature);
132
133#ifdef __cplusplus
134}
135#endif
136
138
139#endif /* __MS5611_H__ */
ms5611_osr_t
Definition ms5611.h:61
esp_err_t ms5611_get_sensor_data(ms5611_t *dev, int32_t *pressure, float *temperature)
Measure pressure and temperature.
Definition ms5611.c:209
esp_err_t ms5611_free_desc(ms5611_t *dev)
Free device descriptor.
Definition ms5611.c:188
esp_err_t ms5611_init_desc(ms5611_t *dev, uint8_t addr, i2c_port_t port, gpio_num_t sda_gpio, gpio_num_t scl_gpio)
Initialize device descriptor.
Definition ms5611.c:168
esp_err_t ms5611_init(ms5611_t *dev, ms5611_osr_t osr)
Init MS5611-01BA03.
Definition ms5611.c:194
@ MS5611_OSR_4096
4096 samples per measurement
Definition ms5611.h:66
@ MS5611_OSR_1024
1024 samples per measurement
Definition ms5611.h:64
@ MS5611_OSR_2048
2048 samples per measurement
Definition ms5611.h:65
@ MS5611_OSR_512
512 samples per measurement
Definition ms5611.h:63
@ MS5611_OSR_256
256 samples per measurement
Definition ms5611.h:62
Definition i2cdev.h:70
Definition ms5611.h:73
uint16_t off
C2 Pressure offset | OFF_t1.
Definition ms5611.h:75
uint16_t tcs
C3 Temperature coefficient of pressure sensitivity | TCS.
Definition ms5611.h:76
uint16_t t_ref
C5 Reference temperature | T_ref.
Definition ms5611.h:78
uint16_t sens
C1 Pressure sensitivity | SENS_t1.
Definition ms5611.h:74
uint16_t tco
C4 Temperature coefficient of pressure offset | TCO.
Definition ms5611.h:77
uint16_t tempsens
C6 Temperature coefficient of the temperature | TEMPSENSE.
Definition ms5611.h:79
Definition ms5611.h:86
ms5611_config_data_t config_data
Device configuration, filled upon initialize.
Definition ms5611.h:89
i2c_dev_t i2c_dev
I2C device settings.
Definition ms5611.h:87
ms5611_osr_t osr
Oversampling setting.
Definition ms5611.h:88