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
| /*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
//liquidcrystal_I2C
LiquidCrystal_I2C lcd(0x27,16,2);
//modification de la bande
void onAdfBandChange(unsigned int newValue) {
if (newValue=='0'){
void onAdfFreqChange(unsigned int newValue) {
newValue = map(newValue,0,65477,190, 400);
lcd.setCursor(0,1);
lcd.print("ADF:");
lcd.setCursor(4,1);
lcd.print(" ");
lcd.setCursor(4,1);
lcd.print(newValue);
}
DcsBios::IntegerBuffer adfFreqBuffer(0x1426, 0xffff, 0, onAdfFreqChange);
}
if (newValue=='1'){
void onAdfFreqChange(unsigned int newValue) {
newValue = map(newValue,0,65477,400, 850);
lcd.setCursor(0,1);
lcd.print("ADF:");
lcd.setCursor(4,1);
lcd.print(" ");
lcd.setCursor(4,1);
lcd.print(newValue);
}
DcsBios::IntegerBuffer adfFreqBuffer(0x1426, 0xffff, 0, onAdfFreqChange);
}
if (newValue=='2'){
void onAdfFreqChange(unsigned int newValue) {
newValue = map(newValue,0,65477,850, 1750);
lcd.setCursor(0,1);
lcd.print("ADF:");
lcd.setCursor(4,1);
lcd.print(" ");
lcd.setCursor(4,1);
lcd.print(newValue);
}
DcsBios::IntegerBuffer adfFreqBuffer(0x1426, 0xffff, 0, onAdfFreqChange);
}
/* lcd.setCursor(9,1);
lcd.print("bande");
lcd.setCursor(13,1);
lcd.print(" ");
lcd.setCursor(13,1);
lcd.print(newValue);*/
}
DcsBios::IntegerBuffer adfBandBuffer(0x14fc, 0x00c0, 6, onAdfBandChange);
//frequence ADF
void onAdfFreqChange(unsigned int newValue) {
//SI BANDE = 0
newValue = map(newValue,0,65477,190, 400);
//SI BANDE = 1
//newValue = map(newValue,0,65477,400, 850);
// SI BANDE = 2
//newValue = map(newValue,0,65477,850, 1750);
lcd.setCursor(0,1);
lcd.print("ADF:");
lcd.setCursor(4,1);
lcd.print(" ");
lcd.setCursor(4,1);
lcd.print(newValue);
}
DcsBios::IntegerBuffer adfFreqBuffer(0x1426, 0xffff, 0, onAdfFreqChange);
void setup() {
lcd.init();
lcd.backlight();
lcd.clear();
DcsBios::setup();
}
void loop() {
DcsBios::loop();
} |
Partager