Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
imu_krooz_sd_arch.c
Go to the documentation of this file.
1 #include "subsystems/imu.h"
2 
3 #include <libopencm3/stm32/rcc.h>
4 #include <libopencm3/stm32/gpio.h>
5 #include <libopencm3/stm32/exti.h>
6 #include <libopencm3/cm3/nvic.h>
7 
9 
11  rcc_periph_clock_enable(RCC_SYSCFG);
12  rcc_periph_clock_enable(RCC_GPIOB);
13  rcc_periph_clock_enable(RCC_GPIOB);
14  gpio_mode_setup(GPIOB, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO5);
15  gpio_mode_setup(GPIOC, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO6);
16 
17  nvic_enable_irq(NVIC_EXTI9_5_IRQ);
18  exti_select_source(EXTI5, GPIOB);
19  exti_select_source(EXTI6, GPIOC);
20  exti_set_trigger(EXTI5, EXTI_TRIGGER_RISING);
21  exti_set_trigger(EXTI6, EXTI_TRIGGER_FALLING);
22  exti_enable_request(EXTI5);
23  exti_enable_request(EXTI6);
24  nvic_set_priority(NVIC_EXTI9_5_IRQ, 0x0F);
25 }
26 
27 void exti9_5_isr(void) {
28  /* clear EXTI */
29  if(EXTI_PR & EXTI6) {
30  exti_reset_request(EXTI6);
32  }
33  if(EXTI_PR & EXTI5) {
34  exti_reset_request(EXTI5);
36  }
37 }
#define GPIOC
Definition: gpio_arch.h:34
void imu_krooz_sd_arch_init(void)
volatile bool_t mpu_eoc
Definition: imu_krooz.h:111
#define GPIOB
Definition: gpio_arch.h:35
#define GPIO5
Definition: gpio_arch.h:42
Inertial Measurement Unit interface.
#define TRUE
Definition: imu_chimu.h:144
volatile bool_t hmc_eoc
Definition: imu_krooz.h:112
struct ImuKrooz imu_krooz
Definition: imu_krooz.c:60
#define GPIO6
Definition: gpio_arch.h:43
void exti9_5_isr(void)
#define NVIC_EXTI9_5_IRQ