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

Interface from actuators to ChibiOS PWM driver. More...

#include "modules/actuators/actuators_pwm_arch.h"
#include "modules/actuators/actuators_pwm.h"
#include "mcu_periph/gpio.h"
+ Include dependency graph for actuators_pwm_arch.c:

Go to the source code of this file.

Macros

#define PWM_FREQUENCY   1000000
 
#define SERVO_HZ   40
 
#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
 
#define TIM8_SERVO_HZ   SERVO_HZ
 
#define TIM9_SERVO_HZ   SERVO_HZ
 
#define TIM12_SERVO_HZ   SERVO_HZ
 
#define PWM_CMD_TO_US(_t)   (PWM_FREQUENCY * _t / 1000000)
 Print the configuration variables from the header. More...
 

Functions

static void pwmpcb (PWMDriver *pwmp)
 PWM callback function. More...
 
void actuators_pwm_arch_init (void)
 Arch dependent init file. More...
 
void actuators_pwm_commit (void)
 

Variables

int32_t actuators_pwm_values [ACTUATORS_PWM_NB]
 

Detailed Description

Interface from actuators to ChibiOS PWM driver.

PWM configuration files are defined in the board file, so maximal architecture independence is ensured.

Definition in file actuators_pwm_arch.c.

Macro Definition Documentation

◆ PWM_CMD_TO_US

#define PWM_CMD_TO_US (   _t)    (PWM_FREQUENCY * _t / 1000000)

Print the configuration variables from the header.

CMD_TO_US() is depending on architecture and on the hardware settings (clock speed etc.). Hence it has to be defined separately for each board.

It converts the actuator command from paparazzi. which is in pulse width in milliseconds to microseconds (required by pwmEnableChannel())

Definition at line 89 of file actuators_pwm_arch.c.

◆ PWM_FREQUENCY

#define PWM_FREQUENCY   1000000

Definition at line 39 of file actuators_pwm_arch.c.

◆ SERVO_HZ

#define SERVO_HZ   40

Definition at line 44 of file actuators_pwm_arch.c.

◆ TIM12_SERVO_HZ

#define TIM12_SERVO_HZ   SERVO_HZ

Definition at line 70 of file actuators_pwm_arch.c.

◆ TIM1_SERVO_HZ

#define TIM1_SERVO_HZ   SERVO_HZ

Definition at line 49 of file actuators_pwm_arch.c.

◆ TIM2_SERVO_HZ

#define TIM2_SERVO_HZ   SERVO_HZ

Definition at line 52 of file actuators_pwm_arch.c.

◆ TIM3_SERVO_HZ

#define TIM3_SERVO_HZ   SERVO_HZ

Definition at line 55 of file actuators_pwm_arch.c.

◆ TIM4_SERVO_HZ

#define TIM4_SERVO_HZ   SERVO_HZ

Definition at line 58 of file actuators_pwm_arch.c.

◆ TIM5_SERVO_HZ

#define TIM5_SERVO_HZ   SERVO_HZ

Definition at line 61 of file actuators_pwm_arch.c.

◆ TIM8_SERVO_HZ

#define TIM8_SERVO_HZ   SERVO_HZ

Definition at line 64 of file actuators_pwm_arch.c.

◆ TIM9_SERVO_HZ

#define TIM9_SERVO_HZ   SERVO_HZ

Definition at line 67 of file actuators_pwm_arch.c.

Function Documentation

◆ actuators_pwm_arch_init()

◆ actuators_pwm_commit()

◆ pwmpcb()

static void pwmpcb ( PWMDriver *  pwmp)
static

PWM callback function.

Called after each period. All PWM configurations (from board.h) should reference to this callback. Empty for now, can be used later for fail safe monitoring (i.e. reset counter or something).

Parameters
[in]pwmppointer to a PWMDriver object

Definition at line 103 of file actuators_pwm_arch.c.

Variable Documentation

◆ actuators_pwm_values

int32_t actuators_pwm_values[ACTUATORS_PWM_NB]

Definition at line 92 of file actuators_pwm_arch.c.

Referenced by actuators_pwm_commit().