Paparazzi UAS  v5.8.2_stable-0-g6260b7c
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);
34  }
35  if (EXTI_PR & EXTI5) {
36  exti_reset_request(EXTI5);
38  }
39 }
#define GPIOC
Definition: gpio_arch.h:34
void imu_krooz_sd_arch_init(void)
#define GPIOB
Definition: gpio_arch.h:35
#define TRUE
Definition: std.h:4
#define GPIO5
Definition: gpio_arch.h:42
Inertial Measurement Unit interface.
struct ImuKrooz imu_krooz
Definition: imu_krooz.c:61
#define GPIO6
Definition: gpio_arch.h:43
volatile bool_t hmc_eoc
Definition: imu_krooz.h:109
void exti9_5_isr(void)
#define NVIC_EXTI9_5_IRQ
volatile bool_t mpu_eoc
Definition: imu_krooz.h:108