3 #include <libopencm3/stm32/gpio.h>
4 #include <libopencm3/stm32/rcc.h>
5 #include <libopencm3/stm32/exti.h>
6 #include <libopencm3/stm32/spi.h>
7 #include <libopencm3/stm32/dma.h>
8 #include <libopencm3/cm3/nvic.h>
13 #error "imu_aspirin_arch arch currently only implemented for STM32F1"
19 #ifdef ASPIRIN_USE_GYRO_INT
20 nvic_set_priority(NVIC_EXTI15_10_IRQ, 0x0F);
21 nvic_enable_irq(NVIC_EXTI15_10_IRQ);
24 nvic_set_priority(NVIC_EXTI2_IRQ, 0x0F);
25 nvic_enable_irq(NVIC_EXTI2_IRQ);
30 nvic_set_priority(NVIC_DMA1_CHANNEL4_IRQ, 0);
31 nvic_enable_irq(NVIC_DMA1_CHANNEL4_IRQ);
38 #ifdef ASPIRIN_USE_GYRO_INT
39 nvic_disable_irq(NVIC_EXTI15_10_IRQ);
42 nvic_disable_irq(NVIC_EXTI2_IRQ);
47 nvic_disable_irq(NVIC_DMA1_CHANNEL4_IRQ);
59 rcc_periph_clock_enable(RCC_GPIOC);
60 gpio_set_mode(
GPIOC, GPIO_MODE_INPUT,
66 rcc_periph_clock_enable(RCC_GPIOC);
67 rcc_periph_clock_enable(RCC_AFIO);
68 gpio_set_mode(
GPIOC, GPIO_MODE_INPUT,
69 GPIO_CNF_INPUT_FLOAT,
GPIO14);
71 #ifdef ASPIRIN_USE_GYRO_INT
72 exti_select_source(EXTI14,
GPIOC);
73 exti_set_trigger(EXTI14, EXTI_TRIGGER_FALLING);
74 exti_enable_request(EXTI14);
78 rcc_periph_clock_enable(RCC_GPIOB);
79 gpio_set_mode(
GPIOB, GPIO_MODE_INPUT,
80 GPIO_CNF_INPUT_FLOAT,
GPIO2);
81 exti_select_source(EXTI2,
GPIOB);
82 exti_set_trigger(EXTI2, EXTI_TRIGGER_FALLING);
83 exti_enable_request(EXTI2);
97 exti_reset_request(EXTI14);
99 #ifdef ASPIRIN_USE_GYRO_INT
113 exti_reset_request(EXTI2);
struct ImuAspirin imu_aspirin
void imu_aspirin_arch_init(void)
void imu_aspirin_arch_int_disable(void)
Inertial Measurement Unit interface.
void imu_aspirin_arch_int_enable(void)
Architecture independent I2C (Inter-Integrated Circuit Bus) API.