libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
gpio_common_3n3s.h
Go to the documentation of this file.
1/*
2 * This file is part of the libopencm3 project.
3 *
4 * Copyright (C) 2013 Gareth McMullin <gareth@blacksphere.co.nz>
5 * Copyright (C) 2014 Felix Held <felix-libopencm3@felixheld.de>
6 *
7 * This library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21/* THIS FILE SHOULD NOT BE INCLUDED DIRECTLY, BUT ONLY VIA GPIO.H
22The order of header inclusion is important. gpio.h includes the device
23specific memorymap.h header before including this header file.*/
24
25#if defined(LIBOPENCM3_GPIO_H)
26
27#ifndef LIBOPENCM3_GPIO_COMMON_3N3S_H
28#define LIBOPENCM3_GPIO_COMMON_3N3S_H
29
31
32
33/* flags may be or'd together, but only contain one of
34 * GPOUTPUT, PERIPHA, PERIPHB, PERIPHC and PERIPHD */
35enum gpio_flags {
36 GPIO_FLAG_GPINPUT = 0,
37 GPIO_FLAG_GPOUTPUT = 1,
38 GPIO_FLAG_PERIPHA = 2,
39 GPIO_FLAG_PERIPHB = 3,
40 GPIO_FLAG_PERIPHC = 4,
41 GPIO_FLAG_PERIPHD = 5,
42 GPIO_FLAG_OPEN_DRAIN = (1 << 3),
43 GPIO_FLAG_PULL_UP = (1 << 4),
44};
45
46
47void gpio_init(uint32_t gpioport, uint32_t pins, enum gpio_flags flags);
48
49
50#endif
51
52#else
53#warning "gpio_common_3n3s.h should not be included explicitly, only via gpio.h"
54#endif
void gpio_init(uint32_t port, uint32_t pins, enum gpio_flags flags)
Initialize GPIO pins.