38#include <libopencm3/stm32/rcc.h>
39#include <libopencm3/stm32/gpio.h>
40#include <libopencm3/stm32/timer.h>
41#include <libopencm3/cm3/nvic.h>
48#define ONE_MHZ_CLK 1000000
49#ifdef NVIC_TIM_IRQ_PRIO
50#define PPM_IRQ_PRIO NVIC_TIM_IRQ_PRIO
63#define RCC_TIM_PPM RCC_TIM1
64#define RST_TIM_PPM RST_TIM1
70#define RCC_TIM_PPM RCC_TIM2
71#define RST_TIM_PPM RST_TIM2
77#define RCC_TIM_PPM RCC_TIM3
78#define RST_TIM_PPM RST_TIM3
84#define RCC_TIM_PPM RCC_TIM4
85#define RST_TIM_PPM RST_TIM4
91#define RCC_TIM_PPM RCC_TIM5
92#define RST_TIM_PPM RST_TIM5
98#define RCC_TIM_PPM RCC_TIM8
99#define RST_TIM_PPM RST_TIM8
104#define PPM_TIMER TIM9
105#define RCC_TIM_PPM RCC_TIM9
106#define RST_TIM_PPM RST_TIM9
111#define PPM_TIMER TIM12
112#define RCC_TIM_PPM RCC_TIM12
113#define RST_TIM_PPM RST_TIM12
116#error Unknown PPM input timer configuration.
138#if defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_POSITIVE
140#elif defined PPM_PULSE_TYPE && PPM_PULSE_TYPE == PPM_PULSE_TYPE_NEGATIVE
143#error "Unknown PPM_PULSE_TYPE"
237#elif defined(STM32F4)
259#elif defined(STM32F4)
277#elif USE_PPM_TIM9 && defined(STM32F4)
293#elif USE_PPM_TIM12 && defined(STM32F4)
void gpio_setup_pin_af(ioportid_t port, uint16_t pin, uint8_t af, bool is_output)
Setup a gpio for input or output with alternate function.
static uint32_t timer_rollover_cnt
void ppm_arch_init(void)
Architecture dependant code.
Some architecture independent helper functions for GPIOs.
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
void ppm_decode_frame(uint32_t ppm_time)
Decode a PPM frame from global timer value.
Generic interface for radio control modules.
uint32_t timer_get_frequency(uint32_t timer_peripheral)
Get Timer clock frequency (before prescaling) Only valid if using the internal clock for the timer.
#define RC_PPM_TICKS_PER_USEC
The ppm counter is set-up to have 1/6 us resolution.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.