Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
actuators_shared_arch.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 The Paparazzi Team
3  *
4  * This file is part of Paparazzi.
5  *
6  * Paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
26 #ifndef ACTUATORS_PWM_SHARED_ARCH_H
27 #define ACTUATORS_PWM_SHARED_ARCH_H
28 
29 #include "std.h"
30 
31 #include BOARD_CONFIG
32 
33 #include <libopencm3/stm32/gpio.h>
34 #include <libopencm3/stm32/rcc.h>
35 #include <libopencm3/stm32/timer.h>
36 #include <libopencm3/cm3/nvic.h>
37 #include "mcu_arch.h"
38 
39 #define ONE_MHZ_CLK 1000000
40 
41 /* Default timer base frequency is 1MHz */
42 #if ! defined(PWM_BASE_FREQ)
43 #define PWM_BASE_FREQ ONE_MHZ_CLK
44 #endif
45 
46 
48 #ifndef SERVO_HZ
49 #define SERVO_HZ 40
50 #endif
51 
52 // Update rate can be adapted for each timer
53 #ifndef TIM1_SERVO_HZ
54 #define TIM1_SERVO_HZ SERVO_HZ
55 #endif
56 #ifndef TIM2_SERVO_HZ
57 #define TIM2_SERVO_HZ SERVO_HZ
58 #endif
59 #ifndef TIM3_SERVO_HZ
60 #define TIM3_SERVO_HZ SERVO_HZ
61 #endif
62 #ifndef TIM4_SERVO_HZ
63 #define TIM4_SERVO_HZ SERVO_HZ
64 #endif
65 #ifndef TIM5_SERVO_HZ
66 #define TIM5_SERVO_HZ SERVO_HZ
67 #endif
68 #ifndef TIM8_SERVO_HZ
69 #define TIM8_SERVO_HZ SERVO_HZ
70 #endif
71 #ifndef TIM9_SERVO_HZ
72 #define TIM9_SERVO_HZ SERVO_HZ
73 #endif
74 #ifndef TIM12_SERVO_HZ
75 #define TIM12_SERVO_HZ SERVO_HZ
76 #endif
77 
78 extern void actuators_pwm_arch_channel_init(uint32_t timer_peripheral, enum tim_oc_id oc_id);
79 extern void set_servo_timer(uint32_t timer, uint32_t period, uint8_t channels_mask);
80 
81 #endif /* ACTUATORS_PWM_SHARED_ARCH_H */
void actuators_pwm_arch_channel_init(uint32_t timer_peripheral, enum tim_oc_id oc_id)
Set PWM channel configuration.
void set_servo_timer(uint32_t timer, uint32_t period, uint8_t channels_mask)
Set Timer configuration.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98