paparazzi-devel
[Top][All Lists]
Advanced

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

Re: [Paparazzi-devel] external interrupt with the chibios?


From: Chris
Subject: Re: [Paparazzi-devel] external interrupt with the chibios?
Date: Thu, 27 May 2021 11:01:35 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

I found that this code at least compiles ok, the pin is wrong, it is used only for testing the code.

  palSetPadMode(GPIOA, 0,PAL_MODE_INPUT_PULLUP | PAL_STM32_OSPEED_HIGHEST);
  /* Enabling events on both edges of PA0 signal.*/
  //palEnablePadEvent(GPIOA, 0U, PAL_EVENT_MODE_BOTH_EDGES);
  palEnablePadEvent(GPIOA, 0U, PAL_EVENT_MODE_FALLING_EDGE);
  palSetPadCallback(GPIOA, 0U, chibios_ext_isr_cb, NULL);

And the call back function

static void chibios_ext_isr_cb(void *arg)
{
    (void)arg;
    if (RF_Mode == TRANSMIT) {
      RF_Mode = TRANSMITTED;
      isr_packet_tranmitted = true;
    } else if (RF_Mode == RECEIVE) {
      RF_Mode = RECEIVED;
      isr_packet_received = true;
      lastReceived = millis();
    }

return;
}

Is this approach acceptable ?

Chris


On 27/5/21 2:14 π.μ., Chris wrote:
Hi.

Is there any example of how to setup an external interrupt iwith chibios?

with libopencm3 i use

  rcc_periph_clock_enable(RCC_SYSCFG);
  rcc_periph_clock_enable(RCC_GPIOB);
  rcc_periph_clock_enable(RCC_GPIOB);

  gpio_mode_setup(GPIOB, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO5);
  //gpio_mode_setup(GPIOC, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO6);

  nvic_enable_irq(NVIC_EXTI9_5_IRQ);
  exti_select_source(EXTI5, GPIOB);
  //exti_select_source(EXTI6, GPIOC);
  exti_set_trigger(EXTI5, EXTI_TRIGGER_FALLING);
  //exti_set_trigger(EXTI6, EXTI_TRIGGER_RISING);
  exti_enable_request(EXTI5);
  //exti_enable_request(EXTI6);
  nvic_set_priority(NVIC_EXTI9_5_IRQ, 0x0F);

But with chibios i do';t know how to do it (but i am trying!)

Chris





reply via email to

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