diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h new file mode 100644 index 0000000..08f8d53 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A2A1_MASTER_ARM_BL.h @@ -0,0 +1,120 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A2A1_MASTER_ARM_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Master Arm panel backlighting /w annunciators to split out code for panel specific lighting support. +*/ + +#ifndef __MASTER_ARM_BL_H +#define __MASTER_ARM_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define READY_START 0 + MASTER_ARM_LED_START_INDEX ///< Index 1st READY pixel +#define READY_COUNT 2 ///< READY pixel count +#define DISCH_START 2 + MASTER_ARM_LED_START_INDEX ///< Index 1st DISCH pixel +#define DISCH_COUNT 2 ///< DISCH pixel count +#define MM_AG_START 25 + MASTER_ARM_LED_START_INDEX ///< Index 1st A/G pixel +#define MM_AG_COUNT 2 ///< A/G pixel count +#define MM_AA_START 27 + MASTER_ARM_LED_START_INDEX ///< Index 1st A/A pixel +#define MM_AA_COUNT 2 ///< A/A pixel count +#define MA_BL_START 4 + MASTER_ARM_LED_START_INDEX ///< Indes for 1st Master Arm panel backlight pixel +#define MA_BL_LENGTH 21 ///< Master Arm panel backlight pixel count + +/** +* @brief Setup maserArmPanel's neopixel and then set the DCS Bios methods to read sim state and set +* backlighting / annunciators accordingly. +* +*/ + +void onMcReadyChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, READY_START, READY_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), READY_START, READY_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer mcReadyBuffer(0x740c, 0x8000, 15, onMcReadyChange); + +void onMcDischChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, DISCH_START, DISCH_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), DISCH_START, DISCH_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer mcDischBuffer(0x740c, 0x4000, 14, onMcDischChange); + +void onMasterModeAgLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, MM_AG_START, MM_AG_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AG_START, MM_AG_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer masterModeAgLtBuffer(0x740c, 0x0400, 10, onMasterModeAgLtChange); + +void onMasterModeAaLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, MM_AA_START, MM_AA_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), MM_AA_START, MM_AA_COUNT); ///< Set light to Green + break; + } +} +DcsBios::IntegerBuffer masterModeAaLtBuffer(0x740c, 0x0200, 9, onMasterModeAaLtChange); + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h new file mode 100644 index 0000000..39ccd61 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A4_L_EWI_BL.h @@ -0,0 +1,258 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A4_L_EWI_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Left EWI panel annunciators to split out code for panel specific lighting support. +*/ + +#ifndef __L_EWI_BL_H +#define __L_EWI_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define FIRE_START 0 + L_EWI_LED_START_INDEX ///< Starting index of the pixel string, FIRE push button switch +#define FIRE_COUNT 4 ///< Number of pixels under the Fire push button. +#define MC_START 4 + L_EWI_LED_START_INDEX ///< Index for pixel for Master Caution pushbutton switch. +#define MC_COUNT 4 ///< Number of pixels under the Master Caution pushbutton. +#define GO_START 8 + L_EWI_LED_START_INDEX ///< Index for 1st Go pixel +#define GO_COUNT 2 ///< Go pixel count +#define NO_GO_START 10 + L_EWI_LED_START_INDEX ///< Index for 1st No_Go pixel +#define NO_GO_COUNT 2 ///< No Go pixel count +#define R_BLEED_START 12 + L_EWI_LED_START_INDEX ///< Index for 1st R Bleed pixel +#define R_BLEED_COUNT 2 ///< R Bleed pixel count +#define L_BLEED_START 14 + L_EWI_LED_START_INDEX ///< Index for 1st L Bleed pixel +#define L_BLEED_COUNT 2 ///< L Bleed pixel count +#define SPD_BRK_START 16 + L_EWI_LED_START_INDEX ///< Index for 1st SPD BRK pixel +#define SPD_BRK_COUNT 2 ///< SPD BRK pixel count +#define STBY_START 18 + L_EWI_LED_START_INDEX ///< Index for 1st STBY pixel +#define STBY_COUNT 2 ///< SBY pixel count +#define REC_START 20 + L_EWI_LED_START_INDEX ///< Index for 1st REC pixel +#define REC_COUNT 2 ///< REC pixel count +#define L_BAR1_START 22 + L_EWI_LED_START_INDEX ///< Index for 1st L_BAR1 pixel +#define L_BAR1_COUNT 2 ///< L_BAR1 pixel count +#define L_BAR2_START 24 + L_EWI_LED_START_INDEX ///< Index for 1st LBAR2 pixel +#define L_BAR2_COUNT 2 ///< L_BAR2 pixel count +#define XMIT_START 26 + L_EWI_LED_START_INDEX ///< Index for 1st XMIT pixel +#define XMIT_COUNT 2 ///< XMIT pixel count. +#define ASPJ_ON_START 28 + L_EWI_LED_START_INDEX /// Index for 1st ASPJ_ON pixel +#define ASPJ_ON_COUNT 2 ///< ASPJ_ON pixel count. + + +void onFireLeftLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, FIRE_START, FIRE_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), FIRE_START, FIRE_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer fireLeftLtBuffer(0x7408, 0x0040, 6, onFireLeftLtChange); + +void onMasterCautionLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, MC_START, MC_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), MC_START, MC_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer masterCautionLtBuffer(0x7408, 0x0200, 9, onMasterCautionLtChange); + +void onLhAdvAspjOhChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, ASPJ_ON_START, ASPJ_ON_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), ASPJ_ON_START, ASPJ_ON_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvAspjOhBuffer(0x740a, 0x0008, 3, onLhAdvAspjOhChange); + +void onLhAdvGoChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, GO_START, GO_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), GO_START, GO_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvGoBuffer(0x740a, 0x0010, 4, onLhAdvGoChange); + +void onLhAdvLBarGreenChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BAR2_START, L_BAR2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BAR2_START, L_BAR2_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvLBarGreenBuffer(0x740a, 0x0002, 1, onLhAdvLBarGreenChange); + +void onLhAdvLBarRedChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BAR1_START, L_BAR1_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), L_BAR1_START, L_BAR1_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvLBarRedBuffer(0x7408, 0x8000, 15, onLhAdvLBarRedChange); + +void onLhAdvLBleedChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLEED_START, L_BLEED_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), L_BLEED_START, L_BLEED_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvLBleedBuffer(0x7408, 0x0800, 11, onLhAdvLBleedChange); + +void onLhAdvNoGoChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, NO_GO_START, NO_GO_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), NO_GO_START, NO_GO_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvNoGoBuffer(0x740a, 0x0020, 5, onLhAdvNoGoChange); + +void onLhAdvRBleedChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_BLEED_START, R_BLEED_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), R_BLEED_START, R_BLEED_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvRBleedBuffer(0x7408, 0x1000, 12, onLhAdvRBleedChange); + +void onLhAdvRecChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, REC_START, REC_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), REC_START, REC_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvRecBuffer(0x740a, 0x0001, 0, onLhAdvRecChange); + +void onLhAdvSpdBrkChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, SPD_BRK_START, SPD_BRK_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), SPD_BRK_START, SPD_BRK_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvSpdBrkBuffer(0x7408, 0x2000, 13, onLhAdvSpdBrkChange); + +void onLhAdvStbyChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, STBY_START, STBY_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), STBY_START, STBY_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvStbyBuffer(0x7408, 0x4000, 14, onLhAdvStbyChange); + +void onLhAdvXmitChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, XMIT_START, XMIT_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), XMIT_START, XMIT_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer lhAdvXmitBuffer(0x740a, 0x0004, 2, onLhAdvXmitChange); + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h new file mode 100644 index 0000000..ca9451b --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A5_R_EWI_BL.h @@ -0,0 +1,257 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A5_R_EWI_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Right EWI panel annunciators to split out code for panel specific lighting support. +*/ + +#ifndef __R_EWI_BL_H +#define __R_EWI_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define R_FIRE_START 0 + R_EWI_LED_START_INDEX ///< Starting index of the pixel string, FIRE push button switch +#define R_FIRE_COUNT 4 ///< Number of pixels under the Fire push button. +#define APU_FIRE_START 4 + R_EWI_LED_START_INDEX ///< Index for pixel for APU Fire pushbutton switch. +#define APU_FIRE_COUNT 4 ///< Number of pixels under the APU Fire pushbutton. +#define DISP_START 8 + R_EWI_LED_START_INDEX ///< Index for 1st DISP pixel +#define DISP_COUNT 2 ///< DISP pixel count +#define RCDRON_ON_START 10 + R_EWI_LED_START_INDEX ///< Index for 1st RCDRON ON pixel +#define RCDRON_ON_COUNT 2 ///< RCDRON ON pixel count +#define L_BLANK_START 12 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define L_BLANK_COUNT 2 ///< R Bleed pixel count +#define R_BLANK_START 14 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define R_BLANK_COUNT 2 ///< BLANK pixel count +#define R_BLANK2_START 16 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define R_BLANK2_COUNT 2 ///< BLANK pixel count +#define L_BLANK2_START 18 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define L_BLANK2_COUNT 2 ///< BLANK pixel count +#define L_BLANK3_START 20 + R_EWI_LED_START_INDEX ///< Index for 1st BLANK pixel +#define L_BLANK3_COUNT 2 ///< BLANK pixel count +#define SAM_START 22 + R_EWI_LED_START_INDEX ///< Index for 1st SAM pixel +#define SAM_COUNT 2 ///< SAM pixel count +#define AAA_START 24 + R_EWI_LED_START_INDEX ///< Index for 1st AAA pixel +#define AAA_COUNT 2 ///< AAA pixel count +#define AI_START 26 + R_EWI_LED_START_INDEX ///< Index for 1st AI pixel +#define AI_COUNT 2 ///< AI pixel count. +#define CW_START 28 + R_EWI_LED_START_INDEX /// Index for 1st CW pixel +#define CW_COUNT 2 ///< CW pixel count. + +void onFireRightLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_FIRE_START, R_FIRE_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), R_FIRE_START, R_FIRE_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer fireRightLtBuffer(0x740c, 0x0010, 4, onFireRightLtChange); + +void onFireApuLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, APU_FIRE_START, APU_FIRE_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 0, 0), APU_FIRE_START, APU_FIRE_COUNT); ///< Set light to Red + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer fireApuLtBuffer(0x740c, 0x0004, 2, onFireApuLtChange); + +void onRhAdvAaaChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, AAA_START, AAA_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), AAA_START, AAA_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvAaaBuffer(0x740a, 0x0800, 11, onRhAdvAaaChange); + +void onRhAdvAiChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, AI_START, AI_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), AI_START, AI_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvAiBuffer(0x740a, 0x0400, 10, onRhAdvAiChange); + +void onRhAdvCwChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, CW_START, CW_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), CW_START, CW_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvCwBuffer(0x740a, 0x1000, 12, onRhAdvCwChange); + +void onRhAdvDispChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, DISP_START, DISP_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), DISP_START, DISP_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvDispBuffer(0x740a, 0x0100, 8, onRhAdvDispChange); + +void onRhAdvRcdrOnChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, RCDRON_ON_START, RCDRON_ON_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), RCDRON_ON_START, RCDRON_ON_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvRcdrOnBuffer(0x740a, 0x0080, 7, onRhAdvRcdrOnChange); + +void onRhAdvSamChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, SAM_START, SAM_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), SAM_START, SAM_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSamBuffer(0x740a, 0x0200, 9, onRhAdvSamChange); + +void onRhAdvSpareRh1Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLANK_START, L_BLANK_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BLANK_START, L_BLANK_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh1Buffer(0x740a, 0x2000, 13, onRhAdvSpareRh1Change); + +void onRhAdvSpareRh2Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_BLANK_START, R_BLANK_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), R_BLANK_START, R_BLANK_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh2Buffer(0x740a, 0x4000, 14, onRhAdvSpareRh2Change); + +void onRhAdvSpareRh3Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, R_BLANK2_START, R_BLANK2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), R_BLANK2_START, R_BLANK2_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh3Buffer(0x740a, 0x8000, 15, onRhAdvSpareRh3Change); + +void onRhAdvSpareRh4Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLANK2_START, L_BLANK2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BLANK2_START, L_BLANK2_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh4Buffer(0x740c, 0x0001, 0, onRhAdvSpareRh4Change); + +void onRhAdvSpareRh5Change(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, L_BLANK3_START, L_BLANK3_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(0, 255, 0), L_BLANK3_START, L_BLANK3_COUNT); ///< Set light to Green + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer rhAdvSpareRh5Buffer(0x740c, 0x0002, 1, onRhAdvSpareRh5Change); + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A6A1_SPN_RCVY_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A6A1_SPN_RCVY_BL.h new file mode 100644 index 0000000..3345369 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A6A1_SPN_RCVY_BL.h @@ -0,0 +1,101 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A6A1_SPN_RCVY_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the Spin Recovery panel backlighting /w annunciators to split out code for panel specific lighting support. +*/ + +#ifndef __SPN_RCVY_BL_H +#define __SPN_RCVY_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define SPN_START 29 + SPN_RCVY_LED_START_INDEX ///< Index 1st SPN pixel +#define SPN_COUNT 1 ///< SPN pixel count +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN2_START 36 + SPN_RCVY_LED_START_INDEX ///< Index 2nd SPN pixel +#else +#define SPN2_START 32 + SPN_RCVY_LED_START_INDEX ///< Index 2nd SPN pixel +#endif +#define SPN2_COUNT 1 ///< SPN2 pixel count + +#define SPN_RCVY_BL_START 0 + SPN_RCVY_LED_START_INDEX ///< Index for 1st block of SPN RCVY panel backlight pixels +#define SPN_RCVY_LENGTH 29 ///< SPN RCVY panel backlight block 1 pixel count + +#define SPN_RCVY2_BL_START 30 + SPN_RCVY_LED_START_INDEX ///< Index for 2nd block of SPN RCVY panel backlight pixels + +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN_RCVY2_LENGTH 5 ///< 2 SPN RCVY panel backlight block 2 pixel count +#else +#define SPN_RCVY2_LENGTH 2 ///< 2 SPN RCVY panel backlight block 2 pixel count +#endif + +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN_RCVY3_BL_START 37 + SPN_RCVY_LED_START_INDEX ///< 36 Index for 3nd block of SPN RCVY panel backlight pixels +#define SPN_RCVY3_LENGTH 26 ///< 19 SPN RCVY panel backlight block 2 pixel count +#else +#define SPN_RCVY3_BL_START 36 + SPN_RCVY_LED_START_INDEX ///< 36 Index for 3nd block of SPN RCVY panel backlight pixels +#define SPN_RCVY3_LENGTH 19 ///< 19 SPN RCVY panel backlight block 2 pixel count +#endif + +/** +* @brief Setup SPN RCVY panel's neopixel and then set the DCS Bios methods to read sim state and set +* backlighting / annunciators accordingly. +* +*/ + +void onSpinLtChange(unsigned int newValue) { + switch (newValue) { + case 0: + uipBLCh1.fill(0, SPN_START, SPN_COUNT); ///< Off + uipBLCh1.fill(0, SPN2_START, SPN2_COUNT); ///< Off + uipBLCh1.show(); + break; + case 1: + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), SPN_START, SPN_COUNT); ///< Set light to Yellow + uipBLCh1.fill(uipBLCh1.Color(255, 255, 0), SPN2_START, SPN2_COUNT); ///< Set light to Yellow + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer spinLtBuffer(0x742a, 0x0800, 11, onSpinLtChange); + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h new file mode 100644 index 0000000..1ea035c --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/1A7A1_HUD_PANEL_BL.h @@ -0,0 +1,75 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 1A7A1_HUD_PANEL_BL.h + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the HUD panel backlighting. +*/ + +#ifndef __HUD_PANEL_BL_H +#define __HUD_PANEL_BL_H + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +#define HUD_REJECT_START 0 + HUD_PANEL_START_INDEX ///< Index 1st HUD REJECT pixel +#define HUD_REJECT_COUNT 6 ///< HUD REJECT pixel count +#define HUD_BRT_START 6 + HUD_PANEL_START_INDEX ///< Index 1st HUD BRT pixel +#define HUD_BRT_COUNT 4 ///< HUD BRT pixel count +#define HUD_MODE_START 10 + HUD_PANEL_START_INDEX ///< Index 1st HUD MODE pixel +#define HUD_MODE_COUNT 6 ///< HUD MODE pixel count +#define BLK_LVL_START 16 + HUD_PANEL_START_INDEX ///< Index 1st BLK LVL pixel +#define BLK_LVL_COUNT 6 ///< BLK LVL pixel count +#define WB_START 22 + HUD_PANEL_START_INDEX ///< Index 1st WB pixel +#define WB_COUNT 5 ///< WB pixel count +#define BAL_START 27 + HUD_PANEL_START_INDEX ///< Index 1st BAL pixel +#define BAL_COUNT 5 ///< BAL pixel count. +#define ATT_START 32 + HUD_PANEL_START_INDEX ///< Index 1st ATT pixel +#define ATT_COUNT 6 ///< ATT pixel count. +#define ALT_START 38 + HUD_PANEL_START_INDEX ///< Index 1st ALT pixel +#define ALT_COUNT 7 ///< ALT pixel count. +#define AOA_START 45 + HUD_PANEL_START_INDEX ///< Index 1st AOA pixel +#define AOA_COUNT 5 ///< AOA pixel count +#define HUD_PANEL_BL_START 0 + HUD_PANEL_START_INDEX ///< Index of 1st pixel in the backlighting string + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define HUD_PANEL_BL_LENGTH 56 ///< Number of pixels in the backlighting string, rev4 hardware has 50 LEDs, rev3 had 56. +#else +#define HUD_PANEL_BL_LENGTH 50 ///< Number of pixels in the backlighting string, rev4 hardware has 50 LEDs, rev3 had 56. +#endif + +#endif \ No newline at end of file diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h new file mode 100644 index 0000000..f9f3b88 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.h @@ -0,0 +1,164 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 2A13-BACKLIGHT_CONTROLLER.H + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Header file for the DCSBios backlighting to split out code for panel specific lighting support. +*/ + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#define HUD_PANEL_REV3 + +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#define SPN_RCVY_REV3 + +/** +* @brief UIP Backlights +* +* The Panels are listed in the order they appear according to the interconnect guide. +* If any panels are not connected, change the associtated LED COUNT to 0, comment out its header, +* and adjust the other panels' start index accordingly. +* +*/ +#define MASTER_ARM_LED_START_INDEX 0 ///< Master Arm panel is the first in the UIP BL Channel 1 string. +#define MA_LED_COUNT 29 ///< Master Arm panel has 29 pixels with backlighting. + +#define L_EWI_LED_START_INDEX 29 ///< L_EWI is the second panel in the UIP BL Channel 1 string. +#define L_EWI_LED_COUNT 30 ///< L EWI panel has 30 pixels, no backlighting. + +#define HUD_PANEL_START_INDEX 59 ///< HUD_PANEL is the 3rd panel in the UIP BL Channel 1 string. + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define HUD_PANEL_LED_COUNT 56 ///< HUD_PANEL rev4 has 50 pixels, all for backlighting. If using an older revision may be 56. +#else +#define HUD_PANEL_LED_COUNT 50 ///< HUD_PANEL rev4 has 50 pixels, all for backlighting. If using an older revision may be 56. +#endif + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define R_EWI_LED_START_INDEX 115 ///< R_EWI is the 4th panel in the UIP BL Channel 1 string. +#else +#define R_EWI_LED_START_INDEX 109 ///< R_EWI is the 4th panel in the UIP BL Channel 1 string. +#endif + +#define R_EWI_LED_COUNT 30 ///< R EWI panel has 30 pixels, no backlighting. + +/// @todo remove ifdef for HUD_PANEL_REV3 as it's for my ease of testing +#ifdef HUD_PANEL_REV3 +#define SPN_RCVY_LED_START_INDEX 145 ///< SPN RCVY is the 5th and final panel in the UIP BL Channel 1 string. +#else + +#define SPN_RCVY_LED_START_INDEX 139 ///< SPN RCVY is the 5th and final panel in the UIP BL Channel 1 string. +#endif +/// @todo remove ifdef for SPN_RCVY_REV3 as it's for my ease of testing +#ifdef SPN_RCVY_REV3 +#define SPN_RCVY_LED_COUNT 63 ///< SPN RCVY rev3 panel had 63 pixels with backlighting. +#else +#define SPN_RCVY_LED_COUNT 52 ///< SPN RCVY panel has 52 pixels with backlighting. +#endif + +#define UIP_LED_COUNT MA_LED_COUNT + L_EWI_LED_COUNT + HUD_PANEL_LED_COUNT + R_EWI_LED_COUNT + SPN_RCVY_LED_COUNT ///< add up the connected panels pixel count for the Adafruit_NeoPixel string. + +Adafruit_NeoPixel uipBLCh1 = Adafruit_NeoPixel(UIP_LED_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); ///< Setup the UIP BL Ch1 string. + +// Include the connected panels. If any panel not connected comment out its header, and change its LED count above along with updating downstream panel(s)' start index. +#include "1A2A1_MASTER_ARM_BL.h" +#include "1A4_L_EWI_BL.h" +#include "1A7A1_HUD_PANEL_BL.h" +#include "1A5_R_EWI_BL.h" +#include "1A6A1_SPN_RCVY_BL.h" + +/** +* @brief LIP Backlights +* @todo all the backlight code / headers. +*/ + +#define LIP_LED_COUNT 10 ///< place holder, replace with actual count method similar to above. + +Adafruit_NeoPixel lipBLCh1 = Adafruit_NeoPixel(LIP_LED_COUNT, LIP_BL_CH1, NEO_GRB + NEO_KHZ800); ///< Setup the LIP BL Ch1 string. + + +namespace OpenHornet { +/// @todo If we don't want the namespace rename the setup function and use it in 2A13-BACKLIGHT_CONTROLLER.ino's setup loop, so there is only one setup() per Arduino skectch. +void setup() { + uipBLCh1.begin(); + uipBLCh1.show(); // Clear the LEDs + uipBLCh1.setBrightness(BRIGHTNESS); + + lipBLCh1.begin(); + lipBLCh1.show(); // Clear the LEDs + lipBLCh1.setBrightness(BRIGHTNESS); +} +} + +/** +* This is the DcsBios hook into the Internal Light panel's Instrument Panel Dimmer pot. +* The use of headers and ifdefs should help avoid users from having to manually update the code for any unconnected panels if the associated headers are commented out above. +* +* @todo Add all the backlighting channels and associated panels that run off the onInstPnlDimmerChange pot to light up all the connected panels' backlighting pixels. +*/ +void onInstPnlDimmerChange(unsigned int newValue) { + switch (newValue) { + case 0: + #ifdef __MASTER_ARM_BL_H + uipBLCh1.fill(0, MA_BL_START, MA_BL_LENGTH); ///< Off + #endif + #ifdef __HUD_PANEL_BL_H + uipBLCh1.fill(0, HUD_PANEL_BL_START, HUD_PANEL_BL_LENGTH); ///< Off + #endif + uipBLCh1.show(); + break; + default: + #ifdef __MASTER_ARM_BL_H + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), MA_BL_START, MA_BL_LENGTH); ///< Set light to Green + #endif + #ifdef __HUD_PANEL_BL_H + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), HUD_PANEL_BL_START, HUD_PANEL_BL_LENGTH); ///< Set light to Green + #endif + #ifdef __SPN_RCVY_BL_H + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), SPN_RCVY_BL_START, SPN_RCVY_LENGTH); ///< Set light to Green + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), SPN_RCVY2_BL_START, SPN_RCVY2_LENGTH); ///< Set light to Green + uipBLCh1.fill(uipBLCh1.Color(0, map(newValue, 0, 65535, 0, 255), 0), SPN_RCVY3_BL_START, SPN_RCVY3_LENGTH); ///< Set light to Green + #endif + uipBLCh1.show(); + break; + } +} +DcsBios::IntegerBuffer instPnlDimmerBuffer(0x7546, 0xffff, 0, onInstPnlDimmerChange); diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino new file mode 100644 index 0000000..9924e23 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/2A13-BACKLIGHT_CONTROLLER.ino @@ -0,0 +1,141 @@ +/************************************************************************************** + * ____ _ _ _ + * / __ \ | | | | | | + * | | | |_ __ ___ _ __ | |__| | ___ _ __ _ __ ___| |_ + * | | | | '_ \ / _ \ '_ \| __ |/ _ \| '__| '_ \ / _ \ __| + * | |__| | |_) | __/ | | | | | | (_) | | | | | | __/ |_ + * \____/| .__/ \___|_| |_|_| |_|\___/|_| |_| |_|\___|\__| + * | | + * |_| + * ---------------------------------------------------------------------------------- + * Copyright 2016-2024 OpenHornet + * + * Licensed under the Apache License, Version 2.0 (the "License");d:\OpenHornet-Software\embedded\OH2_Lower_Instrument_Panel\2A13-BACKLIGHT_CONTROLLER\1A6A1_SPN_RCVY_BL.h + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ---------------------------------------------------------------------------------- + * Note: All other portions of OpenHornet not within the 'OpenHornet-Software' + * GitHub repository is released under the Creative Commons Attribution - + * Non-Commercial - Share Alike License. (CC BY-NC-SA 4.0) + * ---------------------------------------------------------------------------------- + * This Project uses Doxygen as a documentation generator. + * Please use Doxygen capable comments. + **************************************************************************************/ +/** + * @file 2A13-BACKLIGHT_CONTROLLER.ino + * @author Arribe + * @date 03.25.2024 + * @version u.0.0.1 (untested) + * @copyright Copyright 2016-2024 OpenHornet. Licensed under the Apache License, Version 2.0. + * @warning This sketch is based on a wiring diagram, and was not yet tested on hardware. (Remove this line once tested on hardware and in system.) + * @brief Controls the backlighting (and some annunciators) for the entire pit. + * + * @Ttodo + * + * @details + * + * * **Reference Designator:** 2A13 + * * **Intended Board:** ABSIS BACKLIGHT CONTROLLER + * * **RS485 Bus Address:** NA + * + * * **Intended Board:** + * ABSIS BACKLIGHT CONTROLLER + * + * * ** Processor ** + * Arduino Mega + Backlight Shield + * + * **Wiring diagram:** + * + * PIN | Function + * --- | --- + * 13 | J2 LIP_BL_CH1 + * 12 | J3 LIP_BL_CH2 + * 11 | J4 UIP_BL_CH1 + * 10 | J5 UIP_BL_CH2 + * 9 | J6 LC_BL_CH1 + * 8 | J7 LC_BL_CH2 + * 7 | J8 RC_BL_CH1 + * 6 | J9 RC_BL_CH2 + * 5 | J10 NC + * 4 | J11 NC + * 24 | J14 SIMPWR_BLM_A + * 23 | J14 SIMPWR_BLM_B + * 22 | J14 SIMPWR_PUSH + * SDA | TEMP SNSR + * SCL | TEMP SNSR + * 2 | J12 & J13 Cooling fan headers. + */ + +/** + * Check if we're on a Mega328 or Mega2560 and define the correct + * serial interface + * + */ +#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__) +#define DCSBIOS_IRQ_SERIAL ///< This enables interrupt-driven serial communication for DCS-BIOS. (Only used with the ATmega328P or ATmega2560 microcontrollers.) +#else +#define DCSBIOS_DEFAULT_SERIAL ///< This enables the default serial communication for DCS-BIOS. (Used with all other microcontrollers than the ATmega328P or ATmega2560.) +#endif + +#ifdef __AVR__ +#include +#endif + +#include "DcsBios.h" +#include "Adafruit_NeoPixel.h" + + +// Define pins for DCS-BIOS per interconnect diagram, and Bakclight control kicad sketch. +#define LIP_BL_CH1 13 ///< J2 LIP_BL_CH1 +#define LIP_BL_CH2 12 ///< J3 LIP_BL_CH2 +#define UIP_BL_CH1 11 ///< J4 UIP_BL_CH1 +#define UIP_BL_CH2 10 ///< J5 UIP_BL_CH2 +#define LC_BL_CH1 9 ///< J6 LC_BL_CH1 +#define LC_BL_CH2 8 ///< J7 LC_BL_CH2 +#define RC_BL_CH1 7 ///< J8 RC_BL_CH1 +#define RC_BL_CH2 6 ///< J9 RC_BL_CH2 +//#define 5 ///< J10 NC +//#define 4 ///< J11 NC +#define SIMPWR_BLM_A 24 ///< J14 SIMPWR_BLM_A +#define SIMPWR_BLM_B 23 ///< J14 SIMPWR_BLM_B +#define SIMPWR_PUSH 22 ///< J14 SIMPWR_PUSH +//#define SDA | TEMP SNSR +//#define SCL | TEMP SNSR +#define COOLING_FANS 2 ///< J12 & J13 Cooling fan headers. + +#define BRIGHTNESS 50 ///< Brightness value used by the panels. + +#include "2A13-BACKLIGHT_CONTROLLER.h" + +/** +* Arduino Setup Function +* +* Arduino standard Setup Function. Code who should be executed +* only once at the programm start, belongs in this function. +*/ +void setup() { + + // Run DCS Bios setup function + DcsBios::setup(); + OpenHornet::setup(); +} + +/** +* Arduino Loop Function +* +* Arduino standard Loop Function. Code who should be executed +* over and over in a loop, belongs in this function. +*/ +void loop() { + + //Run DCS Bios loop function + DcsBios::loop(); +} diff --git a/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile new file mode 100644 index 0000000..99bebd8 --- /dev/null +++ b/embedded/OH2_Lower_Instrument_Panel/2A13-BACKLIGHT_CONTROLLER/Makefile @@ -0,0 +1,8 @@ +# Any extra libraries included by this sketch (space separated) +LIBRARIES = Adafruit_NeoPixel Servo dcs-bios-arduino-library TCA9534 Wire + +# Uncomment one of the following to choose the target board +include $(ROOTDIR)/include/mega2560.mk +# include $(ROOTDIR)/include/promicro.mk +# include $(ROOTDIR)/include/promini.mk +# include $(ROOTDIR)/include/s2mini.mk