Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
PWM measurement

Module XML file: pwm_meas.xml

PWM input measurement mcu periph access and init wrapper for other modules.

  For LPC21xx on the TWOG:
  - INPUT CAPTURE CAP0.3 on P0.29 (TWOG ADC5, 5V to 3.3V voltage divider)
  - INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)

  For STM32:
  - each board (or airframe file) has to define the PWM input pin and parameters
  - example can be found in sw/airborne/boards/apogee_1.0.h board file

Example for airframe file

This example contains all possible configuration options, not all of them are mandatory!

1 <modules>
2  <load name="pwm_meas.xml">
3  <define name="USE_PWM_INPUT1" value="PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH" />
4  <define name="USE_PWM_INPUT2" value="PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH" />
5  </load>
6 </modules>

Module configuration options

Define Options

  • name: USE_PWM_INPUT1 value: PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH
    Description: Activate PWM input 1 and select polarity
  • name: USE_PWM_INPUT2 value: PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH
    Description: Activate PWM input 2 and select polarity

Module functions

Init Functions

These initialization functions are called once on startup.

Files

Header Files

The following headers are automatically included in modules.h

Source Files

Raw pwm_meas.xml file:

<!DOCTYPE module SYSTEM "module.dtd">
<module name="pwm_meas" dir="core">
<doc>
<description>
PWM measurement.
PWM input measurement mcu periph access and init wrapper for other modules.
For LPC21xx on the TWOG:
- INPUT CAPTURE CAP0.3 on P0.29 (TWOG ADC5, 5V to 3.3V voltage divider)
- INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)
For STM32:
- each board (or airframe file) has to define the PWM input pin and parameters
- example can be found in sw/airborne/boards/apogee_1.0.h board file
</description>
<define name="USE_PWM_INPUT1" value="PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH" description="Activate PWM input 1 and select polarity"/>
<define name="USE_PWM_INPUT2" value="PWM_PULSE_TYPE_ACTIVE_LOW|PWM_PULSE_TYPE_ACTIVE_HIGH" description="Activate PWM input 2 and select polarity"/>
</doc>
<header>
<file name="pwm_meas.h"/>
</header>
<init fun="pwm_meas_init()"/>
<makefile target="ap">
<file name="pwm_meas.c"/>
<file name="pwm_input.c" dir="mcu_periph"/>
<file_arch name="pwm_input_arch.c" dir="mcu_periph"/>
<define name="USE_PWM_INPUT"/> <!-- needed to enable the pwm_input interrupts in mcu_periph/sys_time_arch.c -->
</makefile>
</module>