This module should be replaced by a proper loading of the correct module in each board or airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<!DOCTYPE module SYSTEM "module.dtd">
<module name="baro_board" dir="sensors" task="sensors">
<doc>
<description>
Magic module to load the proper baro for a board (if supported)
This module should be replaced by a proper loading of the correct module
in each board or airframe file
</description>
<configure name="USE_BARO_BOARD" value="FALSE|TRUE" description="enable or not the internal baro driver (default TRUE)"/>
</doc>
<dep>
<depends>baro_board_common</depends>
</dep>
<makefile target="ap">
<raw>
ifeq ($(USE_BARO_BOARD), TRUE)
# Lisa/M baro
ifeq ($(BOARD), lisa_m)
ifeq ($(BOARD_VERSION), 1.0)
# on lisa_m_1.0: defaults to i2c baro bmp085 on the board
LISA_M_BARO ?= BARO_BOARD_BMP085
else ifeq ($(BOARD_VERSION), 2.0)
# on lisa_m_2.0: defaults to MS5611 baro connected via SPI on Aspirin2.2
LISA_M_BARO ?= BARO_MS5611_SPI
else ifeq ($(BOARD_VERSION), 2.1)
# on lisa_m_2.1: defaults to MS5611 baro connected via SPI on the integrated Aspirin2.2
LISA_M_BARO ?= BARO_MS5611_SPI
endif
ifeq ($(LISA_M_BARO), BARO_MS5611_SPI)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_SPI
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi2
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE3
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
else ifeq ($(LISA_M_BARO), BARO_MS5611_I2C)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
else ifeq ($(LISA_M_BARO), BARO_BOARD_BMP085)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_BOARD_BMP085
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_SRCS += peripherals/bmp085.c
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
endif
else ifeq ($(BOARD), lisa_mx)
# defaults to MS5611 via SPI on Aspirin
LISA_MX_BARO ?= BARO_MS5611_SPI
ifeq ($(LISA_MX_BARO), BARO_MS5611_SPI)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_SPI
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi2
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE3
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
else ifeq ($(LISA_MX_BARO), BARO_MS5611_I2C)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
else ifeq ($(LISA_MX_BARO), BARO_BOARD_BMP085)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_BOARD_BMP085
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_SRCS += peripherals/bmp085.c
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
endif
else ifeq ($(BOARD), lisa_mxs)
# defaults to MS5611 via SPI on Aspirin
LISA_MXS_BARO ?= BARO_MS5611_SPI
ifeq ($(LISA_MXS_BARO), BARO_MS5611_SPI)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_SPI
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi2
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE3
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
else ifeq ($(LISA_MXS_BARO), BARO_MS5611_I2C)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
else ifeq ($(LISA_MXS_BARO), BARO_BOARD_BMP085)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_BOARD_BMP085
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_SRCS += peripherals/bmp085.c
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
endif
# Lisa/S baro
else ifeq ($(BOARD), lisa_s)
# defaults to SPI baro MS5611 on the board
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_CFLAGS += -DUSE_SPI1 -DUSE_SPI_SLAVE1
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi1
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE1
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
# ELLE0 baro
else ifeq ($(BOARD), elle0)
# defaults to SPI baro MS5611 on the board
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_CFLAGS += -DUSE_SPI1 -DUSE_SPI_SLAVE1
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi1
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE1
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
# Lia baro (no bmp onboard)
else ifeq ($(BOARD), lia)
# fixme, reuse the baro drivers in lisa_m dir
LIA_BARO ?= BARO_MS5611_SPI
ifeq ($(LIA_BARO), BARO_MS5611_SPI)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_SPI
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi2
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE3
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
else ifeq ($(LIA_BARO), BARO_MS5611_I2C)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
endif
# PX4FMU
else ifeq ($(BOARD),$(filter $(BOARD),px4fmu))
ifeq ($(BOARD_VERSION), 1.7)
# PX4FMU 1.7
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
BARO_BOARD_CFLAGS += -DUSE_SPI1 -DUSE_SPI_SLAVE3
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi1
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE3
else ifeq ($(BOARD_VERSION), 2.4)
# PX4FMU 2.4 a.k.a. PIXHAWK
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
BARO_BOARD_CFLAGS += -DUSE_SPI1 -DUSE_SPI_SLAVE3
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi1
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE3
else ifeq ($(BOARD_VERSION), 4.0)
# PX4FMU 4.0 a.k.a. PX4_PIXRACER
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
BARO_BOARD_CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE3
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi2
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE3
else ifeq ($(BOARD_VERSION), 5.0)
# PX4FMU 5.0
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
BARO_BOARD_CFLAGS += -DUSE_SPI4 -DUSE_SPI_SLAVE4
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi4
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE4
endif
# Naze32
else ifeq ($(BOARD), naze32)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_CFLAGS += -DUSE_I2C2
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c2
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
# OPA (AP)
else ifeq ($(BOARD), opa_ap)
include $(CFG_SHARED)/spi_master.makefile
BARO_BOARD_CFLAGS += -DUSE_SPI2 -DUSE_SPI_SLAVE2
BARO_BOARD_CFLAGS += -DBB_MS5611_SPI_DEV=spi2
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_IDX=SPI_SLAVE2
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_spi.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_spi.c
# OpenPilot Revo
else ifeq ($(BOARD), openpilot_revo)
ifeq ($(BOARD_VERSION), nano)
BARO_BOARD_CFLAGS += -DUSE_I2C3
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c3
#BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_ADDR=0xEC
else
BARO_BOARD_CFLAGS += -DUSE_I2C1
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c1
endif
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
else ifeq ($(BOARD), chimera)
BARO_BOARD_CFLAGS += -DBARO_BOARD=BARO_MS5611_I2C
BARO_BOARD_CFLAGS += -DUSE_I2C1
BARO_BOARD_CFLAGS += -DBB_MS5611_I2C_DEV=i2c1
BARO_BOARD_CFLAGS += -DBB_MS5611_SLAVE_ADDR=MS5611_I2C_SLAVE_ADDR_ALT
BARO_BOARD_SRCS += peripherals/ms5611.c
BARO_BOARD_SRCS += peripherals/ms5611_i2c.c
BARO_BOARD_SRCS += boards/baro_board_ms5611_i2c.c
endif # check board
ap.CFLAGS += $(BARO_BOARD_CFLAGS)
ap.srcs += $(BARO_BOARD_SRCS)
else
ap.CFLAGS += -DUSE_BARO_BOARD=FALSE
endif # check USE_BARO_BOARD
</raw>
</makefile>
</module>