mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-27 17:06:31 +08:00
Have the good old MS5534A as module. It still works :-)
This commit is contained in:
@@ -24,7 +24,6 @@
|
|||||||
<define name="ALT_KALMAN"/>
|
<define name="ALT_KALMAN"/>
|
||||||
<define name="WIND_INFO"/>
|
<define name="WIND_INFO"/>
|
||||||
<define name="WIND_INFO_RET"/>
|
<define name="WIND_INFO_RET"/>
|
||||||
<define name="USE_I2C0"/>
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<subsystem name="radio_control" type="ppm"/>
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
@@ -42,7 +41,7 @@
|
|||||||
<param name="GPS_BAUD" value="B38400"/>
|
<param name="GPS_BAUD" value="B38400"/>
|
||||||
</subsystem>
|
</subsystem>
|
||||||
<subsystem name="navigation"/>
|
<subsystem name="navigation"/>
|
||||||
<subsystem name="i2c"/>
|
<subsystem name="spi"/>
|
||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
<firmware name="setup">
|
<firmware name="setup">
|
||||||
@@ -55,9 +54,10 @@
|
|||||||
|
|
||||||
<!-- modules -->
|
<!-- modules -->
|
||||||
<modules>
|
<modules>
|
||||||
<load name="baro_bmp.xml"/>
|
<load name="baro_MS5534A.xml"/>
|
||||||
|
<!--load name="baro_bmp.xml"/>
|
||||||
<load name="baro_scp_i2c.xml"/>
|
<load name="baro_scp_i2c.xml"/>
|
||||||
<!--load name="light_temt.xml"/>
|
<load name="light_temt.xml"/>
|
||||||
<load name="humid_hih.xml"/>
|
<load name="humid_hih.xml"/>
|
||||||
<load name="temp_tmp102.xml"/>
|
<load name="temp_tmp102.xml"/>
|
||||||
<load name="temp_lm75.xml"/>
|
<load name="temp_lm75.xml"/>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#generic spi driver
|
||||||
|
$(TARGET).CFLAGS += -DUSE_SPI
|
||||||
|
|
||||||
|
ap.srcs += spi.c $(SRC_ARCH)/spi_hw.c
|
||||||
|
sim.srcs += spi.c $(SRC_ARCH)/spi_hw.c
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE module SYSTEM "module.dtd">
|
||||||
|
|
||||||
|
<module name="baro_MS5534A" dir="sensors">
|
||||||
|
<header>
|
||||||
|
<file name="baro_MS5534A.h"/>
|
||||||
|
</header>
|
||||||
|
<init fun="baro_MS5534A_init()"/>
|
||||||
|
<periodic fun="baro_MS5534A_send()" freq="20"/>
|
||||||
|
<event fun="baro_MS5534A_event()"/>
|
||||||
|
<makefile>
|
||||||
|
<file name="baro_MS5534A.c"/>
|
||||||
|
<flag name="USE_BARO_MS5534A"/>
|
||||||
|
<flag name="USE_SPI_SLAVE0"/>
|
||||||
|
<flag name="SPI_MASTER"/>
|
||||||
|
<define name="BARO_MS5534A_W1" value="0xAC20"/>
|
||||||
|
<define name="BARO_MS5534A_W2" value="0x87D9"/>
|
||||||
|
<define name="BARO_MS5534A_W3" value="0x8D9C"/>
|
||||||
|
<define name="BARO_MS5534A_W4" value="0xB080"/>
|
||||||
|
</makefile>
|
||||||
|
</module>
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_BARO_MS5534A
|
#ifdef USE_BARO_MS5534A
|
||||||
#include "baro_MS5534A.h"
|
//#include "baro_MS5534A.h"
|
||||||
#define PERIODIC_SEND_BARO_MS5534A(_chan) DOWNLINK_SEND_BARO_MS5534A(_chan, &baro_MS5534A_pressure, &baro_MS5534A_temp, &baro_MS5534A_z)
|
#define PERIODIC_SEND_BARO_MS5534A(_chan) DOWNLINK_SEND_BARO_MS5534A(_chan, &baro_MS5534A_pressure, &baro_MS5534A_temp, &baro_MS5534A_z)
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_BARO_MS5534A(_chan) {}
|
#define PERIODIC_SEND_BARO_MS5534A(_chan) {}
|
||||||
|
|||||||
+1
-28
@@ -91,10 +91,6 @@
|
|||||||
#include "srf08.h"
|
#include "srf08.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_BARO_MS5534A
|
|
||||||
#include "baro_MS5534A.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_MAX11040
|
#ifdef USE_MAX11040
|
||||||
#include "max11040.h"
|
#include "max11040.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -573,12 +569,6 @@ void periodic_task_ap( void ) {
|
|||||||
#error "Only 20 and 60 allowed for CONTROL_RATE"
|
#error "Only 20 and 60 allowed for CONTROL_RATE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_BARO_MS5534A
|
|
||||||
if (!_20Hz) {
|
|
||||||
baro_MS5534A_send();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_I2C0
|
#ifdef USE_I2C0
|
||||||
// I2C0 scheduler
|
// I2C0 scheduler
|
||||||
switch (_20Hz) {
|
switch (_20Hz) {
|
||||||
@@ -763,10 +753,6 @@ void init_ap( void ) {
|
|||||||
IO0SET = _BV(AEROCOMM_DATA_PIN);
|
IO0SET = _BV(AEROCOMM_DATA_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_BARO_MS5534A
|
|
||||||
baro_MS5534A_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
power_switch = FALSE;
|
power_switch = FALSE;
|
||||||
|
|
||||||
/************ Multi-uavs status ***************/
|
/************ Multi-uavs status ***************/
|
||||||
@@ -892,20 +878,7 @@ void event_task_ap( void ) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_BARO_MS5534A
|
#if defined(USE_BARO_ETS)
|
||||||
if (spi_message_received) {
|
|
||||||
/* Got a message on SPI. */
|
|
||||||
spi_message_received = FALSE;
|
|
||||||
baro_MS5534A_event_task();
|
|
||||||
if (baro_MS5534A_available) {
|
|
||||||
baro_MS5534A_available = FALSE;
|
|
||||||
baro_MS5534A_z = ground_alt +((float)baro_MS5534A_ground_pressure - baro_MS5534A_pressure)*0.084;
|
|
||||||
if (alt_baro_enabled) {
|
|
||||||
EstimatorSetAlt(baro_MS5534A_z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#elif defined(USE_BARO_ETS)
|
|
||||||
if (baro_ets_updated) {
|
if (baro_ets_updated) {
|
||||||
baro_ets_updated = FALSE;
|
baro_ets_updated = FALSE;
|
||||||
if (baro_ets_valid) {
|
if (baro_ets_valid) {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
/** \file baro_MS5534A.c
|
/** \file baro_MS5534A.c
|
||||||
* \brief Handling of the MS5534a pressure sensor
|
* \brief Handling of the MS5534a pressure sensor
|
||||||
*
|
*
|
||||||
|
* uses: MOSI, MISO, SCK and 32kHz @ P0.7 with 5V for the -A type
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "baro_MS5534A.h"
|
#include "baro_MS5534A.h"
|
||||||
@@ -34,6 +35,7 @@
|
|||||||
#include "ap_downlink.h"
|
#include "ap_downlink.h"
|
||||||
#endif
|
#endif
|
||||||
#include "nav.h"
|
#include "nav.h"
|
||||||
|
#include "estimator.h"
|
||||||
|
|
||||||
bool_t baro_MS5534A_do_reset;
|
bool_t baro_MS5534A_do_reset;
|
||||||
uint32_t baro_MS5534A_pressure;
|
uint32_t baro_MS5534A_pressure;
|
||||||
@@ -249,3 +251,19 @@ void baro_MS5534A_event_task( void ) {
|
|||||||
baro_MS5534A_send();
|
baro_MS5534A_send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void baro_MS5534A_event( void ) {
|
||||||
|
if (spi_message_received) {
|
||||||
|
/* Got a message on SPI. */
|
||||||
|
spi_message_received = FALSE;
|
||||||
|
baro_MS5534A_event_task();
|
||||||
|
if (baro_MS5534A_available) {
|
||||||
|
baro_MS5534A_available = FALSE;
|
||||||
|
baro_MS5534A_z = ground_alt +((float)baro_MS5534A_ground_pressure - baro_MS5534A_pressure)*0.084;
|
||||||
|
if (alt_baro_enabled) {
|
||||||
|
EstimatorSetAlt(baro_MS5534A_z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -53,6 +53,9 @@ void baro_MS5534A_send(void);
|
|||||||
/* Set baro_MS5534A_available when pressure and temp are readable */
|
/* Set baro_MS5534A_available when pressure and temp are readable */
|
||||||
void baro_MS5534A_event_task( void );
|
void baro_MS5534A_event_task( void );
|
||||||
|
|
||||||
|
void baro_MS5534A_event( void );
|
||||||
|
|
||||||
#endif // USE_BARO_MS5534A
|
#endif // USE_BARO_MS5534A
|
||||||
|
|
||||||
#endif // BARO_MS5534A_H
|
#endif // BARO_MS5534A_H
|
||||||
|
|
||||||
Reference in New Issue
Block a user