Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces 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 {
12  rcc_periph_clock_enable(RCC_SYSCFG);
13  rcc_periph_clock_enable(RCC_GPIOB);
14  rcc_periph_clock_enable(RCC_GPIOB);
15  gpio_mode_setup(GPIOB, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO5);
16  gpio_mode_setup(GPIOC, GPIO_MODE_INPUT, GPIO_PUPD_NONE, GPIO6);
17 
18  nvic_enable_irq(NVIC_EXTI9_5_IRQ);
19  exti_select_source(EXTI5, GPIOB);
20  exti_select_source(EXTI6, GPIOC);
21  exti_set_trigger(EXTI5, EXTI_TRIGGER_RISING);
22  exti_set_trigger(EXTI6, EXTI_TRIGGER_FALLING);
23  exti_enable_request(EXTI5);
24  exti_enable_request(EXTI6);
25  nvic_set_priority(NVIC_EXTI9_5_IRQ, 0x0F);
26 }
27 
28 void exti9_5_isr(void)
29 {
30  /* clear EXTI */
31  if (EXTI_PR & EXTI6) {
32  exti_reset_request(EXTI6);
33  imu_krooz.hmc_eoc = true;
34  }
35  if (EXTI_PR & EXTI5) {
36  exti_reset_request(EXTI5);
37  imu_krooz.mpu_eoc = true;
38  }
39 }
volatile bool mpu_eoc
Definition: imu_krooz.h:81
#define GPIO6
Definition: gpio_def.h:37
volatile bool hmc_eoc
Definition: imu_krooz.h:82
#define GPIOC
Definition: gpio_arch.h:34
void imu_krooz_sd_arch_init(void)
#define GPIOB
Definition: gpio_arch.h:35
Inertial Measurement Unit interface.
struct ImuKrooz imu_krooz
Definition: imu_krooz.c:54
void exti9_5_isr(void)
#define GPIO5
Definition: gpio_def.h:36