libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
gpio_common_f24.h
Go to the documentation of this file.
1/** @addtogroup gpio_defines
2 *
3 * @author @htmlonly © @endhtmlonly 2011
4 * Fergus Noble <fergusnoble@gmail.com>
5 * @author @htmlonly &copy; @endhtmlonly 2012
6 * Ken Sarkies <ksarkies@internode.on.net>
7 *
8 */
9/*
10 * This file is part of the libopencm3 project.
11 *
12 * Copyright (C) 2011 Fergus Noble <fergusnoble@gmail.com>
13 * Copyright (C) 2012 Ken Sarkies <ksarkies@internode.on.net>
14 *
15 * This library is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public License
26 * along with this library. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA GPIO.H
30The order of header inclusion is important. gpio.h includes the device
31specific memorymap.h header before including this header file.*/
32
33/** @cond */
34#ifdef LIBOPENCM3_GPIO_H
35/** @endcond */
36#ifndef LIBOPENCM3_GPIO_COMMON_F24_H
37#define LIBOPENCM3_GPIO_COMMON_F24_H
38
39/**@{*/
40
42
43/* GPIO port base addresses (for convenience) */
44/** @defgroup gpio_port_id GPIO Port IDs
45@ingroup gpio_defines
46
47@{*/
48#define GPIOI GPIO_PORT_I_BASE
49#define GPIOJ GPIO_PORT_J_BASE
50#define GPIOK GPIO_PORT_K_BASE
51/**@}*/
52
53/* --- GPIO registers for STM32F2, STM32F3 and STM32F4 --------------------- */
54
55/* Port mode register (GPIOx_MODER) */
56#define GPIOI_MODER GPIO_MODER(GPIOI)
57#define GPIOJ_MODER GPIO_MODER(GPIOJ)
58#define GPIOK_MODER GPIO_MODER(GPIOK)
59
60/* Port output type register (GPIOx_OTYPER) */
61#define GPIOI_OTYPER GPIO_OTYPER(GPIOI)
62#define GPIOJ_OTYPER GPIO_OTYPER(GPIOJ)
63#define GPIOK_OTYPER GPIO_OTYPER(GPIOK)
64
65/* Port output speed register (GPIOx_OSPEEDR) */
66#define GPIOI_OSPEEDR GPIO_OSPEEDR(GPIOI)
67#define GPIOJ_OSPEEDR GPIO_OSPEEDR(GPIOJ)
68#define GPIOK_OSPEEDR GPIO_OSPEEDR(GPIOK)
69
70/* Port pull-up/pull-down register (GPIOx_PUPDR) */
71#define GPIOI_PUPDR GPIO_PUPDR(GPIOI)
72#define GPIOJ_PUPDR GPIO_PUPDR(GPIOJ)
73#define GPIOK_PUPDR GPIO_PUPDR(GPIOK)
74
75/* Port input data register (GPIOx_IDR) */
76#define GPIOI_IDR GPIO_IDR(GPIOI)
77#define GPIOJ_IDR GPIO_IDR(GPIOJ)
78#define GPIOK_IDR GPIO_IDR(GPIOK)
79
80/* Port output data register (GPIOx_ODR) */
81#define GPIOI_ODR GPIO_ODR(GPIOI)
82#define GPIOJ_ODR GPIO_ODR(GPIOJ)
83#define GPIOK_ODR GPIO_ODR(GPIOK)
84
85/* Port bit set/reset register (GPIOx_BSRR) */
86#define GPIOI_BSRR GPIO_BSRR(GPIOI)
87#define GPIOJ_BSRR GPIO_BSRR(GPIOJ)
88#define GPIOK_BSRR GPIO_BSRR(GPIOK)
89
90/* Port configuration lock register (GPIOx_LCKR) */
91#define GPIOI_LCKR GPIO_LCKR(GPIOI)
92#define GPIOJ_LCKR GPIO_LCKR(GPIOJ)
93#define GPIOK_LCKR GPIO_LCKR(GPIOK)
94
95/* Alternate function low register (GPIOx_AFRL) */
96#define GPIOI_AFRL GPIO_AFRL(GPIOI)
97#define GPIOJ_AFRL GPIO_AFRL(GPIOJ)
98#define GPIOK_AFRL GPIO_AFRL(GPIOK)
99
100/* Alternate function high register (GPIOx_AFRH) */
101#define GPIOI_AFRH GPIO_AFRH(GPIOI)
102#define GPIOJ_AFRH GPIO_AFRH(GPIOJ)
103#define GPIOK_AFRH GPIO_AFRH(GPIOK)
104
105/**@}*/
106#endif
107/** @cond */
108#else
109#warning "gpio_common_f24.h should not be included explicitly, only via gpio.h"
110#endif
111/** @endcond */