Paparazzi UAS  v5.15_devel-61-g9c6bcf9
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
adc_generic module

Generic ADC

This module can be used to read one or two values from the ADC channels in a generic way. Data is reported through the default telemetry channel (by default) or can be redirected to an other one (alternate telemetry, datalogger) at a frequency defined in the telemetry xml file.

Example for airframe file

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

1 <module name="adc_generic">
2  <define name="ADC_GENERIC_PERIODIC_SEND" value="TRUE|FALSE" />
3  <configure name="ADC_CHANNEL_GENERIC1" value="ADCX" />
4  <configure name="ADC_CHANNEL_GENERIC2" value="ADCX" />
5 </module>

Module configuration options

Configure Options

  • name: ADC_CHANNEL_GENERIC1 value: ADCX
    Description: choose which ADC is used for input 1
  • name: ADC_CHANNEL_GENERIC2 value: ADCX
    Description: choose which ADC is used for input 2

Define Options

  • name: ADC_GENERIC_PERIODIC_SEND value: TRUE|FALSE
    Description: enable or disable periodic report on standard telemetry channel (default: TRUE)

Module functions

Init Functions

These initialization functions are called once on startup.

Periodic Functions

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

  • adc_generic_periodic()
    • Frequency in Hz: 4
    • Autorun: LOCK
      Periodic function automatically starts after init and can't be stopped.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw adc_generic.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="adc_generic" dir="adcs">
<doc>
<description>
Generic ADC
This module can be used to read one or two values from the ADC channels in a generic way.
Data is reported through the default telemetry channel (by default) or can be redirected to an other one (alternate telemetry, datalogger) at a frequency defined in the telemetry xml file.
</description>
<configure name="ADC_CHANNEL_GENERIC1" value="ADCX" description="choose which ADC is used for input 1"/>
<configure name="ADC_CHANNEL_GENERIC2" value="ADCX" description="choose which ADC is used for input 2"/>
<define name="ADC_GENERIC_PERIODIC_SEND" value="TRUE|FALSE" description="enable or disable periodic report on standard telemetry channel (default: TRUE)"/>
</doc>
<header>
<file name="adc_generic.h"/>
</header>
<init fun="adc_generic_init()"/>
<periodic fun="adc_generic_periodic()" freq="4"/>
<makefile target="ap">
<file name="adc_generic.c"/>
<define name="USE_${ADC_CHANNEL_GENERIC1}" cond="ifneq ($(ADC_CHANNEL_GENERIC1),)"/>
<define name="ADC_CHANNEL_GENERIC1" value="$(ADC_CHANNEL_GENERIC1)" cond="ifneq ($(ADC_CHANNEL_GENERIC1),)"/>
<define name="USE_${ADC_CHANNEL_GENERIC2}" cond="ifneq ($(ADC_CHANNEL_GENERIC2),)"/>
<define name="ADC_CHANNEL_GENERIC2" value="$(ADC_CHANNEL_GENERIC2)" cond="ifneq ($(ADC_CHANNEL_GENERIC2),)"/>
</makefile>
</module>