Skip to content

Commit

Permalink
Merge branch 'baro_peripherals'
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Aug 28, 2013
2 parents f7d26c3 + c959335 commit 11b48b4
Show file tree
Hide file tree
Showing 30 changed files with 1,736 additions and 1,204 deletions.
24 changes: 18 additions & 6 deletions conf/firmwares/rotorcraft.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,18 @@ LISA_M_BARO ?= BARO_BOARD_BMP085
ifeq ($(LISA_M_BARO), BARO_MS5611_SPI)
include $(CFG_SHARED)/spi_master.makefile
ap.CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
ap.srcs += $(SRC_BOARD)/baro_ms5611_spi.c
ap.srcs += peripherals/ms5611.c
ap.srcs += peripherals/ms5611_spi.c
ap.srcs += subsystems/sensors/baro_ms5611_spi.c
else ifeq ($(LISA_M_BARO), BARO_MS5611_I2C)
ap.CFLAGS += -DUSE_I2C2
ap.srcs += $(SRC_BOARD)/baro_ms5611_i2c.c
ap.srcs += peripherals/ms5611.c
ap.srcs += peripherals/ms5611_i2c.c
ap.srcs += subsystems/sensors/baro_ms5611_i2c.c
else ifeq ($(LISA_M_BARO), BARO_BOARD_BMP085)
ap.srcs += peripherals/bmp085.c
ap.srcs += $(SRC_BOARD)/baro_board.c
ap.CFLAGS += -DUSE_I2C2
ap.CFLAGS += -DUSE_I2C2
endif
ap.CFLAGS += -D$(LISA_M_BARO)

Expand All @@ -189,10 +194,14 @@ LIA_BARO ?= BARO_MS5611_SPI
ifeq ($(LIA_BARO), BARO_MS5611_SPI)
include $(CFG_SHARED)/spi_master.makefile
ap.CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
ap.srcs += boards/lisa_m/baro_ms5611_spi.c
ap.srcs += peripherals/ms5611.c
ap.srcs += peripherals/ms5611_spi.c
ap.srcs += subsystems/sensors/baro_ms5611_spi.c
else ifeq ($(LIA_BARO), BARO_MS5611_I2C)
ap.CFLAGS += -DUSE_I2C2
ap.srcs += boards/lisa_m/baro_ms5611_i2c.c
ap.srcs += peripherals/ms5611.c
ap.srcs += peripherals/ms5611_i2c.c
ap.srcs += subsystems/sensors/baro_ms5611_i2c.c
endif
ap.CFLAGS += -D$(LIA_BARO)

Expand All @@ -206,7 +215,10 @@ ap.srcs += $(SRC_BOARD)/baro_board.c

# krooz baro
else ifeq ($(BOARD), krooz)
ap.srcs += $(SRC_BOARD)/baro_board.c
ap.CFLAGS += -DMS5611_I2C_DEV=i2c2 -DMS5611_SLAVE_ADDR=0xEC
ap.srcs += peripherals/ms5611.c
ap.srcs += peripherals/ms5611_i2c.c
ap.srcs += subsystems/sensors/baro_ms5611_i2c.c

# apogee baro
else ifeq ($(BOARD), apogee)
Expand Down
2 changes: 0 additions & 2 deletions conf/firmwares/subsystems/shared/imu_krooz_sd.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ IMU_KROOZ_I2C_DEV=i2c2
IMU_KROOZ_CFLAGS += -DUSE_I2C -DUSE_I2C2 -DI2C2_CLOCK_SPEED=400000

IMU_KROOZ_CFLAGS += -DIMU_KROOZ_I2C_DEV=$(IMU_KROOZ_I2C_DEV)
IMU_KROOZ_CFLAGS += -DMS5611_I2C_DEV=$(IMU_KROOZ_I2C_DEV) -DMS5611_SLAVE_ADDR=0xEC
IMU_KROOZ_SRCS += peripherals/mpu60x0.c
IMU_KROOZ_SRCS += peripherals/mpu60x0_i2c.c
IMU_KROOZ_SRCS += peripherals/hmc58xx.c
IMU_KROOZ_SRCS += modules/sensors/baro_ms5611_i2c.c

