Have the good old MS5534A as module. It still works :-)

This commit is contained in:
Martin Mueller
2010-10-19 20:54:52 +00:00
parent e4ccae957e
commit 747fff36e3
7 changed files with 53 additions and 33 deletions
+4 -4
View File
@@ -24,7 +24,6 @@
<define name="ALT_KALMAN"/>
<define name="WIND_INFO"/>
<define name="WIND_INFO_RET"/>
<define name="USE_I2C0"/>
</target>
<subsystem name="radio_control" type="ppm"/>
@@ -42,7 +41,7 @@
<param name="GPS_BAUD" value="B38400"/>
</subsystem>
<subsystem name="navigation"/>
<subsystem name="i2c"/>
<subsystem name="spi"/>
</firmware>
<firmware name="setup">
@@ -55,9 +54,10 @@
<!-- 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="light_temt.xml"/>
<load name="light_temt.xml"/>
<load name="humid_hih.xml"/>
<load name="temp_tmp102.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
+21
View File
@@ -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>
+1 -1
View File
@@ -181,7 +181,7 @@
#endif
#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)
#else
#define PERIODIC_SEND_BARO_MS5534A(_chan) {}
+1 -28
View File
@@ -91,10 +91,6 @@
#include "srf08.h"
#endif
#ifdef USE_BARO_MS5534A
#include "baro_MS5534A.h"
#endif
#ifdef USE_MAX11040
#include "max11040.h"
#endif
@@ -573,12 +569,6 @@ void periodic_task_ap( void ) {
#error "Only 20 and 60 allowed for CONTROL_RATE"
#endif
#ifdef USE_BARO_MS5534A
if (!_20Hz) {
baro_MS5534A_send();
}
#endif
#ifdef USE_I2C0
// I2C0 scheduler
switch (_20Hz) {
@@ -763,10 +753,6 @@ void init_ap( void ) {
IO0SET = _BV(AEROCOMM_DATA_PIN);
#endif
#ifdef USE_BARO_MS5534A
baro_MS5534A_init();
#endif
power_switch = FALSE;
/************ Multi-uavs status ***************/
@@ -892,20 +878,7 @@ void event_task_ap( void ) {
}
#endif
#ifdef USE_BARO_MS5534A
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 defined(USE_BARO_ETS)
if (baro_ets_updated) {
baro_ets_updated = FALSE;
if (baro_ets_valid) {
@@ -25,6 +25,7 @@
/** \file baro_MS5534A.c
* \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"
@@ -34,6 +35,7 @@
#include "ap_downlink.h"
#endif
#include "nav.h"
#include "estimator.h"
bool_t baro_MS5534A_do_reset;
uint32_t baro_MS5534A_pressure;
@@ -249,3 +251,19 @@ void baro_MS5534A_event_task( void ) {
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 */
void baro_MS5534A_event_task( void );
void baro_MS5534A_event( void );
#endif // USE_BARO_MS5534A
#endif // BARO_MS5534A_H