Skip to content

Instantly share code, notes, and snippets.

@jwvanderbeck
Created June 16, 2019 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwvanderbeck/1d53fa5ed17917fced92c3212de117f9 to your computer and use it in GitHub Desktop.
Save jwvanderbeck/1d53fa5ed17917fced92c3212de117f9 to your computer and use it in GitHub Desktop.
DCS-Bios Radio Panel
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
#define DCSBIOS_IRQ_SERIAL
#include <DcsBios.h>
LiquidCrystal_PCF8574 lcd(0x27); // set the LCD address to 0x27 for a 16 chars and 2 line display
int show;
void onVhfamFreq1Change(char* newValue) {
lcd.setCursor(0, 0);
lcd.print(newValue);
}
DcsBios::StringBuffer<2> vhfamFreq1StrBuffer(0x1190, onVhfamFreq1Change);
void onVhfamFreq2Change(unsigned int newValue) {
lcd.setCursor(3, 0);
lcd.print(newValue);
}
DcsBios::IntegerBuffer vhfamFreq2Buffer(0x118e, 0x00f0, 4, onVhfamFreq2Change);
void onVhfamFreq3Change(unsigned int newValue) {
lcd.setCursor(5, 0);
lcd.print(newValue);
}
DcsBios::IntegerBuffer vhfamFreq3Buffer(0x118e, 0x0f00, 8, onVhfamFreq3Change);
void onVhfamFreq4Change(char* newValue) {
lcd.setCursor(7, 0);
lcd.print(newValue);
}
DcsBios::StringBuffer<2> vhfamFreq4StrBuffer(0x1192, onVhfamFreq4Change);
void onVhfamPresetChange(char* newValue) {
lcd.setCursor(0, 1);
lcd.print(newValue);
}
DcsBios::StringBuffer<2> vhfamPresetStrBuffer(0x118a, onVhfamPresetChange);
DcsBios::RotaryEncoder vhfamFreq1("VHFAM_FREQ1", "DEC", "INC", 2, 3);
DcsBios::RotaryEncoder vhfamFreq2("VHFAM_FREQ2", "DEC", "INC", 4, 5);
DcsBios::RotaryEncoder vhfamFreq3("VHFAM_FREQ3", "DEC", "INC", 6, 7);
DcsBios::RotaryEncoder vhfamFreq4("VHFAM_FREQ4", "DEC", "INC", 8, 9);
DcsBios::RotaryEncoder vhfamFreqemer("VHFAM_FREQEMER", "DEC", "INC", 10, 11);
DcsBios::RotaryEncoder vhfamPreset("VHFAM_PRESET", "DEC", "INC", 12, 13);
void setup() {
lcd.begin(16, 2);
DcsBios::setup();
}
void loop() {
DcsBios::loop();
lcd.setBacklight(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment