From 3c58522d5e290559418633949f4544af5802c0a3 Mon Sep 17 00:00:00 2001 From: jflyper Date: Sun, 25 Nov 2018 11:03:53 +0900 Subject: [PATCH] Use pinio for OSD channel switch and move OSD_CH_SWITCH out of target.h --- src/main/target/KROOZX/config.c | 10 +++++--- src/main/target/KROOZX/initialisation.c | 33 ------------------------- src/main/target/KROOZX/target.h | 3 --- 3 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 src/main/target/KROOZX/initialisation.c diff --git a/src/main/target/KROOZX/config.c b/src/main/target/KROOZX/config.c index e872c082a..f8b7006ec 100644 --- a/src/main/target/KROOZX/config.c +++ b/src/main/target/KROOZX/config.c @@ -24,18 +24,22 @@ #include "platform.h" #include "common/axis.h" - +#include "drivers/io.h" +#include "io/osd.h" +#include "pg/pinio.h" #include "sensors/battery.h" #include "sensors/barometer.h" #include "sensors/compass.h" -#include "io/osd.h" - #define VBAT_SCALE 113 +#define OSD_CH_SWITCH PC5 #ifdef USE_TARGET_CONFIG void targetConfiguration(void) { + pinioConfigMutable()->ioTag[0] = IO_TAG(OSD_CH_SWITCH); + pinioConfigMutable()->config[0] = PINIO_CONFIG_MODE_OUT_PP; // Default state is LOW + voltageSensorADCConfigMutable(VOLTAGE_SENSOR_ADC_VBAT)->vbatscale = VBAT_SCALE; barometerConfigMutable()->baro_hardware = 0; compassConfigMutable()->mag_hardware = 0; diff --git a/src/main/target/KROOZX/initialisation.c b/src/main/target/KROOZX/initialisation.c deleted file mode 100644 index 46a37cf9d..000000000 --- a/src/main/target/KROOZX/initialisation.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of Cleanflight and Betaflight. - * - * Cleanflight and Betaflight are free software. You can redistribute - * this software and/or modify this software under the terms of the - * GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Cleanflight and Betaflight are distributed in the hope that they - * 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 this software. - * - * If not, see . - */ - -#include -#include -#include "drivers/io.h" -#include "drivers/bus_i2c.h" -#include "drivers/bus_spi.h" - -void targetPreInit(void) -{ - IO_t osdChSwitch = IOGetByTag(IO_TAG(OSD_CH_SWITCH)); - IOInit(osdChSwitch, OWNER_SYSTEM, 0); - IOConfigGPIO(osdChSwitch, IOCFG_OUT_PP); - IOLo(osdChSwitch); -} diff --git a/src/main/target/KROOZX/target.h b/src/main/target/KROOZX/target.h index 6918966a7..590697b32 100644 --- a/src/main/target/KROOZX/target.h +++ b/src/main/target/KROOZX/target.h @@ -28,7 +28,6 @@ #define USBD_PRODUCT_STRING "KroozX" #define USE_TARGET_CONFIG -#define TARGET_PREINIT #define LED0_PIN PA14 // Red LED #define LED1_PIN PA13 // Green LED @@ -83,8 +82,6 @@ #define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD) // 10MHz #define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST) -#define OSD_CH_SWITCH PC5 - #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC #define USE_ADC