diff --git a/make/source.mk b/make/source.mk index 195b27ac09..ce21274411 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 23d961be25..ec19d22b32 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 3ee9b43ed8..ea147e0ed6 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 99a2613fb5..be235254b4 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 c83ae3de13..d06591d4a4 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 e9a79ed934..eee5eb387c 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 e89e35ebf5..f2b5cc351f 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 b650aba63e..624bb7a985 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 440da4acc6..69b81250b0 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 328d7a7825..90a6538ae1 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 b6c1fcf2cf..77dc89bc28 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 825a12cad3..0c2ad8735e 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 0000000000..9a25e68446 --- /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 1d279a84f4..12d9b11005 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 9929497674..e435f77100 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 d3abc7a0f6..19ea262996 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]