From 2d930b28cefcf1b303534d9430159a5e9f3bebd1 Mon Sep 17 00:00:00 2001 From: mikeller Date: Sun, 24 Dec 2017 14:33:18 +1300 Subject: [PATCH] Moved vcd parameter group to `pg/`. --- make/source.mk | 1 + src/main/drivers/max7456.c | 2 +- src/main/fc/config.c | 4 ---- src/main/fc/config.h | 2 -- src/main/fc/fc_init.c | 1 + src/main/interface/cli.c | 1 - src/main/interface/msp.c | 3 ++- src/main/interface/settings.c | 1 + src/main/io/displayport_max7456.c | 2 +- src/main/io/displayport_rcdevice.c | 9 ++++++--- src/main/io/rcdevice_osd.c | 11 +++++++---- src/main/osd_slave/osd_slave_init.c | 5 +++-- src/main/pg/vcd.c | 24 ++++++++++++++++++++++++ src/main/{drivers => pg}/vcd.h | 12 +++++++----- src/main/target/BEEBRAIN_V2F/config.c | 2 ++ src/test/unit/rcdevice_unittest.cc | 10 +++++----- 16 files changed, 61 insertions(+), 29 deletions(-) create mode 100644 src/main/pg/vcd.c rename src/main/{drivers => pg}/vcd.h (96%) diff --git a/make/source.mk b/make/source.mk index 195b27ac0..ce2127441 100644 --- a/make/source.mk +++ b/make/source.mk @@ -67,6 +67,7 @@ COMMON_SRC = \ pg/pg.c \ pg/rx_pwm.c \ pg/sdcard.c \ + pg/vcd.c \ scheduler/scheduler.c \ sensors/battery.c \ sensors/current.c \ diff --git a/src/main/drivers/max7456.c b/src/main/drivers/max7456.c index 23d961be2..ec19d22b3 100644 --- a/src/main/drivers/max7456.c +++ b/src/main/drivers/max7456.c @@ -28,6 +28,7 @@ #include "pg/max7456.h" #include "pg/pg.h" #include "pg/pg_ids.h" +#include "pg/vcd.h" #include "drivers/bus_spi.h" #include "drivers/dma.h" @@ -37,7 +38,6 @@ #include "drivers/max7456_symbols.h" #include "drivers/nvic.h" #include "drivers/time.h" -#include "drivers/vcd.h" // DEBUG_MAX7456_SIGNAL diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 3ee9b43ed..ea147e0ed 100644 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -54,7 +54,6 @@ #include "drivers/sound_beeper.h" #include "drivers/system.h" #include "drivers/timer.h" -#include "drivers/vcd.h" #include "fc/config.h" #include "fc/controlrate_profile.h" @@ -141,9 +140,6 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig, ); #endif -// no template required since defaults are zero -PG_REGISTER(vcdProfile_t, vcdProfile, PG_VCD_CONFIG, 0); - #ifdef SWAP_SERIAL_PORT_0_AND_1_DEFAULTS #define FIRST_PORT_INDEX 1 #define SECOND_PORT_INDEX 0 diff --git a/src/main/fc/config.h b/src/main/fc/config.h index 99a2613fb..be235254b 100644 --- a/src/main/fc/config.h +++ b/src/main/fc/config.h @@ -26,7 +26,6 @@ #include "drivers/serial.h" #include "drivers/bus_i2c.h" #include "drivers/sound_beeper.h" -#include "drivers/vcd.h" typedef enum { FEATURE_RX_PPM = 1 << 0, @@ -82,7 +81,6 @@ typedef struct systemConfig_s { PG_DECLARE(pilotConfig_t, pilotConfig); PG_DECLARE(systemConfig_t, systemConfig); PG_DECLARE(beeperDevConfig_t, beeperDevConfig); -PG_DECLARE(vcdProfile_t, vcdProfile); struct pidProfile_s; extern struct pidProfile_s *currentPidProfile; diff --git a/src/main/fc/fc_init.c b/src/main/fc/fc_init.c index c83ae3de1..d06591d4a 100644 --- a/src/main/fc/fc_init.c +++ b/src/main/fc/fc_init.c @@ -83,6 +83,7 @@ #include "pg/pg.h" #include "pg/rx_pwm.h" #include "pg/sdcard.h" +#include "pg/vcd.h" #include "rx/rx.h" #include "rx/rx_spi.h" diff --git a/src/main/interface/cli.c b/src/main/interface/cli.c index e9a79ed93..eee5eb387 100644 --- a/src/main/interface/cli.c +++ b/src/main/interface/cli.c @@ -76,7 +76,6 @@ extern uint8_t __config_end; #include "drivers/transponder_ir.h" #include "drivers/time.h" #include "drivers/timer.h" -#include "drivers/vcd.h" #include "drivers/light_led.h" #include "drivers/camera_control.h" #include "drivers/vtx_common.h" diff --git a/src/main/interface/msp.c b/src/main/interface/msp.c index e89e35ebf..f2b5cc351 100644 --- a/src/main/interface/msp.c +++ b/src/main/interface/msp.c @@ -52,7 +52,6 @@ #include "drivers/serial.h" #include "drivers/serial_escserial.h" #include "drivers/system.h" -#include "drivers/vcd.h" #include "drivers/vtx_common.h" #include "drivers/transponder_ir.h" #include "drivers/camera_control.h" @@ -97,6 +96,8 @@ #include "msp/msp_serial.h" +#include "pg/vcd.h" + #include "rx/rx.h" #include "rx/msp.h" diff --git a/src/main/interface/settings.c b/src/main/interface/settings.c index b650aba63..624bb7a98 100644 --- a/src/main/interface/settings.c +++ b/src/main/interface/settings.c @@ -67,6 +67,7 @@ #include "pg/pg_ids.h" #include "pg/rx_pwm.h" #include "pg/sdcard.h" +#include "pg/vcd.h" #include "rx/rx.h" #include "rx/cc2500_frsky_common.h" diff --git a/src/main/io/displayport_max7456.c b/src/main/io/displayport_max7456.c index 440da4acc..69b81250b 100644 --- a/src/main/io/displayport_max7456.c +++ b/src/main/io/displayport_max7456.c @@ -26,7 +26,6 @@ #include "drivers/display.h" #include "drivers/max7456.h" -#include "drivers/vcd.h" #include "fc/config.h" @@ -37,6 +36,7 @@ #include "pg/max7456.h" #include "pg/pg.h" #include "pg/pg_ids.h" +#include "pg/vcd.h" displayPort_t max7456DisplayPort; diff --git a/src/main/io/displayport_rcdevice.c b/src/main/io/displayport_rcdevice.c index 328d7a782..90a6538ae 100644 --- a/src/main/io/displayport_rcdevice.c +++ b/src/main/io/displayport_rcdevice.c @@ -18,15 +18,18 @@ #include #include +#include "platform.h" + +#ifdef USE_RCDEVICE + #include "drivers/display.h" -#include "drivers/vcd.h" #include "io/rcdevice.h" #include "io/rcdevice_osd.h" -#include "io/displayport_rcdevice.h" +#include "pg/vcd.h" -#ifdef USE_RCDEVICE +#include "displayport_rcdevice.h" displayPort_t rcdeviceOSDDisplayPort; diff --git a/src/main/io/rcdevice_osd.c b/src/main/io/rcdevice_osd.c index b6c1fcf2c..77dc89bc2 100644 --- a/src/main/io/rcdevice_osd.c +++ b/src/main/io/rcdevice_osd.c @@ -18,13 +18,16 @@ #include #include -#include "drivers/vcd.h" - -#include "rcdevice.h" -#include "rcdevice_osd.h" +#include "platform.h" #ifdef USE_RCDEVICE +#include "io/rcdevice.h" + +#include "pg/vcd.h" + +#include "rcdevice_osd.h" + #define VIDEO_BUFFER_CHARS_PAL 480 static uint8_t columnCount = 30; diff --git a/src/main/osd_slave/osd_slave_init.c b/src/main/osd_slave/osd_slave_init.c index 825a12cad..0c2ad8735 100644 --- a/src/main/osd_slave/osd_slave_init.c +++ b/src/main/osd_slave/osd_slave_init.c @@ -30,8 +30,6 @@ #include "config/config_eeprom.h" #include "config/feature.h" -#include "pg/pg.h" -#include "pg/pg_ids.h" #include "drivers/adc.h" #include "drivers/bus.h" @@ -79,6 +77,9 @@ #include "pg/adc.h" #include "pg/bus_i2c.h" +#include "pg/pg.h" +#include "pg/pg_ids.h" +#include "pg/vcd.h" #include "scheduler/scheduler.h" diff --git a/src/main/pg/vcd.c b/src/main/pg/vcd.c new file mode 100644 index 000000000..9a25e6844 --- /dev/null +++ b/src/main/pg/vcd.c @@ -0,0 +1,24 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight is free software: you can redistribute it and/or modify + * it 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 is distributed in the hope that it 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 Cleanflight. If not, see . + */ + +#include "pg/pg.h" +#include "pg/pg_ids.h" + +#include "vcd.h" + +// no template required since defaults are zero +PG_REGISTER(vcdProfile_t, vcdProfile, PG_VCD_CONFIG, 0); diff --git a/src/main/drivers/vcd.h b/src/main/pg/vcd.h similarity index 96% rename from src/main/drivers/vcd.h rename to src/main/pg/vcd.h index 1d279a84f..12d9b1100 100644 --- a/src/main/drivers/vcd.h +++ b/src/main/pg/vcd.h @@ -19,14 +19,16 @@ // Video Character Display parameters +enum VIDEO_SYSTEMS { + VIDEO_SYSTEM_AUTO = 0, + VIDEO_SYSTEM_PAL, + VIDEO_SYSTEM_NTSC +}; + typedef struct vcdProfile_s { uint8_t video_system; int8_t h_offset; int8_t v_offset; } vcdProfile_t; -enum VIDEO_SYSTEMS { - VIDEO_SYSTEM_AUTO = 0, - VIDEO_SYSTEM_PAL, - VIDEO_SYSTEM_NTSC -}; +PG_DECLARE(vcdProfile_t, vcdProfile); diff --git a/src/main/target/BEEBRAIN_V2F/config.c b/src/main/target/BEEBRAIN_V2F/config.c index 992949767..e435f7710 100644 --- a/src/main/target/BEEBRAIN_V2F/config.c +++ b/src/main/target/BEEBRAIN_V2F/config.c @@ -37,6 +37,8 @@ #include "flight/mixer.h" #include "flight/pid.h" +#include "pg/vcd.h" + #include "rx/rx.h" #include "io/serial.h" diff --git a/src/test/unit/rcdevice_unittest.cc b/src/test/unit/rcdevice_unittest.cc index d3abc7a0f..19ea26299 100644 --- a/src/test/unit/rcdevice_unittest.cc +++ b/src/test/unit/rcdevice_unittest.cc @@ -30,24 +30,24 @@ extern "C" { #include "common/utils.h" #include "common/streambuf.h" - #include "pg/pg.h" - #include "pg/pg_ids.h" - #include "fc/rc_controls.h" #include "fc/rc_modes.h" + #include "drivers/serial.h" #include "io/beeper.h" #include "io/serial.h" #include "scheduler/scheduler.h" - #include "drivers/serial.h" - #include "drivers/vcd.h" #include "io/rcdevice_cam.h" #include "io/osd.h" #include "io/rcdevice.h" #include "io/rcdevice_osd.h" + #include "pg/pg.h" + #include "pg/pg_ids.h" + #include "pg/vcd.h" + #include "rx/rx.h" int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT]; // interval [1000;2000]