The friendly Operating System for the Internet of Things
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 
59 #ifndef DOXYGEN
60 
66 #define HAVE_GPIO_MODE_T
67 typedef enum {
68  GPIO_IN = GPIO_MODE(0, 1, 0),
69  GPIO_IN_PD = GPIO_MODE(0, 2, 0),
70  GPIO_IN_PU = GPIO_MODE(0, 2, 1),
71  GPIO_OUT = GPIO_MODE(3, 0, 0),
72  GPIO_OD = GPIO_MODE(3, 1, 0),
73  GPIO_OD_PU = (0xff)
74 } gpio_mode_t;
76 #endif /* ndef DOXYGEN */
77 
82 #define HAVE_GPIO_PP_T
83 typedef enum {
87 } gpio_pp_t;
90 #ifndef DOXYGEN
91 
95 #define HAVE_GPIO_FLANK_T
96 typedef enum {
97  GPIO_RISING = 1,
98  GPIO_FALLING = 2,
99  GPIO_BOTH = 3
100 } gpio_flank_t;
102 #endif /* ndef DOXYGEN */
103 
107 enum {
108  PORT_A = 0,
109  PORT_B = 1,
110  PORT_C = 2,
111  PORT_D = 3,
112  PORT_E = 4,
113  PORT_F = 5,
114  PORT_G = 6,
115 };
116 
120 typedef struct {
121  gpio_t pin;
122  uint8_t dev;
123  uint8_t chan;
124 } adc_conf_t;
125 
129 typedef struct {
130  gpio_t pin;
131  uint8_t chan;
132 } dac_conf_t;
133 
134 #ifdef __cplusplus
135 }
136 #endif
137 
138 #endif /* PERIPH_CPU_H */
139 
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.
emit interrupt on falling flank
Definition: gpio.h:113
input, pull-up
input, no pull
CPU specific DAC configuration.
do not use internal pull resistors
not supported
input, pull-down
CPU specific ADC configuration.