paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Paparazzi-devel] Timers missing in ppm_arch.c


From: Chris
Subject: [Paparazzi-devel] Timers missing in ppm_arch.c
Date: Fri, 18 Sep 2020 13:47:25 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi.

I finished writing the board file for the matek f405 wing but it looks like the is some timer configuration missing in paparazzi/sw/airborne/arch/stm32/subsystems/radio_control/ppm_arch.c

Timers 8, 9 and 12 need to be added.

(I don't remember if tim8 is already included)

Chris

HERE IS THE CODE I USE FOR NOW.....

#elif USE_PPM_TIM8 && defined(STM32F4)

#if defined(STM32F1)
void tim8_up_isr(void) {
#elif defined(STM32F4)
void tim8_up_tim13_isr(void) {
#endif
  if ((TIM8_SR & TIM_SR_UIF) != 0) {
    timer_rollover_cnt += (1 << 16);
    timer_clear_flag(TIM8, TIM_SR_UIF);
  }
}

void tim8_cc_isr(void) {
  if ((TIM8_SR & PPM_CC_IF) != 0) {
    timer_clear_flag(TIM8, PPM_CC_IF);

    uint32_t now = timer_get_counter(TIM8) + timer_rollover_cnt;
    ppm_decode_frame(now);
  }
}

#elif USE_PPM_TIM9 && defined(STM32F4)

void tim1_brk_tim9_isr(void)
{
  if ((TIM9_SR & PPM_CC_IF) != 0) {
    timer_clear_flag(TIM9, PPM_CC_IF);

    uint32_t now = timer_get_counter(TIM9) + timer_rollover_cnt;
    ppm_decode_frame(now);

  } else if ((TIM9_SR & TIM_SR_UIF) != 0) {
            timer_rollover_cnt += (1 << 16);
            timer_clear_flag(TIM9, TIM_SR_UIF);
         }
}

#elif USE_PPM_TIM12 && defined(STM32F4)

void tim8_brk_tim12_isr(void)
{
  if ((TIM12_SR & PPM_CC_IF) != 0) {
    timer_clear_flag(TIM12, PPM_CC_IF);

    uint32_t now = timer_get_counter(TIM12) + timer_rollover_cnt;
    ppm_decode_frame(now);

  } else if ((TIM12_SR & TIM_SR_UIF) != 0) {
            timer_rollover_cnt += (1 << 16);
            timer_clear_flag(TIM12, TIM_SR_UIF);
         }
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]