Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
actuators_pwm_arch.c File Reference

STM32 PWM servos handling. More...

#include "subsystems/actuators/actuators_pwm_arch.h"
#include "subsystems/actuators/actuators_pwm.h"
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/timer.h>
+ Include dependency graph for actuators_pwm_arch.c:

Go to the source code of this file.

Macros

#define ONE_MHZ_CLK   1000000
 
#define SERVO_HZ   40
 Default servo update rate in Hz. More...
 
#define TIM1_SERVO_HZ   SERVO_HZ
 
#define TIM2_SERVO_HZ   SERVO_HZ
 
#define TIM3_SERVO_HZ   SERVO_HZ
 
#define TIM4_SERVO_HZ   SERVO_HZ
 
#define TIM5_SERVO_HZ   SERVO_HZ
 

Functions

static void actuators_pwm_arch_channel_init (u32 timer_peripheral, enum tim_oc_id oc_id)
 Set PWM channel configuration. More...
 
static void set_servo_timer (u32 timer, u32 period, u8 channels_mask)
 Set GPIO configuration. More...
 
void actuators_pwm_arch_init (void)
 PWM arch init called by generic pwm driver. More...
 
void actuators_pwm_commit (void)
 Set pulse widths from actuator values, assumed to be in us. More...
 

Variables

int32_t actuators_pwm_values [ACTUATORS_PWM_NB]
 

Detailed Description

STM32 PWM servos handling.

Definition in file actuators_pwm_arch.c.

Macro Definition Documentation

#define ONE_MHZ_CLK   1000000

Definition at line 43 of file actuators_pwm_arch.c.

Referenced by set_servo_timer().

#define SERVO_HZ   40

Default servo update rate in Hz.

Definition at line 46 of file actuators_pwm_arch.c.

#define TIM1_SERVO_HZ   SERVO_HZ

Definition at line 51 of file actuators_pwm_arch.c.

Referenced by actuators_pwm_arch_init().

#define TIM2_SERVO_HZ   SERVO_HZ

Definition at line 54 of file actuators_pwm_arch.c.

Referenced by actuators_pwm_arch_init().

#define TIM3_SERVO_HZ   SERVO_HZ

Definition at line 57 of file actuators_pwm_arch.c.

Referenced by actuators_pwm_arch_init().

#define TIM4_SERVO_HZ   SERVO_HZ

Definition at line 60 of file actuators_pwm_arch.c.

Referenced by actuators_pwm_arch_init().

#define TIM5_SERVO_HZ   SERVO_HZ

Definition at line 63 of file actuators_pwm_arch.c.

Referenced by actuators_pwm_arch_init().

Function Documentation

static void actuators_pwm_arch_channel_init ( u32  timer_peripheral,
enum tim_oc_id  oc_id 
)
inlinestatic

Set PWM channel configuration.

Definition at line 68 of file actuators_pwm_arch.c.

Referenced by set_servo_timer().

+ Here is the caller graph for this function:

void actuators_pwm_arch_init ( void  )

PWM arch init called by generic pwm driver.

Arch dependent init file.

Definition at line 155 of file actuators_pwm_arch.c.

References PWM_SERVO_0_AF, PWM_SERVO_0_GPIO, PWM_SERVO_0_PIN, PWM_SERVO_0_RCC_IOP, PWM_SERVO_1_AF, PWM_SERVO_1_ENA, PWM_SERVO_1_GPIO, PWM_SERVO_1_PIN, PWM_SERVO_1_PINSEL, PWM_SERVO_1_PINSEL_BIT, PWM_SERVO_1_PINSEL_MASK, PWM_SERVO_1_PINSEL_VAL, PWM_SERVO_1_RCC_IOP, PWM_SERVO_2_AF, PWM_SERVO_2_ENA, PWM_SERVO_2_GPIO, PWM_SERVO_2_PIN, PWM_SERVO_2_PINSEL, PWM_SERVO_2_PINSEL_BIT, PWM_SERVO_2_PINSEL_MASK, PWM_SERVO_2_PINSEL_VAL, PWM_SERVO_2_RCC_IOP, PWM_SERVO_3_AF, PWM_SERVO_3_ENA, PWM_SERVO_3_GPIO, PWM_SERVO_3_PIN, PWM_SERVO_3_PINSEL, PWM_SERVO_3_PINSEL_BIT, PWM_SERVO_3_PINSEL_MASK, PWM_SERVO_3_PINSEL_VAL, PWM_SERVO_3_RCC_IOP, PWM_SERVO_4_AF, PWM_SERVO_4_ENA, PWM_SERVO_4_GPIO, PWM_SERVO_4_PIN, PWM_SERVO_4_PINSEL, PWM_SERVO_4_PINSEL_BIT, PWM_SERVO_4_PINSEL_MASK, PWM_SERVO_4_PINSEL_VAL, PWM_SERVO_4_RCC_IOP, PWM_SERVO_5_AF, PWM_SERVO_5_ENA, PWM_SERVO_5_GPIO, PWM_SERVO_5_PIN, PWM_SERVO_5_PINSEL, PWM_SERVO_5_PINSEL_BIT, PWM_SERVO_5_PINSEL_MASK, PWM_SERVO_5_PINSEL_VAL, PWM_SERVO_5_RCC_IOP, PWM_SERVO_6_AF, PWM_SERVO_6_GPIO, PWM_SERVO_6_PIN, PWM_SERVO_6_RCC_IOP, PWM_SERVO_7_AF, PWM_SERVO_7_GPIO, PWM_SERVO_7_PIN, PWM_SERVO_7_RCC_IOP, PWM_SERVO_8_AF, PWM_SERVO_8_GPIO, PWM_SERVO_8_PIN, PWM_SERVO_8_RCC_IOP, PWM_TIM2_CHAN_MASK, PWM_TIM3_CHAN_MASK, PWM_TIM4_CHAN_MASK, PWM_TIM5_CHAN_MASK, PWMLER, PWMLER_LATCH0, PWMMR0, PWMPCR, PWMPR, PWMTCR, PWMTCR_COUNTER_ENABLE, PWMTCR_PWM_ENABLE, SERVOS_PERIOD, set_servo_timer(), TIM1_SERVO_HZ, TIM2_SERVO_HZ, TIM3_SERVO_HZ, TIM4_SERVO_HZ, and TIM5_SERVO_HZ.

+ Here is the call graph for this function:

static void set_servo_timer ( u32  timer,
u32  period,
u8  channels_mask 
)
inlinestatic

Set GPIO configuration.

Set Timer configuration

Definition at line 98 of file actuators_pwm_arch.c.

References actuators_pwm_arch_channel_init(), ONE_MHZ_CLK, and PCLK.

Referenced by actuators_pwm_arch_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation