Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
intermcu_uart module

Inter-MCU communication over UART

No detailed description...

Example for airframe file

Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!

<module name="intermcu_uart">
b'<configure name="INTERMCU_PORT" value="UARTx" />\n '
b'<configure name="INTERMCU_BAUD" value="B57600" />\n '
b'<configure name="FBW_MODE_LED" value="none|num" />\n '
</module>

Module configuration options

Configure Options

  • name: INTERMCU_PORT value: UARTx
    Description: UART used for inter mcu communication (default: UART2 for FBW, UART5 for AP)
  • name: INTERMCU_BAUD value: B57600
    Description: UART baud rate
  • name: FBW_MODE_LED value: none|num
    Description: LED number or 'none'

Module functions

Init Functions

These initialization functions are called once on startup.

Event Functions

These event functions are called in each cycle of the module event loop.

Periodic Functions

These functions are called periodically at the specified frequency from the module periodic loop.

  • intermcu_periodic()
    • Running at maximum module frequency.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.
  • intermcu_send_status()
    • Frequency in Hz: 10.
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Datalink Functions

Whenever the specified datalink message is received, the corresponing handler function is called.

  • on message IMCU_FBW_STATUS call intermcu_parse_IMCU_FBW_STATUS(buf)
  • on message IMCU_COMMANDS call intermcu_parse_IMCU_COMMANDS(buf)
  • on message IMCU_SPEKTRUM_SOFT_BIND call intermcu_parse_IMCU_SPEKTRUM_SOFT_BIND(buf)
  • on message * call intermcu_forward_uplink(buf)

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw intermcu_uart.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="intermcu_uart" dir="intermcu" task="core">
<doc>
<description>
Inter-MCU communication over UART
</description>
<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>
<dep>
<depends>uart,radio_control_intermcu,datalink_common</depends>
<provides>intermcu,commands</provides>
</dep>
<header>
<file name="intermcu.h"/>
<file name="intermcu_ap.h" cond="INTERMCU_AP"/>
<file name="intermcu_fbw.h" cond="INTERMCU_FBW"/>
</header>
<init fun="intermcu_init()"/>
<periodic fun="intermcu_periodic()"/>
<periodic fun="intermcu_send_status()" freq="10." cond="INTERMCU_FBW"/>
<event fun="intermcu_event()"/>
<datalink message="IMCU_FBW_STATUS" fun="intermcu_parse_IMCU_FBW_STATUS(buf)" class="intermcu" cond="INTERMCU_AP"/>
<datalink message="IMCU_COMMANDS" fun="intermcu_parse_IMCU_COMMANDS(buf)" class="intermcu" cond="INTERMCU_FBW"/>
<datalink message="IMCU_SPEKTRUM_SOFT_BIND" fun="intermcu_parse_IMCU_SPEKTRUM_SOFT_BIND(buf)" class="intermcu" cond="INTERMCU_FBW"/>
<datalink message="*" fun="intermcu_forward_uplink(buf)" cond="INTERMCU_FBW"/>
<makefile target="ap|fbw">
<configure name="INTERMCU_PORT" default="UART3" case="upper|lower"/>
<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)"/>
<define name="DOWNLINK_DEVICE" value="$(INTERMCU_LINK)" cond="ifndef MODEM_PORT"/>
<define name="DOWNLINK_TRANSPORT" value="intermcu.transport" cond="ifndef MODEM_PORT"/>
<file name="pprz_transport.c" dir="pprzlink/src"/>
</makefile>
<makefile target="fbw">
<configure name="FBW_MODE_LED" default="none"/>
<define name="FBW_MODE_LED" value="$(FBW_MODE_LED)" cond="ifneq ($(FBW_MODE_LED),none)"/>
<define name="INTERMCU_FBW"/>
<file name="intermcu_fbw.c"/>
<test firmware="fixedwing">
<define name="INTERMCU_LINK" value="uart1"/>
<define name="USE_UART1"/>
</test>
</makefile>
<makefile target="ap">
<define name="INTERMCU_AP"/>
<file name="intermcu_ap.c"/>
<test firmware="fixedwing">
<define name="INTERMCU_LINK" value="uart1"/>
<define name="USE_UART1"/>
</test>
</makefile>
</module>