Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
actuators_dualpwm_arch.c File Reference

STM32 dual PWM servos handling. More...

#include "modules/actuators/actuators_shared_arch.h"
#include "modules/actuators/actuators_dualpwm_arch.h"
#include "modules/actuators/actuators_dualpwm.h"
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/timer.h>
#include <libopencm3/cm3/nvic.h>
#include "mcu_periph/gpio_arch.h"
+ Include dependency graph for actuators_dualpwm_arch.c:

Go to the source code of this file.

Functions

void actuators_dualpwm_arch_init (void)
 PWM arch init called by generic pwm driver. More...
 
void clear_timer_flag (void)
 Interuption called at the end of the timer. More...
 
void set_dual_pwm_timer_s_period (uint32_t period)
 
void set_dual_pwm_timer_s_oc (uint32_t oc_value, uint32_t oc_value2)
 
void dual_pwm_isr (void)
 
void actuators_dualpwm_commit (void)
 Set pulse widths from actuator values, assumed to be in us. More...
 

Variables

uint32_t ratio_4ms
 
uint32_t ratio_16ms
 
uint32_t actuators_dualpwm_values [ACTUATORS_DUALPWM_NB]
 

Detailed Description

STM32 dual PWM servos handling.

Definition in file actuators_dualpwm_arch.c.

Function Documentation

◆ actuators_dualpwm_arch_init()

void actuators_dualpwm_arch_init ( void  )

PWM arch init called by generic pwm driver.

Arch dependent init file.

Definition at line 46 of file actuators_dualpwm_arch.c.

References gpio_setup_pin_af(), ONE_MHZ_CLK, PWM_TIM5_CHAN_MASK, ratio_16ms, ratio_4ms, set_servo_timer(), TIM5_SERVO_HZ, and TRUE.

+ Here is the call graph for this function:

◆ actuators_dualpwm_commit()

void actuators_dualpwm_commit ( void  )

Set pulse widths from actuator values, assumed to be in us.

Definition at line 173 of file actuators_dualpwm_arch.c.

◆ clear_timer_flag()

void clear_timer_flag ( void  )

Interuption called at the end of the timer.

In our case alternatively very 4ms and 16ms (twice every 20ms) Fonction that clears the flag of interuption in order to reactivate the interuption

Definition at line 118 of file actuators_dualpwm_arch.c.

Referenced by dual_pwm_isr().

+ Here is the caller graph for this function:

◆ dual_pwm_isr()

void dual_pwm_isr ( void  )

Definition at line 148 of file actuators_dualpwm_arch.c.

References actuators_dualpwm_values, clear_timer_flag(), ratio_16ms, ratio_4ms, set_dual_pwm_timer_s_oc(), and set_dual_pwm_timer_s_period().

+ Here is the call graph for this function:

◆ set_dual_pwm_timer_s_oc()

void set_dual_pwm_timer_s_oc ( uint32_t  oc_value,
uint32_t  oc_value2 
)

Definition at line 136 of file actuators_dualpwm_arch.c.

Referenced by dual_pwm_isr().

+ Here is the caller graph for this function:

◆ set_dual_pwm_timer_s_period()

void set_dual_pwm_timer_s_period ( uint32_t  period)

Definition at line 127 of file actuators_dualpwm_arch.c.

Referenced by dual_pwm_isr().

+ Here is the caller graph for this function:

Variable Documentation

◆ actuators_dualpwm_values

uint32_t actuators_dualpwm_values[ACTUATORS_DUALPWM_NB]

Definition at line 42 of file actuators_dualpwm_arch.c.

Referenced by dual_pwm_isr().

◆ ratio_16ms

uint32_t ratio_16ms

Definition at line 39 of file actuators_dualpwm_arch.c.

Referenced by actuators_dualpwm_arch_init(), and dual_pwm_isr().

◆ ratio_4ms

uint32_t ratio_4ms

Definition at line 39 of file actuators_dualpwm_arch.c.

Referenced by actuators_dualpwm_arch_init(), and dual_pwm_isr().