mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
Fixed configuration of PPM intput on main port.
This commit is contained in:
parent
10de32d6f6
commit
b2da960644
@ -260,17 +260,12 @@ void PIOS_InitPPMMainPort(bool input)
|
|||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
uint32_t pios_ppm_id;
|
uint32_t pios_ppm_id;
|
||||||
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg);
|
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_main_cfg);
|
||||||
|
|
||||||
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id))
|
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id))
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
}
|
}
|
||||||
#if defined(PIOS_INCLUDE_PPM_OUT)
|
// For some reason, PPM output on the main port doesn't work.
|
||||||
else
|
|
||||||
{
|
|
||||||
PIOS_PPM_Out_Init(&pios_ppm_out_id, &pios_ppm_out_cfg);
|
|
||||||
}
|
|
||||||
#endif /* PIOS_INCLUDE_PPM_OUT */
|
|
||||||
#endif /* PIOS_INCLUDE_PPM */
|
#endif /* PIOS_INCLUDE_PPM */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +276,7 @@ void PIOS_InitPPMFlexiPort(bool input)
|
|||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
uint32_t pios_ppm_id;
|
uint32_t pios_ppm_id;
|
||||||
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_cfg);
|
PIOS_PPM_Init(&pios_ppm_id, &pios_ppm_flexi_cfg);
|
||||||
|
|
||||||
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id))
|
if (PIOS_RCVR_Init(&pios_ppm_rcvr_id, &pios_ppm_rcvr_driver, pios_ppm_id))
|
||||||
PIOS_Assert(0);
|
PIOS_Assert(0);
|
||||||
|
@ -410,6 +410,19 @@ static const struct pios_tim_channel pios_tim_ppm_flexi_port = {
|
|||||||
.remap = GPIO_PartialRemap2_TIM2,
|
.remap = GPIO_PartialRemap2_TIM2,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct pios_tim_channel pios_tim_ppm_main_port = {
|
||||||
|
.timer = TIM1,
|
||||||
|
.timer_chan = TIM_Channel_2,
|
||||||
|
.pin = {
|
||||||
|
.gpio = GPIOA,
|
||||||
|
.init = {
|
||||||
|
.GPIO_Pin = GPIO_Pin_9,
|
||||||
|
.GPIO_Mode = GPIO_Mode_IPD,
|
||||||
|
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* PIOS_INCLUDE_TIM */
|
#endif /* PIOS_INCLUDE_TIM */
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_USART)
|
#if defined(PIOS_INCLUDE_USART)
|
||||||
@ -541,7 +554,7 @@ void PIOS_RTC_IRQ_Handler (void)
|
|||||||
#if defined(PIOS_INCLUDE_PPM)
|
#if defined(PIOS_INCLUDE_PPM)
|
||||||
#include <pios_ppm_priv.h>
|
#include <pios_ppm_priv.h>
|
||||||
|
|
||||||
const struct pios_ppm_cfg pios_ppm_cfg = {
|
const struct pios_ppm_cfg pios_ppm_flexi_cfg = {
|
||||||
.tim_ic_init = {
|
.tim_ic_init = {
|
||||||
.TIM_ICPolarity = TIM_ICPolarity_Rising,
|
.TIM_ICPolarity = TIM_ICPolarity_Rising,
|
||||||
.TIM_ICSelection = TIM_ICSelection_DirectTI,
|
.TIM_ICSelection = TIM_ICSelection_DirectTI,
|
||||||
@ -552,6 +565,17 @@ const struct pios_ppm_cfg pios_ppm_cfg = {
|
|||||||
.num_channels = 1,
|
.num_channels = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct pios_ppm_cfg pios_ppm_main_cfg = {
|
||||||
|
.tim_ic_init = {
|
||||||
|
.TIM_ICPolarity = TIM_ICPolarity_Rising,
|
||||||
|
.TIM_ICSelection = TIM_ICSelection_DirectTI,
|
||||||
|
.TIM_ICPrescaler = TIM_ICPSC_DIV1,
|
||||||
|
.TIM_ICFilter = 0x0,
|
||||||
|
},
|
||||||
|
.channels = &pios_tim_ppm_main_port,
|
||||||
|
.num_channels = 1,
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* PIOS_INCLUDE_PPM */
|
#endif /* PIOS_INCLUDE_PPM */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user