libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
gpio_common_all.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
30 The order of header inclusion is important. gpio.h includes the device
31 specific memorymap.h header before including this header file.*/
32 
33 /** @cond */
34 #if defined(LIBOPENCM3_GPIO_H)
35 /** @endcond */
36 #ifndef LIBOPENCM3_GPIO_COMMON_ALL_H
37 #define LIBOPENCM3_GPIO_COMMON_ALL_H
38 
39 /**@{*/
40 
41 /* --- Convenience macros -------------------------------------------------- */
42 
43 /* --- GPIO_LCKR values ---------------------------------------------------- */
44 
45 #define GPIO_LCKK (1 << 16)
46 /* GPIO_LCKR[15:0]: LCKy: Port x lock bit y (y = 0..15) */
47 
48 /* GPIO number definitions (for convenience) */
49 /** @defgroup gpio_pin_id GPIO Pin Identifiers
50 @ingroup gpio_defines
51 
52 @{*/
53 #define GPIO0 (1 << 0)
54 #define GPIO1 (1 << 1)
55 #define GPIO2 (1 << 2)
56 #define GPIO3 (1 << 3)
57 #define GPIO4 (1 << 4)
58 #define GPIO5 (1 << 5)
59 #define GPIO6 (1 << 6)
60 #define GPIO7 (1 << 7)
61 #define GPIO8 (1 << 8)
62 #define GPIO9 (1 << 9)
63 #define GPIO10 (1 << 10)
64 #define GPIO11 (1 << 11)
65 #define GPIO12 (1 << 12)
66 #define GPIO13 (1 << 13)
67 #define GPIO14 (1 << 14)
68 #define GPIO15 (1 << 15)
69 #define GPIO_ALL 0xffff
70 /**@}*/
71 
73 
74 void gpio_set(uint32_t gpioport, uint16_t gpios);
75 void gpio_clear(uint32_t gpioport, uint16_t gpios);
76 uint16_t gpio_get(uint32_t gpioport, uint16_t gpios);
77 void gpio_toggle(uint32_t gpioport, uint16_t gpios);
78 uint16_t gpio_port_read(uint32_t gpioport);
79 void gpio_port_write(uint32_t gpioport, uint16_t data);
80 void gpio_port_config_lock(uint32_t gpioport, uint16_t gpios);
81 
83 
84 /**@}*/
85 #endif
86 /** @cond */
87 #else
88 #warning "gpio_common_all.h should not be included explicitly, only via gpio.h"
89 #endif
90 /** @endcond */
91 
#define END_DECLS
Definition: common.h:34
#define BEGIN_DECLS
Definition: common.h:33
void gpio_toggle(uint32_t gpioport, uint16_t gpios)
Toggle a Group of Pins.
uint16_t gpio_get(uint32_t gpioport, uint16_t gpios)
Read a Group of Pins.
void gpio_port_config_lock(uint32_t gpioport, uint16_t gpios)
Lock the Configuration of a Group of Pins.
void gpio_set(uint32_t gpioport, uint16_t gpios)
Set a Group of Pins Atomic.
void gpio_clear(uint32_t gpioport, uint16_t gpios)
Clear a Group of Pins Atomic.
uint16_t gpio_port_read(uint32_t gpioport)
Read from a Port.
void gpio_port_write(uint32_t gpioport, uint16_t data)
Write to a Port.