Fix function brace style
[betaflight.git] / src / main / drivers / io_impl.h
blob9877ee0dc87f942a423706eb51a8bce0ffa1c2c5
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 // TODO - GPIO_TypeDef include
24 #include "platform.h"
26 #include "drivers/io.h"
28 typedef struct ioDef_s {
29 ioTag_t tag;
30 } ioDef_t;
32 typedef struct ioRec_s {
33 GPIO_TypeDef *gpio;
34 uint16_t pin;
35 resourceOwner_e owner;
36 uint8_t index;
37 } ioRec_t;
39 extern ioRec_t ioRecs[];
41 int IO_GPIOPortIdx(IO_t io);
42 int IO_GPIOPinIdx(IO_t io);
44 int IO_GPIO_PinSource(IO_t io);
45 int IO_GPIO_PortSource(IO_t io);
47 #if defined(STM32F4)
48 int IO_EXTI_PortSourceGPIO(IO_t io);
49 int IO_EXTI_PinSource(IO_t io);
50 #endif
52 GPIO_TypeDef* IO_GPIO(IO_t io);
53 uint16_t IO_Pin(IO_t io);
55 #define IO_GPIOBYTAG(tag) IO_GPIO(IOGetByTag(tag))
56 #define IO_PINBYTAG(tag) IO_Pin(IOGetByTag(tag))
57 #define IO_GPIOPortIdxByTag(tag) DEFIO_TAG_GPIOID(tag)
58 #define IO_GPIOPinIdxByTag(tag) DEFIO_TAG_PIN(tag)
60 uint32_t IO_EXTI_Line(IO_t io);
61 ioRec_t *IO_Rec(IO_t io);