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 CPUID_ADDR (0x1ffff7e8)
37 
41 #define TIMER_CHANNELS (4U)
42 
46 #define TIMER_MAXVAL (0xffff)
47 
57 #define GPIO_MODE(mode, cnf, odr) (mode | (cnf << 2) | (odr << 4))
58 
62 #define PM_NUM_MODES (2U)
63 
68 #define PM_BLOCKER_INITIAL { .val_u32 = 0x01010101 }
69 
73 #define PM_STOP_CONFIG (PWR_CR_LPDS)
74 
75 #ifndef DOXYGEN
76 
82 #define HAVE_GPIO_MODE_T
83 typedef enum {
84  GPIO_IN = GPIO_MODE(0, 1, 0),
85  GPIO_IN_PD = GPIO_MODE(0, 2, 0),
86  GPIO_IN_PU = GPIO_MODE(0, 2, 1),
87  GPIO_OUT = GPIO_MODE(3, 0, 0),
88  GPIO_OD = GPIO_MODE(3, 1, 0),
89  GPIO_OD_PU = (0xff)
90 } gpio_mode_t;
92 #endif /* ndef DOXYGEN */
93 
98 #define HAVE_GPIO_PP_T
99 typedef enum {
103 } gpio_pp_t;
106 #ifndef DOXYGEN
107 
111 #define HAVE_GPIO_FLANK_T
112 typedef enum {
113  GPIO_RISING = 1,
114  GPIO_FALLING = 2,
115  GPIO_BOTH = 3
116 } gpio_flank_t;
118 #endif /* ndef DOXYGEN */
119 
123 enum {
124  PORT_A = 0,
125  PORT_B = 1,
126  PORT_C = 2,
127  PORT_D = 3,
128  PORT_E = 4,
129  PORT_F = 5,
130  PORT_G = 6,
131 };
132 
136 typedef struct {
137  gpio_t pin;
138  uint8_t dev;
139  uint8_t chan;
140 } adc_conf_t;
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* PERIPH_CPU_H */
147 
emit interrupt on rising flank
#define GPIO_MODE(mode, cnf, odr)
Generate GPIO mode bitfields.
emit interrupt on both flanks
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
input, no pull
do not use internal pull resistors
not supported
input, pull-down