1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

Fixed configuration of PPM intput on main port.

This commit is contained in:
Brian Webb 2013-03-15 02:23:33 +01:00
parent 10de32d6f6
commit b2da960644
2 changed files with 28 additions and 9 deletions

View File

@ -260,17 +260,12 @@ void PIOS_InitPPMMainPort(bool input)
if (input)
{
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))
PIOS_Assert(0);
}
#if defined(PIOS_INCLUDE_PPM_OUT)
else
{
PIOS_PPM_Out_Init(&pios_ppm_out_id, &pios_ppm_out_cfg);
}
#endif /* PIOS_INCLUDE_PPM_OUT */
// For some reason, PPM output on the main port doesn't work.
#endif /* PIOS_INCLUDE_PPM */
}
@ -281,7 +276,7 @@ void PIOS_InitPPMFlexiPort(bool input)
if (input)
{
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))
PIOS_Assert(0);

View File

@ -410,6 +410,19 @@ static const struct pios_tim_channel pios_tim_ppm_flexi_port = {
.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 */
#if defined(PIOS_INCLUDE_USART)
@ -541,7 +554,7 @@ void PIOS_RTC_IRQ_Handler (void)
#if defined(PIOS_INCLUDE_PPM)
#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_ICPolarity = TIM_ICPolarity_Rising,
.TIM_ICSelection = TIM_ICSelection_DirectTI,
@ -552,6 +565,17 @@ const struct pios_ppm_cfg pios_ppm_cfg = {
.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 */
/*