drv_gpio.h
Go to the documentation of this file.
1 /*
2  drv_gpio.c : GPIO support for STM32F103CB
3 
4  Adapted from https://github.com/multiwii/baseflight/blob/master/src/drv_gpio.c
5 
6  This file is part of BreezySTM32.
7 
8  BreezySTM32 is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  BreezySTM32 is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with BreezySTM32. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #pragma once
23 
24 typedef enum {
25  Mode_AIN = 0x0,
27  Mode_IPD = 0x28,
28  Mode_IPU = 0x48,
29  Mode_Out_OD = 0x14,
30  Mode_Out_PP = 0x10,
31  Mode_AF_OD = 0x1C,
32  Mode_AF_PP = 0x18
33 } GPIO_Mode;
34 
35 typedef enum {
39 } GPIO_Speed;
40 
41 typedef enum {
42  Pin_0 = 0x0001,
43  Pin_1 = 0x0002,
44  Pin_2 = 0x0004,
45  Pin_3 = 0x0008,
46  Pin_4 = 0x0010,
47  Pin_5 = 0x0020,
48  Pin_6 = 0x0040,
49  Pin_7 = 0x0080,
50  Pin_8 = 0x0100,
51  Pin_9 = 0x0200,
52  Pin_10 = 0x0400,
53  Pin_11 = 0x0800,
54  Pin_12 = 0x1000,
55  Pin_13 = 0x2000,
56  Pin_14 = 0x4000,
57  Pin_15 = 0x8000,
58  Pin_All = 0xFFFF
59 } GPIO_Pin;
60 
61 typedef struct {
62  uint16_t pin;
66 
67 #define digitalHi(p, i) { p->BSRR = i; }
68 #define digitalLo(p, i) { p->BRR = i; }
69 #define digitalToggle(p, i) { p->ODR ^= i; }
70 #define digitalIn(p, i) (p->IDR & i)
71 
72 void gpioInit(GPIO_TypeDef *gpio, gpio_config_t *config);
73 void gpioExtiLineConfig(uint8_t portsrc, uint8_t pinsrc);
74 void gpioPinRemapConfig(uint32_t remap, bool enable);
Definition: drv_gpio.h:44
Definition: drv_gpio.h:50
GPIO_Mode mode
Definition: drv_gpio.h:63
GPIO_Speed speed
Definition: drv_gpio.h:64
void gpioPinRemapConfig(uint32_t remap, bool enable)
Definition: drv_gpio.c:103
Definition: drv_gpio.h:48
uint16_t pin
Definition: drv_gpio.h:62
General Purpose I/O.
Definition: stm32f4xx.h:1281
void gpioExtiLineConfig(uint8_t portsrc, uint8_t pinsrc)
Definition: drv_gpio.c:88
void gpioInit(GPIO_TypeDef *gpio, gpio_config_t *config)
Definition: drv_gpio.c:56
Definition: drv_gpio.h:45
GPIO_Pin
Definition: drv_gpio.h:41
GPIO_Speed
Definition: drv_gpio.h:35
Definition: drv_gpio.h:51
Definition: drv_gpio.h:46
GPIO_Mode
Definition: drv_gpio.h:24
Definition: drv_gpio.h:43
Definition: drv_gpio.h:47
Definition: drv_gpio.h:42
Definition: drv_gpio.h:49


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:46