Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
These initialization functions are called once on startup.
These event functions are called in each cycle of the module event loop.
<!DOCTYPE module SYSTEM "module.dtd">
<module name="radio_control_spektrum" dir="radio_control" task="radio_control">
<doc>
<description>
Radio control based on Spektrum DSM2 or DSMX receivers
Define USE_DSMX on STM32 microcontrollers to bind in DSMX instead of DSM2
</description>
<configure name="RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT" value="uartX" description="UART for primary spektrum receiver"/>
<configure name="RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT" value="uartX" description="UART for optional secondary spektrum receiver"/>
<configure name="USE_SECONDARY_SPEKTRUM_RECEIVER" value="0|1" description="enable secondary receiver (default: disabled)"/>
<define name="USE_DSMX" value="FALSE|TRUE" description="activate DSMX binding mode for compatible receivers (default: FALSE, DSM2 is used)"/>
<define name="SPEKTRUM_SYS_TYPE" value="0" description="force system type (default: 0 for auto detect)"/>
</doc>
<dep>
<depends>uart,radio_control_common</depends>
<provides>radio_control</provides>
</dep>
<header>
<file name="spektrum.h"/>
</header>
<init fun="spektrum_init()"/>
<event fun="spektrum_event()"/>
<makefile target="ap|fbw|test_radio_control">
<define name="RADIO_CONTROL_BIND_IMPL_FUNC" value="spektrum_try_bind"/>
<configure name="SPEKTRUM_PRIMARY_UART" value="$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)" case="upper|lower"/>
<define name="USE_$(SPEKTRUM_PRIMARY_UART_UPPER)"/>
<define name="SPEKTRUM_PRIMARY_UART" value="$(SPEKTRUM_PRIMARY_UART_LOWER)"/>
<define name="SPEKTRUM_PRIMARY_UART_UPPER" value="$(SPEKTRUM_PRIMARY_UART_UPPER)_GPIO"/>
<define name="$(SPEKTRUM_PRIMARY_UART_UPPER)_BAUD" value="B115200"/>
<define name="USE_$(SPEKTRUM_PRIMARY_UART_UPPER)_TX" value="FALSE"/>
<configure name="SPEKTRUM_SECONDARY_UART" value="$(RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT)" case="upper|lower"/>
<configure name="USE_SECONDARY_SPEKTRUM_RECEIVER" default="0"/>
<define name="USE_$(SPEKTRUM_SECONDARY_UART_UPPER)" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<define name="SPEKTRUM_SECONDARY_UART" value="$(SPEKTRUM_SECONDARY_UART_LOWER)" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<define name="SPEKTRUM_SECONDARY_UART_UPPER" value="$(SPEKTRUM_SECONDARY_UART_UPPER)_GPIO" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<define name="$(SPEKTRUM_SECONDARY_UART_UPPER)_BAUD" value="B115200" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<define name="USE_$(SPEKTRUM_SECONDARY_UART_UPPER)_TX" value="FALSE" cond="ifneq ($(USE_SECONDARY_SPEKTRUM_RECEIVER),0)"/>
<file name="spektrum.c"/>
<test>
<define name="RADIO_CONTROL"/>
<define name="SPEKTRUM_PRIMARY_UART" value="uart2"/>
<define name="SPEKTRUM_SECONDARY_UART" value="uart3"/>
<define name="USE_UART2"/>
<define name="USE_UART3"/>
<define name="SPEKTRUM_PRIMARY_BIND_CONF_PORT" value="GPIOA"/>
<define name="SPEKTRUM_PRIMARY_BIND_CONF_PIN" value="GPIO0"/>
<define name="SPEKTRUM_SECONDARY_BIND_CONF_PORT" value="GPIOA"/>
<define name="SPEKTRUM_SECONDARY_BIND_CONF_PIN" value="GPIO1"/>
</test>
</makefile>
<makefile target="sim|nps">
<file_arch name="spektrum_arch.c" dir="modules/radio_control"/>
<test>
<define name="RADIO_CONTROL"/>
</test>
</makefile>
</module>