~ruther/uni-mam-arm

ref: bb6a58a376bbc65e6c168ecc698421164363bb38 uni-mam-arm/arm07/include/exti.h -rw-r--r-- 793 bytes
bb6a58a3 — Rutherther feat(arm07): implement few commands 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdint.h>
#include <stm32f4xx.h>

#ifndef EXTI_H
#define EXTI_H

typedef struct {
  EXTI_TypeDef* exti;
  SYSCFG_TypeDef* syscfg;
  uint8_t line;
} exti_t;

typedef enum {
  EXTI_GPIOA = 0,
  EXTI_GPIOB = 1,
  EXTI_GPIOC = 2,
  EXTI_GPIOD = 2,
  /// ... TODO
} EXTI_external_gpio_t;

void exti_init(exti_t* exti, uint8_t line, EXTI_TypeDef* exti_periph, SYSCFG_TypeDef* syscfg);
void exti_external_interrupt(exti_t* exti, uint8_t gpio);

// Only 21 positions are now supported. This is too hard for other ones.
void exti_rising_interrupt(exti_t* exti);
void exti_falling_interrupt(exti_t* exti);
void exti_disable_interrupt(exti_t* exti);
void exti_enable_interrupt(exti_t *exti);

uint32_t exti_is_interrupt(exti_t* exti);
void exti_clear_interrupt(exti_t* exti);

#endif // EXTI_H
Do not follow this link