Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
baro_ms5611_spi.c
Go to the documentation of this file.
1/*
2 * Copyright (C) 2011-2013 The Paparazzi Team
3 *
4 * This file is part of paparazzi.
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 *
21 */
22
31
32#include "math/pprz_isa.h"
33#include "mcu_periph/sys_time.h"
34#include "modules/core/abi.h"
35#include "mcu_periph/uart.h"
36#include "pprzlink/messages.h"
38
39#if USE_BARO_MEDIAN_FILTER
43#endif
44
45#ifndef MS5611_SPI_DEV
46#define MS5611_SPI_DEV spi1
47#endif
48
49#ifndef MS5611_SLAVE_IDX
50#define MS5611_SLAVE_IDX SPI_SLAVE0
51#endif
52
54
59
62
63
79
81{
83
84#if SENSOR_SYNC_SEND
85 // send coeff every 30s
87#endif
88
89}
90
93{
94 if (sys_time.nb_sec > 1) {
96 }
97}
98
100{
101
103
106 #if USE_BARO_MEDIAN_FILTER
108 #endif
109 float temp = baro_ms5611.data.temperature / 100.0f;
110 // First Temp as ABI since pressure could depend on temp
112
113 #if USE_BARO_MEDIAN_FILTER
115 #endif
116 float pressure = (float)baro_ms5611.data.pressure;
118
120
123
124#ifdef SENSOR_SYNC_SEND
128 &fbaroms, &temp);
129#endif
130 }
131}
132
Main include for ABI (AirBorneInterface).
#define BARO_MS5611_SENDER_ID
#define BARO_MS5611_R
#define BARO_MS5611_SIGMA2
float baro_ms5611_sigma2
bool baro_ms5611_alt_valid
float baro_ms5611_alt
struct Ms5611_Spi baro_ms5611
void baro_ms5611_periodic_check(void)
float ftempms
void baro_ms5611_init(void)
float fbaroms
bool baro_ms5611_enabled
void baro_ms5611_read(void)
trigger new measurement or initialize if needed
void baro_ms5611_send_coeff(void)
float baro_ms5611_r
void baro_ms5611_event(void)
#define MS5611_SPI_DEV
#define MS5611_SLAVE_IDX
Measurement Specialties (Intersema) MS5611-01BA pressure/temperature sensor interface for SPI.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
static float pprz_isa_altitude_of_pressure(float pressure)
Get absolute altitude from pressure (using simplified equation).
Definition pprz_isa.h:82
uint16_t foo
Definition main_demo5.c:58
static float update_median_filter_f(struct MedianFilterFloat *filter, float new_data)
static void init_median_filter_f(struct MedianFilterFloat *filter, uint8_t size)
#define MEDIAN_DEFAULT_SIZE
uint32_t d2
Definition ms5611.h:56
uint32_t d1
Definition ms5611.h:55
uint32_t pressure
pressure in Pascal (0.01mbar)
Definition ms5611.h:52
int32_t temperature
temperature with 0.01 degrees Celsius resolution
Definition ms5611.h:53
uint16_t c[PROM_NB]
Definition ms5611.h:54
void ms5611_spi_event(struct Ms5611_Spi *ms)
Definition ms5611_spi.c:133
void ms5611_spi_periodic_check(struct Ms5611_Spi *ms)
Periodic function to ensure proper delay after triggering reset or conversion.
Definition ms5611_spi.c:92
void ms5611_spi_init(struct Ms5611_Spi *ms, struct spi_periph *spi_p, uint8_t slave_idx, bool is_ms5607)
Definition ms5611_spi.c:33
struct Ms5611Data data
Definition ms5611_spi.h:45
bool initialized
config done flag
Definition ms5611_spi.h:43
volatile bool data_available
data ready flag
Definition ms5611_spi.h:44
static void ms5611_spi_read(struct Ms5611_Spi *ms)
convenience function to trigger new measurement.
Definition ms5611_spi.h:61
Paparazzi atmospheric pressure conversion utilities.
#define FALSE
Definition std.h:5
Architecture independent timing functions.
volatile uint32_t nb_sec
full seconds since startup
Definition sys_time.h:72
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.