Skip to content

Commit

Permalink
[modules] convert intermcu subsystems to modules (#1982)
Browse files Browse the repository at this point in the history
* [modules] convert intermcu subsystems to modules

* [doc] improve doc on intermcu modules
  • Loading branch information
gautierhattenberger authored and flixr committed Jan 13, 2017
1 parent fc34353 commit ef408d5
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 109 deletions.
17 changes: 0 additions & 17 deletions conf/firmwares/subsystems/fixedwing/intermcu_can.makefile

This file was deleted.

22 changes: 0 additions & 22 deletions conf/firmwares/subsystems/fixedwing/intermcu_spi.makefile

This file was deleted.

31 changes: 0 additions & 31 deletions conf/firmwares/subsystems/fixedwing/intermcu_uart.makefile

This file was deleted.

39 changes: 0 additions & 39 deletions conf/firmwares/subsystems/rotorcraft/intermcu_uart.makefile

This file was deleted.

28 changes: 28 additions & 0 deletions conf/modules/intermcu_can.xml
@@ -0,0 +1,28 @@
<!DOCTYPE module SYSTEM "module.dtd">

<module name="intermcu_can" dir="intermcu">
<doc>
<description>
Inter-MCU communication over CAN

To enable this, please set the "SEPARATE_FBW" configure option to TRUE
in your airframe file for both AP and FBW targets
</description>
<configure name="SEPARATE_FBW" value="FALSE|TRUE" description="Enable separation between AP and FBW on separated MCU"/>
</doc>

<makefile target="ap|fbw" firmware="fixedwing">
<raw>
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
$(error Using intermcu via CAN, so dual mcu with separate fbw. Please set option "SEPARATE_FBW" to TRUE.
endif
</raw>
<define name="INTER_MCU"/>
<define name="MCU_CAN_LINK"/>
<file name="link_mcu_can.c" dir="firmwares/fixedwing"/>
<file name="can.c" dir="mcu_periph"/>
<file name="can_arch.c" dir="$(SRC_ARCH)/mcu_periph"/>
</makefile>

</module>

42 changes: 42 additions & 0 deletions conf/modules/intermcu_spi.xml
@@ -0,0 +1,42 @@
<!DOCTYPE module SYSTEM "module.dtd">

<module name="intermcu_spi" dir="intermcu">
<doc>
<description>
Inter-MCU communication over SPI

To enable this, please set the "SEPARATE_FBW" configure option to TRUE
in your airframe file for both AP and FBW targets
</description>
<configure name="SEPARATE_FBW" value="FALSE|TRUE" description="Enable separation between AP and FBW on separated MCU"/>
<configure name="INTER_MCU_SPI" value="SPI1" description="SPI used for inter mcu communication"/>
<configure name="INTER_MCU_SLAVE" value="SLAVE0" description="Slave name"/>
</doc>

<makefile target="ap|fbw" firmware="fixedwing">
<raw>
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
$(error Using intermcu via SPI, so dual mcu with separate fbw. Please set option "SEPARATE_FBW" to TRUE.
endif
</raw>
<configure name="INTER_MCU_SPI" default="SPI1"/>
<configure name="INTER_MCU_SLAVE" default="SLAVE0"/>
<define name="MCU_SPI_LINK"/>
<define name="USE_SPI"/>
<file name="link_mcu_spi.c" dir="firmwares/fixedwing"/>
<file name="spi.c" dir="mcu_periph"/>
<file name="spi_arch.c" dir="$(SRC_ARCH)/mcu_periph"/>
</makefile>
<makefile target="ap" firmware="fixedwing">
<define name="USE_$(INTER_MCU_SPI)"/>
<define name="USE_SPI_$(INTER_MCU_SLAVE)"/>
<define name="SPI_MASTER"/>
<file name="fbw_downlink.c" dir="firmwares/fixedwing"/>
</makefile>
<makefile target="fbw" firmware="fixedwing">
<define name="USE_$(INTER_MCU_SPI)_SLAVE"/>
<define name="SPI_SLAVE"/>
</makefile>

</module>

69 changes: 69 additions & 0 deletions conf/modules/intermcu_uart.xml
@@ -0,0 +1,69 @@
<!DOCTYPE module SYSTEM "module.dtd">

<module name="intermcu_uart" dir="intermcu">
<doc>
<description>
Inter-MCU communication over UART

To enable this, please set the "SEPARATE_FBW" configure option to TRUE
in your airframe file for both AP and FBW targets
</description>
<configure name="SEPARATE_FBW" value="FALSE|TRUE" description="Enable separation between AP and FBW on separated MCU"/>
<configure name="INTERMCU_PORT" value="UARTx" description="UART used for inter mcu communication (default: UART2 for FBW, UART5 for AP)"/>
<configure name="INTERMCU_BAUD" value="B57600" description="UART baud rate"/>
<configure name="FBW_MODE_LED" value="none|num" description="LED number or 'none'"/>
</doc>

<makefile target="fbw" firmware="fixedwing">
<configure name="INTERMCU_PORT" default="UART2" case="upper|lower"/>
<configure name="FBW_MODE_LED" default="none"/>
<define name="FBW_MODE_LED" value="$(FBW_MODE_LED)" cond="ifneq ($(FBW_MODE_LED),none)"/>
</makefile>
<makefile target="ap" firmware="fixedwing">
<configure name="INTERMCU_PORT" default="UART5" case="upper|lower"/>
</makefile>
<makefile target="ap|fbw" firmware="fixedwing">
<raw>
ifeq (,$(findstring $(SEPARATE_FBW),1 TRUE))
$(error Using intermcu via UART, so dual mcu with separate fbw. Please set option "SEPARATE_FBW" to TRUE.
endif
</raw>
<configure name="INTERMCU_BAUD" default="B57600"/>
<define name="INTERMCU"/>
<define name="MCU_UART_LINK"/>
<define name="INTERMCU_LINK" value="$(INTERMCU_PORT_LOWER)"/>
<define name="USE_$(INTERMCU_PORT_UPPER)"/>
<define name="$(INTERMCU_PORT_UPPER)_BAUD" value="$(INTERMCU_BAUD)"/>
<file name="link_mcu_usart.c" dir="."/>
</makefile>

<makefile target="fbw" firmware="rotorcraft">
<configure name="INTERMCU_PORT" default="UART3" case="upper|lower"/>
<configure name="FBW_MODE_LED" default="none"/>
<define name="FBW_MODE_LED" value="$(FBW_MODE_LED)" cond="ifneq ($(FBW_MODE_LED),none)"/>
<define name="INTER_MCU_FBW"/>
<define name="DOWNLINK"/>
<file name="intermcu_fbw.c" dir="subsystems/intermcu"/>
</makefile>
<makefile target="ap" firmware="rotorcraft">
<configure name="INTERMCU_PORT" default="UART3" case="upper|lower"/>
<configure name="RADIO_CONTROL_LED" value="none"/>
<define name="INTER_MCU_AP"/>
<define name="RADIO_CONTROL_TYPE_H" value="subsystems/intermcu/intermcu_ap.h" type="string"/>
<define name="RADIO_CONTROL"/>
<define name="RADIO_CONTROL_LED" value="$(RADIO_CONTROL_LED)" cond="ifneq ($(RADIO_CONTROL_LED),none)"/>
<define name="GPS_SECONDARY_TYPE_H" value="subsystems/intermcu/intermcu_ap.h" type="string" cond="ifneq (,$(findstring $(SECONDARY_GPS), imcu))"/>
<define name="GPS_SECONDARY_GPS" value="GPS_IMU" cond="ifneq (,$(findstring $(SECONDARY_GPS), imcu))"/>
<define name="IMCU_GPS" cond="ifneq (,$(findstring $(SECONDARY_GPS), imcu))"/>
<file name="intermcu_ap.c" dir="subsystems/intermcu"/>
<file name="radio_control.c" dir="subsystems"/>
</makefile>
<makefile target="ap|fbw" firmware="rotorcraft">
<configure name="INTERMCU_BAUD" default="B230400"/>
<define name="INTERMCU_LINK" value="$(INTERMCU_PORT_LOWER)"/>
<define name="USE_$(INTERMCU_PORT_UPPER)"/>
<define name="$(INTERMCU_PORT_UPPER)_BAUD" value="$(INTERMCU_BAUD)"/>
<file name="pprz_transport.c" dir="pprzlink/src"/>
</makefile>
</module>

0 comments on commit ef408d5

Please sign in to comment.