-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
gpio_arch.h
72 lines (63 loc) · 2.3 KB
/
gpio_arch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright (C) 2013 Felix Ruess <felix.ruess@gmail.com>
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file arch/stm32/mcu_periph/gpio_arch.h
* @ingroup stm32_arch
*
* GPIO helper functions for STM32F1 and STM32F4.
*
* The gpio_set and gpio_clear functions are already available from libopencm3.
*/
#ifndef GPIO_ARCH_H
#define GPIO_ARCH_H
#include <libopencm3/stm32/gpio.h>
/**
* Setup one or more pins of the given GPIO port as outputs.
* @param[in] port
* @param[in] gpios If multiple pins are to be changed, use logical OR '|' to separate them.
*/
extern void gpio_setup_output(uint32_t port, uint16_t gpios);
/**
* Setup one or more pins of the given GPIO port as inputs.
* @param[in] port
* @param[in] gpios If multiple pins are to be changed, use logical OR '|' to separate them.
*/
extern void gpio_setup_input(uint32_t port, uint16_t gpios);
/**
* Setup a gpio for input or output with alternate function.
* This is an STM32 specific helper funtion and should only be used in stm32 arch code.
*/
#if defined(STM32F1)
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint32_t af, bool_t is_output);
#else
extern void gpio_setup_pin_af(uint32_t port, uint16_t pin, uint8_t af, bool_t is_output);
#endif
/**
* Setup a gpio for analog use.
* This is an STM32 specific helper funtion and should only be used in stm32 arch code.
*/
extern void gpio_setup_pin_analog(uint32_t port, uint16_t pin);
/**
* Enable the relevant clock.
* This is an STM32 specific helper funtion and should only be used in stm32 arch code.
*/
extern void gpio_enable_clock(uint32_t port);
#endif /* GPIO_ARCH_H */