AHRS_PROPAGATE_FREQUENCY ?= 512
AHRS_CORRECT_FREQUENCY ?= 512
Expand Down
5 changes: 3 additions & 2 deletions conf/modules/baro_bmp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
<file name="baro_bmp.h"/>
</header>
<init fun="baro_bmp_init()"/>
<periodic fun="baro_bmp_periodic()" freq="8"/>
<periodic fun="baro_bmp_periodic()" freq="15"/>
<event fun="baro_bmp_event()"/>
<makefile>
<makefile target="ap">
<file name="baro_bmp.c"/>
<file name="bmp085.c" dir="peripherals"/>
</makefile>
</module>

7 changes: 4 additions & 3 deletions conf/modules/baro_ms5611_i2c.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
<file name="baro_ms5611_i2c.h"/>
</header>
<init fun="baro_ms5611_init()"/>
<periodic fun="baro_ms5611_periodic()" freq="4" delay="0"/>
<periodic fun="baro_ms5611_d1()" freq="4" delay="1"/>
<periodic fun="baro_ms5611_d2()" freq="4" delay="2"/>
<periodic fun="baro_ms5611_read()" freq="4"/>
<periodic fun="baro_ms5611_periodic_check()" freq="40"/>
<event fun="baro_ms5611_event()"/>
<makefile target="ap">
<file name="baro_ms5611_i2c.c"/>
<file name="ms5611.c" dir="peripherals"/>
<file name="ms5611_i2c.c" dir="peripherals"/>
</makefile>
</module>

25 changes: 25 additions & 0 deletions conf/modules/baro_ms5611_spi.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE module SYSTEM "module.dtd">

<module name="baro_ms5611_spi" dir="sensors">
<doc>
<description>
Baro MS5611 (SPI)
Measurement Specialties MS5611-01BA pressure sensor (SPI)
</description>
<define name="MS5611_SPI_DEV" value="spiX" description="select spi peripheral to use (default spi1)"/>
<define name="MS5611_SLAVE_DEV" value="SPI_SLAVE0" description="SPI slave select index"/>
<define name="SENSOR_SYNC_SEND" description="flag to enable sending BARO_MS5611 message on every new measurement"/>
</doc>
<header>
<file name="baro_ms5611_spi.h"/>
</header>
<init fun="baro_ms5611_init()"/>
<periodic fun="baro_ms5611_read()" freq="4"/>
<periodic fun="baro_ms5611_periodic_check()" freq="40"/>
<event fun="baro_ms5611_event()"/>
<makefile target="ap">
<file name="baro_ms5611_spi.c"/>
<file name="ms5611.c" dir="peripherals"/>
<file name="ms5611_spi.c" dir="peripherals"/>
</makefile>
</module>
30 changes: 0 additions & 30 deletions sw/airborne/boards/krooz/baro_board.c

This file was deleted.

24 changes: 4 additions & 20 deletions sw/airborne/boards/krooz/baro_board.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@

/*
* board specific fonctions for the KroozSD board
* board specific interface for the KroozSD board
*
* It uses the subsystems/sensors/baro_ms5611_i2c.c driver
*/

#ifndef BOARDS_KROOZ_BARO_H
#define BOARDS_KROOZ_BARO_H

#include "std.h"
#include "mcu_periph/i2c.h"
#include "modules/sensors/baro_ms5611_i2c.h"
#include "math/pprz_algebra_int.h"

//#include "led.h"

static inline void baro_event(void (*b_abs_handler)(void), void (*b_diff_handler)(void))
{
baro_ms5611_event();
if(baro_ms5611_valid) {
baro.status = BS_RUNNING;
baro.absolute = (int32_t)baroms;
b_abs_handler();
baro_ms5611_valid = FALSE;
}
}

#define BaroEvent(_b_abs_handler, _b_diff_handler) baro_event(_b_abs_handler,_b_diff_handler)
extern void baro_event(void (*b_abs_handler)(void));
#define BaroEvent(_b_abs_handler, _b_diff_handler) baro_event(_b_abs_handler)

#endif /* BOARDS_KROOZ_SD_BARO_H */
4 changes: 2 additions & 2 deletions sw/airborne/boards/lia/baro_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "std.h"

extern void baro_event(void (*b_abs_handler)(void), void (*b_diff_handler)(void));
extern void baro_event(void (*b_abs_handler)(void));

#define BaroEvent(_b_abs_handler, _b_diff_handler) baro_event(_b_abs_handler,_b_diff_handler)
#define BaroEvent(_b_abs_handler, _b_diff_handler) baro_event(_b_abs_handler)

#endif /* BOARDS_LIA_BARO_H */
Loading

0 comments on commit 11b48b4

Please sign in to comment.