Merge pull request #7127 from jflyper/bfdev-KROOZX-use-pinio-for-OSD-channel-switch

[KROOZX] Use pinio for OSD channel switch and move OSD_CH_SWITCH out of target.h
This commit is contained in:
Michael Keller 2018-11-28 23:52:35 +13:00 committed by GitHub
commit 2fd4589106
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 39 deletions

View File

@ -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;

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdint.h>
#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);
}

View File

@ -27,7 +27,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
@ -82,8 +81,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