summaryrefslogtreecommitdiffstats
path: root/app/pins.h
blob: 16da24c1b07a0018c11af6e4f6f29296cfc7a2e7 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
#define MAP_AF(a, af) do {   \
    gpio_mode_setup( a ## _PORT, GPIO_MODE_AF, GPIO_PUPD_NONE, a ); \
    gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
    gpio_set_af( a ## _PORT, af, a); \
  } while (0)

#define MAP_AF_PU(a, af) do {    \
    gpio_mode_setup( a ## _PORT, GPIO_MODE_AF, GPIO_PUPD_PULLUP, a ); \
    gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
    gpio_set_af( a ## _PORT, af, a); \
  } while (0)

#define MAP_AF_OD(a, af) do {    \
    gpio_mode_setup( a ## _PORT, GPIO_MODE_AF, GPIO_PUPD_PULLUP, a ); \
    gpio_set_output_options( a ## _PORT, GPIO_OTYPE_OD, GPIO_OSPEED_50MHZ, a); \
    gpio_set_af( a ## _PORT, af, a); \
  } while (0)


#define MAP_OUTPUT_PP(a)  do { \
    gpio_mode_setup( a ## _PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_NONE, a ); \
    gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
  } while (0)


#define MAP_OUTPUT_OD(a)  do { \
    gpio_mode_setup( a ## _PORT, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, a ); \
    gpio_set_output_options( a ## _PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, a); \
  } while (0)


#define MAP_INPUT_PU(a)   do { \
    gpio_mode_setup( a ## _PORT, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, a ); \
  } while (0)


#define MAP_INPUT(a)  do { \
    gpio_mode_setup( a ## _PORT, GPIO_MODE_INPUT, GPIO_PUPD_NONE, a ); \
  } while (0)


#define CLEAR(a) gpio_clear( a ## _PORT, a)
#define SET(a) gpio_set( a ## _PORT, a)
#define GET(a) gpio_get( a ## _PORT, a)