[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / drivers / pin_pull_up_down.c
blob56479b687a906142716f82f59ac1e2673f5a08a9
1 /*
2 * This file is part of 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 #include <stdint.h>
23 #include "platform.h"
25 #ifdef USE_PIN_PULL_UP_DOWN
27 #include "build/debug.h"
28 #include "drivers/io.h"
29 #include "pg/pin_pull_up_down.h"
30 #include "pin_pull_up_down.h"
33 static void initPin(const pinPullUpDownConfig_t* config, resourceOwner_e owner, uint8_t index)
35 IO_t io = IOGetByTag(config->ioTag);
36 if (!io) {
37 return;
40 IOInit(io, owner, RESOURCE_INDEX(index));
42 if (owner == OWNER_PULLUP) {
43 IOConfigGPIO(io, IOCFG_IPU);
44 } else if (owner == OWNER_PULLDOWN) {
45 IOConfigGPIO(io, IOCFG_IPD);
49 void pinPullupPulldownInit(void)
51 for (uint8_t i = 0; i < PIN_PULL_UP_DOWN_COUNT; i++) {
52 initPin(pinPullupConfig(i), OWNER_PULLUP, i);
53 initPin(pinPulldownConfig(i), OWNER_PULLDOWN, i);
57 #endif