1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| /*PANEL By HUGO
* Avec Arduino MEGA 2560
* je laisse les PIN 20/21 disponibles pour utiliser un liquidcrystal I2C (ultérieurement)
-module ADF
-module FM
-module ARMEMENT
-module FLARE
-module LIGHT
-module MASTER ARM
*/
//Bibliotheques utilisées
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"
/* paste code snippets from the reference documentation here */
//module ADF
DcsBios::RotaryEncoder adfMode("ADF_MODE", "DEC", "INC", 2, 3);
DcsBios::RotaryEncoder adfTune ("ADF_TUNE", "-3200", "+3200", 4, 5);
DcsBios::Switch3Pos adfBand("ADF_BAND", 6, 7);
DcsBios::Switch2Pos intNavSw("INT_NAV_SW", 8);//bouton volume ADF à insérer PIN_8
//module FM uniquement les 2 premiers rotacteurs
DcsBios::RotaryEncoder vhffmFreq1("VHFFM_FREQ1", "DEC", "INC", 11, 12);
DcsBios::RotaryEncoder vhffmFreq2("VHFFM_FREQ2", "DEC", "INC", 9, 10);
DcsBios::Switch2Pos intRcvr1Sw("INT_RCVR1_SW", 13);//bouton volume FM à insérer PIN_13
DcsBios::RotaryEncoder vhffmMode("VHFFM_MODE", "DEC", "INC", 14, 15);
//module ARMEMENT
DcsBios::Switch3Pos rocketSel("ROCKET_SEL", 16, 17);
DcsBios::Switch3Pos gunSel("GUN_SEL", 18, 19);
DcsBios::Switch3Pos masterArmSw("MASTER_ARM_SW", 42, 43);
DcsBios::Switch2Pos jtsnBtn("JTSN_BTN", 22);
DcsBios::RotaryEncoder rocketPair("ROCKET_PAIR", "DEC", "INC", 23, 24);
DcsBios::LED armedInd(0x1416, 0x0010, 25);
//module contre-mesure
//DcsBios::Switch2Pos cmArmSw("CM_ARM_SW", 26);
DcsBios::LED cmArmSw(0x151e, 0x0010, 53);
DcsBios::Switch2Pos cmFlareBtn("CM_FLARE_BTN", 28);
////bouton DISP CONT à insérer PIN_29
//module LIGHT
DcsBios::Switch3Pos ldgLtCtrl("LDG_LT_CTRL", 30, 31); //commande phare d'atterrissage
DcsBios::Switch2Pos ldgLightSw("LDG_LIGHT_SW", 32);
DcsBios::Switch3Pos searchLightSw("SEARCH_LIGHT_SW", 34, 35); // phare de recherche
DcsBios::Switch3Pos navLtsSw("NAV_LTS_SW", 36, 37);//Feux de navigation
DcsBios::Switch2Pos anticollLtsSw("ANTICOLL_LTS_SW", 38); //Anticoll
DcsBios::Switch3Pos domeLightSw("DOME_LIGHT_SW", 40, 41);//Plafonnier
//module MASTER ARM
DcsBios::LED masterCautionInd(0x1416, 0x0100, 44);
DcsBios::Switch3Pos clpResetTestSw("CLP_RESET_TEST_SW", 46, 47);//test reset MA
//liquidcrystal_I2C
LiquidCrystal_I2C lcd(0x27,16,2);
//frequence ADF
void onAdfFreqChange(unsigned int newValue) {
/* your code here */
//lcd.setCursor(4,1);
//lcd.print(newValue);
lcd.setCursor(0,1);
lcd.print("ADF:");
}
DcsBios::IntegerBuffer adfFreqBuffer(0x1426, 0xffff, 0, onAdfFreqChange);
//fréquznce FM
void onVhffmFreq1Change(char* newValue) {
/* your code here */
lcd.setCursor(0,0);
lcd.print("FM :");
lcd.setCursor(7,0);
lcd.print("ALT:");
lcd.setCursor(4,0);
lcd.print(newValue);
}
DcsBios::StringBuffer<1> vhffmFreq1Buffer(0x14ec, onVhffmFreq1Change);
//cap
void onSbyCompassHdgChange(unsigned int newValue) {
/* your code here */
lcd.setCursor(9,1);
lcd.print("CAP:");
lcd.setCursor(13,1);
lcd.print(newValue);
}
//DcsBios::IntegerBuffer sbyCompassHdgBuffer(0x153a, 0xffff, 0, onSbyCompassHdgChange);
void onVhffmFreq2Change(unsigned int newValue) {
/* your code here */
lcd.setCursor(5,0);
lcd.print(newValue);
}
DcsBios::IntegerBuffer vhffmFreq2Buffer(0x14e8, 0x0f00, 8, onVhffmFreq2Change);
//altitude
void onAltMslFtChange(unsigned int newValue) {
/* your code here */
lcd.setCursor(11,0);
lcd.print(newValue);
}
DcsBios::IntegerBuffer altMslFtBuffer(0x0434, 0xffff, 0, onAltMslFtChange);
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
DcsBios::setup();
}
void loop() {
DcsBios::loop();
} |