Driver for the TeraRanger One range finder (I2C)
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="teraranger_one">
b'<define name="TERARANGER_ONE_I2C_ADDR" value="0x60" />\n '
b'<define name="TERARANGER_ONE_OFFSET" value="0.0" unit="m" />\n '
b'<define name="USE_TERARANGER_ONE_AGL" value="TRUE|FALSE" />\n '
b'<configure name="TERARANGER_ONE_I2C_DEV" value="i2cX" />\n '
</module>
Module configuration options
Configure Options
- name:
TERARANGER_ONE_I2C_DEV
value: i2cX
Description: Select I2C bus (i2c2 by default)
Define Options
- name:
TERARANGER_ONE_I2C_ADDR
value: 0x60
Description: Select an alternate I2C address (0x60 by default)
- name:
TERARANGER_ONE_OFFSET
value: 0.0
Description: Add an offset to the measurments (0. by default)
- name:
USE_TERARANGER_ONE_AGL
value: TRUE|FALSE
Description: Send data as AGL measurments to the system (TRUE by default)
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.
- teraranger_periodic()
- Frequency in Hz: 50
- Autorun: LOCK
Periodic function automatically starts after init and can't be stopped.
- teraranger_downlink()
- Frequency in Hz: 10
- Autorun: FALSE
Periodic function is started by user command.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw teraranger_one.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="teraranger_one" dir="range_finder">
<doc>
<description>Driver for the TeraRanger One range finder (I2C)</description>
<configure name="TERARANGER_ONE_I2C_DEV" value="i2cX" description="Select I2C bus (i2c2 by default)"/>
<define name="TERARANGER_ONE_I2C_ADDR" value="0x60" description="Select an alternate I2C address (0x60 by default)"/>
<define name="TERARANGER_ONE_OFFSET" value="0.0" description="Add an offset to the measurments (0. by default)" unit="m"/>
<define name="USE_TERARANGER_ONE_AGL" value="TRUE|FALSE" description="Send data as AGL measurments to the system (TRUE by default)"/>
</doc>
<header>
<file name="teraranger_one.h"/>
</header>
<init fun="teraranger_init()"/>
<periodic fun="teraranger_periodic()" freq="50"/>
<periodic fun="teraranger_downlink()" freq="10" autorun="FALSE"/>
<event fun="teraranger_event()"/>
<makefile>
<configure name="TERARANGER_ONE_I2C_DEV" default="i2c2" case="upper|lower"/>
<file name="teraranger_one.c"/>
<define name="TERARANGER_ONE_I2C_DEV" value="$(TERARANGER_ONE_I2C_DEV_LOWER)"/>
<define name="USE_$(TERARANGER_ONE_I2C_DEV_UPPER)"/>
</makefile>
</module>