stm32f1/include/periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef PERIPH_CPU_H
20 #define PERIPH_CPU_H
21 
22 #include "periph_cpu_common.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 #define ADC_DEVS (2U)
32 
36 #define TIMER_CHANNELS (4U)
37 
41 #define TIMER_MAXVAL (0xffff)
42 
52 #define GPIO_MODE(mode, cnf, odr) (mode | (cnf << 2) | (odr << 4))
53 
57 #define PM_NUM_MODES (2U)
58 
63 #define PM_BLOCKER_INITIAL { .val_u32 = 0x01010101 }
64 
65 #ifndef DOXYGEN
66 
72 #define HAVE_GPIO_MODE_T
73 typedef enum {
74  GPIO_IN = GPIO_MODE(0, 1, 0),
75  GPIO_IN_PD = GPIO_MODE(0, 2, 0),
76  GPIO_IN_PU = GPIO_MODE(0, 2, 1),
77  GPIO_OUT = GPIO_MODE(3, 0, 0),
78  GPIO_OD = GPIO_MODE(3, 1, 0),
79  GPIO_OD_PU = (0xff)
80 } gpio_mode_t;
82 #endif /* ndef DOXYGEN */
83 
88 #define HAVE_GPIO_PP_T
89 typedef enum {
93 } gpio_pp_t;
96 #ifndef DOXYGEN
97 
101 #define HAVE_GPIO_FLANK_T
102 typedef enum {
103  GPIO_RISING = 1,
104  GPIO_FALLING = 2,
105  GPIO_BOTH = 3
106 } gpio_flank_t;
108 #endif /* ndef DOXYGEN */
109 
113 enum {
114  PORT_A = 0,
115  PORT_B = 1,
116  PORT_C = 2,
117  PORT_D = 3,
118  PORT_E = 4,
119  PORT_F = 5,
120  PORT_G = 6,
121 };
122 
126 typedef struct {
127  gpio_t pin;
128  uint8_t dev;
129  uint8_t chan;
130 } adc_conf_t;
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* PERIPH_CPU_H */
137 
emit interrupt on rising flank
Definition: gpio.h:114
#define GPIO_MODE(mode, cnf, odr)
Generate GPIO mode bitfields.
emit interrupt on both flanks
Definition: gpio.h:115
gpio_flank_t
Definition of possible active flanks for external interrupt mode.
Definition: gpio.h:112
enable internal pull-down resistor
enable internal pull-up resistor
uint8_t dev
ADCx - 1 device used for the channel.
gpio_t adc_conf_t
ADC configuration wrapper.
emit interrupt on falling flank
Definition: gpio.h:113
input, no pull
do not use internal pull resistors
not supported
input, pull-down