IZAR Flight Controller 1.0.0
IZAR Flight Controller running with an ESP32.
ms5611.c File Reference
#include "ms5611.h"
#include <esp_idf_lib_helpers.h>
#include <esp_log.h>
#include <esp_system.h>
#include <ets_sys.h>
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
#include <stddef.h>
Include dependency graph for ms5611.c:

Macros

#define I2C_FREQ_HZ   400000
#define CMD_CONVERT_D1   0x40
#define CMD_CONVERT_D2   0x50
#define CMD_ADC_READ   0x00
#define CMD_RESET   0x1E
#define PROM_ADDR_SENS   0xa2
#define PROM_ADDR_OFF   0xa4
#define PROM_ADDR_TCS   0xa6
#define PROM_ADDR_TCO   0xa8
#define PROM_ADDR_T_REF   0xaa
#define PROM_ADDR_TEMPSENS   0xac
#define CHECK(x)
#define CHECK_ARG(VAL)

Functions

static esp_err_t send_command (ms5611_t *dev, uint8_t cmd)
static uint16_t shuffle (uint16_t val)
static esp_err_t read_prom (ms5611_t *dev)
static esp_err_t read_adc (ms5611_t *dev, uint32_t *result)
static void wait_conversion (ms5611_t *dev)
static esp_err_t get_raw_temperature (ms5611_t *dev, uint32_t *result)
static esp_err_t get_raw_pressure (ms5611_t *dev, uint32_t *result)
static esp_err_t ms5611_reset (ms5611_t *dev)
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.
esp_err_t ms5611_free_desc (ms5611_t *dev)
 Free device descriptor.
esp_err_t ms5611_init (ms5611_t *dev, ms5611_osr_t osr)
 Init MS5611-01BA03.
esp_err_t ms5611_get_sensor_data (ms5611_t *dev, int32_t *pressure, float *temperature)
 Measure pressure and temperature.

Variables

static const char * TAG = "ms5611"

Detailed Description

ESP-IDF driver for barometric pressure sensor MS5611-01BA03

Ported from esp-open-rtos

Copyright (c) 2016 Bernhard Guillon Bernh.nosp@m.ard..nosp@m.Guill.nosp@m.on@b.nosp@m.egu.o.nosp@m.rg
Copyright (c) 2018 Ruslan V. Uss uncle.nosp@m.rus@.nosp@m.gmail.nosp@m..com

BSD Licensed as described in the file LICENSE

Macro Definition Documentation

◆ CHECK

#define CHECK ( x)
Value:
do { \
esp_err_t __; \
if ((__ = x) != ESP_OK) \
return __; \
} while (0)

◆ CHECK_ARG

#define CHECK_ARG ( VAL)
Value:
do { \
if (!(VAL)) \
return ESP_ERR_INVALID_ARG; \
} while (0)

◆ CMD_ADC_READ

#define CMD_ADC_READ   0x00

◆ CMD_CONVERT_D1

#define CMD_CONVERT_D1   0x40

◆ CMD_CONVERT_D2

#define CMD_CONVERT_D2   0x50

◆ CMD_RESET

#define CMD_RESET   0x1E

◆ I2C_FREQ_HZ

#define I2C_FREQ_HZ   400000

◆ PROM_ADDR_OFF

#define PROM_ADDR_OFF   0xa4

◆ PROM_ADDR_SENS

#define PROM_ADDR_SENS   0xa2

◆ PROM_ADDR_T_REF

#define PROM_ADDR_T_REF   0xaa

◆ PROM_ADDR_TCO

#define PROM_ADDR_TCO   0xa8

◆ PROM_ADDR_TCS

#define PROM_ADDR_TCS   0xa6

◆ PROM_ADDR_TEMPSENS

#define PROM_ADDR_TEMPSENS   0xac

Function Documentation

◆ get_raw_pressure()

esp_err_t get_raw_pressure ( ms5611_t * dev,
uint32_t * result )
inlinestatic

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_raw_temperature()

esp_err_t get_raw_temperature ( ms5611_t * dev,
uint32_t * result )
inlinestatic

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ms5611_reset()

esp_err_t ms5611_reset ( ms5611_t * dev)
static

< esp_err_t value indicating success (no error)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_adc()

esp_err_t read_adc ( ms5611_t * dev,
uint32_t * result )
static

< esp_err_t value indicating success (no error)

< Received response was invalid

< esp_err_t value indicating success (no error)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_prom()

esp_err_t read_prom ( ms5611_t * dev)
inlinestatic

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

< esp_err_t value indicating success (no error)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_command()

esp_err_t send_command ( ms5611_t * dev,
uint8_t cmd )
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shuffle()

uint16_t shuffle ( uint16_t val)
inlinestatic
Here is the caller graph for this function:

◆ wait_conversion()

void wait_conversion ( ms5611_t * dev)
static
Here is the caller graph for this function:

Variable Documentation

◆ TAG

const char* TAG = "ms5611"
static