31 #include <libopencm3/stm32/rcc.h>
32 #include <libopencm3/stm32/gpio.h>
33 #include <libopencm3/stm32/exti.h>
34 #include <libopencm3/cm3/nvic.h>
37 #error "MS2100 arch currently only implemented for STM32F1"
44 rcc_periph_clock_enable(RCC_GPIOC);
45 rcc_periph_clock_enable(RCC_AFIO);
47 gpio_set_mode(
GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL,
GPIO13);
51 rcc_periph_clock_enable(RCC_GPIOB);
52 gpio_set_mode(
GPIOB, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT,
GPIO5);
55 exti_select_source(EXTI5,
GPIOB);
56 exti_set_trigger(EXTI5, EXTI_TRIGGER_RISING);
57 exti_enable_request(EXTI5);
71 int32_t end_cpu_ticks = systick_get_value() - dt_ticks;
72 if (end_cpu_ticks < 0) {
73 end_cpu_ticks += systick_get_reload();
75 while (systick_get_value() > (
uint32_t)end_cpu_ticks)
84 exti_reset_request(EXTI5);
static uint32_t cpu_ticks_of_nsec(uint32_t nsec)
Driver for the ms2100 magnetic sensor from PNI.
void ms2100_reset_cb(struct spi_transaction *t)
Reset callback.
SPI transaction structure.
void gpio_set(uint32_t port, uint16_t pin)
Set a gpio output to high level.
Architecture independent timing functions.
void ms2100_arch_init(void)