23 #include <libopencm3/stm32/gpio.h>
24 #include <libopencm3/stm32/rcc.h>
25 #include <libopencm3/stm32/spi.h>
26 #include <libopencm3/stm32/exti.h>
27 #include <libopencm3/cm3/nvic.h>
32 #error "HMC5843 arch currently only implemented for STM32F1"
38 rcc_periph_clock_enable(RCC_GPIOB);
39 rcc_periph_clock_enable(RCC_AFIO);
40 gpio_set_mode(
GPIOB, GPIO_MODE_INPUT,
41 GPIO_CNF_INPUT_FLOAT,
GPIO5);
43 #ifdef HMC5843_USE_INT
44 exti_select_source(EXTI5,
GPIOB);
45 exti_set_trigger(EXTI5, EXTI_TRIGGER_FALLING);
46 exti_enable_request(EXTI5);
48 nvic_set_priority(NVIC_EXTI9_5_IRQ, 0x0f);
49 nvic_enable_irq(NVIC_EXTI9_5_IRQ);
55 i2c2_er_irq_handler();
61 exti_reset_request(EXTI5);
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
void hmc5843_arch_init(void)
void hmc5843_arch_reset(void)