Generic com.
Can be used for Satcom/GSM
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="generic_com">
b'<define name="GENERIC_COM_SLAVE_ADDR" value="i2c address" />\n '
b'<configure name="GENERIC_COM_I2C_DEV" value="i2cX" />\n '
</module>
Module configuration options
Configure Options
- name:
GENERIC_COM_I2C_DEV
value: i2cX
Description: select i2c peripheral to use (default i2c0)
Define Options
- name:
GENERIC_COM_SLAVE_ADDR
value: i2c address
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.
- generic_com_periodic()
- Period in seconds: 180
- Autorun: TRUE
Periodic function automatically starts after init.
- Start function: start_com()
Executed before the periodic function starts.
- Stop function: stop_com()
Executed after the periodic function stops.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw generic_com.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="generic_com" dir="com">
<doc>
<description>
Generic com.
Can be used for Satcom/GSM
</description>
<configure name="GENERIC_COM_I2C_DEV" value="i2cX" description="select i2c peripheral to use (default i2c0)"/>
<define name="GENERIC_COM_SLAVE_ADDR" value="i2c address"/>
</doc>
<header>
<file name="generic_com.h"/>
</header>
<init fun="generic_com_init()"/>
<periodic fun="generic_com_periodic()" period="180" start="start_com()" stop="stop_com()" autorun="TRUE"/>
<event fun="generic_com_event()"/>
<makefile>
<configure name="GENERIC_COM_I2C_DEV" default="i2c0" case="upper|lower"/>
<define name="USE_$(GENERIC_COM_I2C_DEV_UPPER)"/>
<define name="GENERIC_COM_I2C_DEV" value="$(GENERIC_COM_I2C_DEV_LOWER)"/>
<file name="generic_com.c"/>
</makefile>
</module>