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

PiOS F4: Fix PWM timer interrupts and enable PWM input

This commit is contained in:
James Cotton 2011-11-26 22:41:41 -06:00
parent 21367d3a22
commit 13729f854e
2 changed files with 29 additions and 33 deletions

View File

@ -376,18 +376,37 @@ static void PIOS_TIM_generic_irq_handler(TIM_TypeDef * timer)
* Map all valid TIM IRQs to the common interrupt handler
* and give it enough context to properly demux the various timers
*/
void TIM1_UP_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_1_UP_irq_handler")));
static void PIOS_TIM_1_UP_irq_handler (void)
{
PIOS_TIM_generic_irq_handler (TIM1);
}
void TIM1_CC_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_1_CC_irq_handler")));
static void PIOS_TIM_1_CC_irq_handler (void)
{
PIOS_TIM_generic_irq_handler (TIM1);
}
// The rest of TIM1 interrupts are overlapped
void TIM1_BRK_TIM9_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_9_CC_irq_handler")));
static void PIOS_TIM_9_CC_irq_handler (void)
{
// TODO: Check for TIM1_BRK
PIOS_TIM_generic_irq_handler (TIM9);
}
void TIM1_UP_TIM10_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_10_CC_irq_handler")));
static void PIOS_TIM_10_CC_irq_handler (void)
{
if (TIM_GetITStatus(TIM1, TIM_IT_Update)) {
PIOS_TIM_generic_irq_handler(TIM1);
} else if (TIM_GetITStatus(TIM10, TIM_IT_CC1 | TIM_IT_CC2 | TIM_IT_CC3 | TIM_IT_CC4)) {
PIOS_TIM_generic_irq_handler (TIM10);
}
}
void TIM1_TRG_COM_TIM11_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_11_CC_irq_handler")));
static void PIOS_TIM_11_CC_irq_handler (void)
{
// TODO: Check for TIM1_TRG
PIOS_TIM_generic_irq_handler (TIM11);
}
void TIM2_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_2_irq_handler")));
static void PIOS_TIM_2_irq_handler (void)
{
@ -435,26 +454,3 @@ static void PIOS_TIM_8_CC_irq_handler (void)
{
PIOS_TIM_generic_irq_handler (TIM8);
}
void TIM1_BRK_TIM9_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_9_CC_irq_handler")));
static void PIOS_TIM_9_CC_irq_handler (void)
{
// TODO: Check for TIM1_BRK
PIOS_TIM_generic_irq_handler (TIM9);
}
void TIM1_UP_TIM10_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_10_CC_irq_handler")));
static void PIOS_TIM_10_CC_irq_handler (void)
{
// TODO: Check for TIM1_UP
PIOS_TIM_generic_irq_handler (TIM10);
}
void TIM1_TRG_COM_TIM11_IRQHandler(void) __attribute__ ((alias ("PIOS_TIM_11_CC_irq_handler")));
static void PIOS_TIM_11_CC_irq_handler (void)
{
// TODO: Check for TIM1_TRG
PIOS_TIM_generic_irq_handler (TIM11);
}

View File

@ -1624,14 +1624,14 @@ void PIOS_Board_Init(void) {
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_DSMMAINPORT] = pios_dsm_rcvr_id;
/* Set up the receiver port. Later this should be optional */
//uint32_t pios_pwm_id;
//PIOS_PWM_Init(&pios_pwm_id, &pios_pwm_cfg);
uint32_t pios_pwm_id;
PIOS_PWM_Init(&pios_pwm_id, &pios_pwm_cfg);
/*uint32_t pios_pwm_rcvr_id;
uint32_t pios_pwm_rcvr_id;
if (PIOS_RCVR_Init(&pios_pwm_rcvr_id, &pios_pwm_rcvr_driver, pios_pwm_id)) {
PIOS_Assert(0);
}
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PWM] = pios_pwm_rcvr_id;*/
pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_PWM] = pios_pwm_rcvr_id;
/* Set up the servo outputs */
PIOS_Servo_Init(&pios_servo_cfg);