diff --git a/keybon companion/KeybonCompanion.csproj b/keybon companion/KeybonCompanion.csproj
deleted file mode 100644
index 7ea0b15..0000000
--- a/keybon companion/KeybonCompanion.csproj
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {F6A8448D-F8E4-45A1-9616-4F1DE79CB94E}
- WinExe
- KeybonCompanion
- Keybon Companion
- v4.7.2
- 512
- true
- true
- false
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
- favicon.ico
-
-
- false
-
-
- MacroBoardManager.Program
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- AppSelect.cs
-
-
- Form
-
-
- MainWindow.cs
-
-
-
-
- AppSelect.cs
-
-
- MainWindow.cs
-
-
- PublicResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4.7.2 %28x86 und x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/keybon companion/MainWindow.cs b/keybon companion/MainWindow.cs
index ea5745e..e922e82 100644
--- a/keybon companion/MainWindow.cs
+++ b/keybon companion/MainWindow.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
@@ -16,9 +16,10 @@
namespace keybon
{
-
+
public partial class MainWindow : Form
{
+ private NotifyIcon notifyIcon; // Hinzugefügt: NotifyIcon für Systemtray
String portName = "COM14";
public SerialPort _serialPort;
public ScreenLayout[] Layouts = new ScreenLayout[8];
@@ -75,7 +76,7 @@ public int CurrentLayout
public String CurrentApp
{
get { return currentApp; }
- set //respond to change of currentApp
+ set // respond to change of currentApp
{
if (!value.Equals(currentApp) && !value.Equals("keybon companion"))
{
@@ -93,7 +94,8 @@ public String CurrentApp
}
}
}
- public void addAppSelection(String newApp) //for passing data from AppSelect
+
+ public void addAppSelection(String newApp) // for passing data from AppSelect
{
Layouts[CurrentLayout].Apps.Add(newApp);
listBox1.DataSource = null;
@@ -103,6 +105,22 @@ public void addAppSelection(String newApp) //for passing data from AppSelect
public MainWindow()
{
InitializeComponent();
+
+ // Verhindert Anzeige in der Taskleiste
+ this.ShowInTaskbar = false;
+
+ // Systemtray-Icon initialisieren
+ notifyIcon = new NotifyIcon
+ {
+ Icon = new Icon("path-to-icon.ico"), // Pfad zu deinem Icon
+ Visible = true,
+ Text = "Keybon Companion"
+ };
+ notifyIcon.MouseDoubleClick += NotifyIcon_MouseDoubleClick;
+
+ // Minimierungsereignis registrieren
+ this.Resize += MainWindow_Resize;
+
pictureBox01.AllowDrop = true;
pictureBox02.AllowDrop = true;
pictureBox03.AllowDrop = true;
@@ -111,7 +129,7 @@ public MainWindow()
pictureBox06.AllowDrop = true;
pictureBox07.AllowDrop = true;
pictureBox08.AllowDrop = true;
- pictureBox09.AllowDrop = true;
+ pictureBox09.AllowDrop = true;
for (int i = 0; i < Layouts.Length; i++)
{
@@ -133,19 +151,34 @@ public MainWindow()
comboBox2.DataSource = ports;
if (ports.Contains(portName))
{
- comboBox2.SelectedItem = portName;
+ comboBox2.SelectedItem = portName;
try
{
_serialPort.Open();
}
catch { }
- }
+ }
_serialPort.DataReceived += portDataReceived;
- Timer timer1 = new Timer{ Interval = 250 };
+ Timer timer1 = new Timer { Interval = 250 };
timer1.Enabled = true;
- timer1.Tick += new System.EventHandler(OnTimerEvent);
+ timer1.Tick += new EventHandler(OnTimerEvent);
+ }
+
+ private void MainWindow_Resize(object sender, EventArgs e)
+ {
+ if (this.WindowState == FormWindowState.Minimized)
+ {
+ this.Hide(); // Fenster ausblenden
+ notifyIcon.ShowBalloonTip(1000, "Keybon Companion", "Das Programm wurde in den Hintergrund verschoben.", ToolTipIcon.Info);
+ }
+ }
+
+ private void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
+ {
+ this.Show();
+ this.WindowState = FormWindowState.Normal;
}
private void portDataReceived(object sender, EventArgs args)
diff --git a/keybon companion/keybon companion.csproj b/keybon companion/keybon companion.csproj
index 6b4b700..76a0b21 100644
--- a/keybon companion/keybon companion.csproj
+++ b/keybon companion/keybon companion.csproj
@@ -1,127 +1,21 @@
-
-
-
+
+
- Debug
- AnyCPU
- {F6A8448D-F8E4-45A1-9616-4F1DE79CB94E}
WinExe
+ net6.0-windows
+ true
keybon
keybon companion
- v4.7.2
+ favicon.ico
512
- true
- true
- false
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
+ false
AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
+ Windows
+ CA1416
-
- favicon.ico
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Form
-
-
- AppSelect.cs
-
-
- Form
-
-
- MainWindow.cs
-
-
-
-
- AppSelect.cs
-
-
- MainWindow.cs
-
-
- PublicResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- True
- Resources.resx
- True
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
- True
- Settings.settings
- True
-
-
-
-
-
-
-
- False
- Microsoft .NET Framework 4.7.2 %28x86 und x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
+
-
+
-
-
\ No newline at end of file
+
+
diff --git a/keybon/keybon.ino b/keybon/keybon.ino
index 1208f5e..8cb5cba 100644
--- a/keybon/keybon.ino
+++ b/keybon/keybon.ino
@@ -11,318 +11,136 @@ HIDKeyboard Keyboard(HID);
HIDConsumer Consumer(HID);
USBCompositeSerial CompositeSerial;
-
#define PRODUCT_ID 0x29
-#define SW01 PA3
-#define SW02 PB0
-#define SW03 PB12
-#define SW04 PA15
-#define SW05 PB11
-#define SW06 PA9
-#define SW07 PA14
-#define SW08 PB10
-#define SW09 PA8
+// Pin-Konfigurationen
+const uint8_t switchPins[] = {PA3, PB0, PB12, PA15, PB11, PA9, PA14, PB10, PA8};
+const uint8_t oledCSPins[] = {PB5, PA4, PB13, PB4, PA6, PB14, PB3, PB1, PB15};
-#define OLED_MOSI PA7
-#define OLED_CLK PA5
-#define OLED_DC PA2
-#define OLED_CS01 PB5
-#define OLED_CS02 PA4
-#define OLED_CS03 PB13
-#define OLED_CS04 PB4
-#define OLED_CS05 PA6
-#define OLED_CS06 PB14
-#define OLED_CS07 PB3
-#define OLED_CS08 PB1
-#define OLED_CS09 PB15
+#define OLED_MOSI PA7
+#define OLED_CLK PA5
+#define OLED_DC PA2
#define OLED_RESET PA1
-Adafruit_SSD1306 OLED01(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS01);
-Adafruit_SSD1306 OLED02(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS02);
-Adafruit_SSD1306 OLED03(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS03);
-Adafruit_SSD1306 OLED04(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS04);
-Adafruit_SSD1306 OLED05(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS05);
-Adafruit_SSD1306 OLED06(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS06);
-Adafruit_SSD1306 OLED07(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS07);
-Adafruit_SSD1306 OLED08(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS08);
-Adafruit_SSD1306 OLED09(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS09);
-
-Button button01(SW01, true, true, 5); //pin, pullup, invert, debounce
-Button button02(SW02, true, true, 5); //pin, pullup, invert, debounce
-Button button03(SW03, true, true, 5); //pin, pullup, invert, debounce
-Button button04(SW04, true, true, 5); //pin, pullup, invert, debounce
-Button button05(SW05, true, true, 5); //pin, pullup, invert, debounce
-Button button06(SW06, true, true, 5); //pin, pullup, invert, debounce
-Button button07(SW07, true, true, 5); //pin, pullup, invert, debounce
-Button button08(SW08, true, true, 5); //pin, pullup, invert, debounce
-Button button09(SW09, true, true, 5); //pin, pullup, invert, debounce
+// Arrays für Buttons und OLEDs
+Button buttons[9];
+Adafruit_SSD1306* oleds[9];
unsigned int cursor = 0;
-
boolean defaultLayoutActive = true;
-
void setup() {
- pinMode(SW01, INPUT_PULLUP);
- pinMode(SW02, INPUT_PULLUP);
- pinMode(SW03, INPUT_PULLUP);
- pinMode(SW04, INPUT_PULLUP);
- pinMode(SW05, INPUT_PULLUP);
- pinMode(SW06, INPUT_PULLUP);
- pinMode(SW07, INPUT_PULLUP);
- pinMode(SW08, INPUT_PULLUP);
- pinMode(SW09, INPUT_PULLUP);
-
+ // Pins initialisieren
+ for (uint8_t i = 0; i < 9; i++) {
+ pinMode(switchPins[i], INPUT_PULLUP);
+ buttons[i] = Button(switchPins[i], true, true, 5);
+ oleds[i] = new Adafruit_SSD1306(128, 48, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, oledCSPins[i]);
+ oleds[i]->begin(SSD1306_SWITCHCAPVCC, 0, i == 0, true); // Reset nur beim ersten Display aktiv
+ oleds[i]->setRotation(0);
+ oleds[i]->clearDisplay();
+ }
+
USBComposite.setProductId(PRODUCT_ID);
HID.registerComponent();
CompositeSerial.registerComponent();
USBComposite.begin();
- OLED01.begin(SSD1306_SWITCHCAPVCC, 0, true, true); // OLEDs share same reset line, o
- OLED01.setRotation(0);
- OLED02.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED02.setRotation(0);
- OLED03.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED03.setRotation(0);
- OLED04.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED04.setRotation(0);
- OLED05.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED05.setRotation(0);
- OLED06.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED06.setRotation(0);
- OLED07.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED07.setRotation(0);
- OLED08.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED08.setRotation(0);
- OLED09.begin(SSD1306_SWITCHCAPVCC, 0, false, true);
- OLED09.setRotation(0);
-
displayContrast(LOW);
-
- OLED01.clearDisplay(); // clears the screen and buffer
- OLED02.clearDisplay();
- OLED03.clearDisplay();
- OLED04.clearDisplay();
- OLED05.clearDisplay();
- OLED06.clearDisplay();
- OLED07.clearDisplay();
- OLED08.clearDisplay();
- OLED09.clearDisplay();
-
- //delay(500);
- CompositeSerial.setTimeout(200);
- OLED01.drawBitmap(32, 0, bmp_mute, 64, 48, WHITE);
- OLED02.drawBitmap(32, 0, bmp_volume_down, 64, 48, WHITE);
- OLED03.drawBitmap(32, 0, bmp_volume_up, 64, 48, WHITE);
- OLED04.drawBitmap(32, 0, bmp_backward, 64, 48, WHITE);
- OLED05.drawBitmap(32, 0, bmp_play, 64, 48, WHITE);
- OLED06.drawBitmap(32, 0, bmp_forward, 64, 48, WHITE);
- OLED07.drawBitmap(32, 0, bmp_explorer, 64, 48, WHITE);
- OLED08.drawBitmap(32, 0, bmp_snapshot, 64, 48, WHITE);
- OLED09.drawBitmap(32, 0, bmp_calc, 64, 48, WHITE);
+ // Standard-Bitmaps setzen
+ const uint8_t* bitmaps[] = {bmp_mute, bmp_volume_down, bmp_volume_up, bmp_backward,
+ bmp_play, bmp_forward, bmp_explorer, bmp_snapshot, bmp_calc};
+ for (uint8_t i = 0; i < 9; i++) {
+ oleds[i]->drawBitmap(32, 0, bitmaps[i], 64, 48, WHITE);
+ }
+
+ CompositeSerial.setTimeout(200);
}
void loop() {
-
- if(button01.wasPressed() or button01.pressedFor(300)){
- if(defaultLayoutActive){
- Consumer.press(HIDConsumer::MUTE);
- Consumer.release();
- }
- else CompositeSerial.print("1");
- }
- if(button02.wasPressed() or button02.pressedFor(300)){
- if(defaultLayoutActive){
- Consumer.press(HIDConsumer::VOLUME_DOWN);
- Consumer.release();
- }
- else CompositeSerial.print("2");
- }
- if(button03.wasPressed() or button03.pressedFor(300)){
- if(defaultLayoutActive){
- Consumer.press(HIDConsumer::VOLUME_UP);
- Consumer.release();
- }
- else CompositeSerial.print("3");
- }
- if(button04.wasPressed() or button04.pressedFor(300)){
- if(defaultLayoutActive){
- Consumer.press(182);
- Consumer.release();
- }
- else CompositeSerial.print("4");
- }
- if(button05.wasPressed() or button05.pressedFor(300)){
- if(defaultLayoutActive){
- Consumer.press(HIDConsumer::PLAY_OR_PAUSE);
- Consumer.release();
+ for (uint8_t i = 0; i < 9; i++) {
+ buttons[i].read();
+ if (buttons[i].wasPressed() || buttons[i].pressedFor(300)) {
+ handleButtonPress(i);
}
- else CompositeSerial.print("5");
}
- if(button06.wasPressed() or button06.pressedFor(300)){
- if(defaultLayoutActive){
- Consumer.press(181);
- Consumer.release();
- }
- else CompositeSerial.print("6");
- }
- if(button07.wasPressed() or button07.pressedFor(300)){
- if(defaultLayoutActive){
- Keyboard.press(KEY_LEFT_GUI);
- Keyboard.press('e');
- Keyboard.release('e');
- Keyboard.release(KEY_LEFT_GUI);
- }
- else CompositeSerial.print("7");
- }
- if(button08.wasPressed() or button08.pressedFor(300)){
- if(defaultLayoutActive){
- Keyboard.press(KEY_LEFT_GUI);
- Keyboard.press(KEY_LEFT_SHIFT);
- Keyboard.press('s');
- Keyboard.release('s');
- Keyboard.release(KEY_LEFT_SHIFT);
- Keyboard.release(KEY_LEFT_GUI);
- }
- else CompositeSerial.print("8");
+
+ handleSerialInput();
+
+ for (uint8_t i = 0; i < 9; i++) {
+ oleds[i]->display();
}
- if(button09.wasPressed() or button09.pressedFor(300)){
- if(defaultLayoutActive){
- Keyboard.press(KEY_LEFT_GUI);
- Keyboard.press('r');
- Keyboard.release('r');
- Keyboard.release(KEY_LEFT_GUI);
- Keyboard.print("calc");
- Keyboard.press('\n');
- Keyboard.release('\n');
+}
+
+void handleButtonPress(uint8_t buttonIndex) {
+ if (defaultLayoutActive) {
+ switch (buttonIndex) {
+ case 0: Consumer.press(HIDConsumer::MUTE); break;
+ case 1: Consumer.press(HIDConsumer::VOLUME_DOWN); break;
+ case 2: Consumer.press(HIDConsumer::VOLUME_UP); break;
+ case 3: Consumer.press(182); break;
+ case 4: Consumer.press(HIDConsumer::PLAY_OR_PAUSE); break;
+ case 5: Consumer.press(181); break;
+ case 6: sendKeyboardShortcut(KEY_LEFT_GUI, 'e'); break;
+ case 7: sendKeyboardShortcut(KEY_LEFT_GUI | KEY_LEFT_SHIFT, 's'); break;
+ case 8: openCalculator(); break;
}
- else CompositeSerial.print("9");
+ Consumer.release();
+ } else {
+ CompositeSerial.print(buttonIndex + 1);
}
+}
-
- while (CompositeSerial.available() > 0){
- byte command = CompositeSerial.read();
- if(command >= '0' && command <= '8'){
+void handleSerialInput() {
+ while (CompositeSerial.available() > 0) {
+ char command = CompositeSerial.read();
+ if (command >= '0' && command <= '8') {
defaultLayoutActive = false;
- CompositeSerial.readBytes(bmp_swap,384);
- if(command == '0'){
- OLED01.clearDisplay();
- OLED01.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '1'){
- OLED02.clearDisplay();
- OLED02.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '2'){
- OLED03.clearDisplay();
- OLED03.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '3'){
- OLED04.clearDisplay();
- OLED04.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '4'){
- OLED05.clearDisplay();
- OLED05.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '5'){
- OLED06.clearDisplay();
- OLED06.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '6'){
- OLED07.clearDisplay();
- OLED07.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '7'){
- OLED08.clearDisplay();
- OLED08.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- if(command == '8'){
- OLED09.clearDisplay();
- OLED09.drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
- }
- }
- else if(command == 'D'){ //fallback to internal Layout
- defaultLayoutActive = true;
- OLED01.clearDisplay(); // clears the screen and buffer
- OLED02.clearDisplay();
- OLED03.clearDisplay();
- OLED04.clearDisplay();
- OLED05.clearDisplay();
- OLED06.clearDisplay();
- OLED07.clearDisplay();
- OLED08.clearDisplay();
- OLED09.clearDisplay();
- OLED01.drawBitmap(32, 0, bmp_mute, 64, 48, WHITE);
- OLED02.drawBitmap(32, 0, bmp_volume_down, 64, 48, WHITE);
- OLED03.drawBitmap(32, 0, bmp_volume_up, 64, 48, WHITE);
- OLED04.drawBitmap(32, 0, bmp_backward, 64, 48, WHITE);
- OLED05.drawBitmap(32, 0, bmp_play, 64, 48, WHITE);
- OLED06.drawBitmap(32, 0, bmp_forward, 64, 48, WHITE);
- OLED07.drawBitmap(32, 0, bmp_explorer, 64, 48, WHITE);
- OLED08.drawBitmap(32, 0, bmp_snapshot, 64, 48, WHITE);
- OLED09.drawBitmap(32, 0, bmp_calc, 64, 48, WHITE);
- }
- else if(command == 'A'){ //Answer to call
- CompositeSerial.print("a");
- }
- else if(command == 'B'){ //high brightness
+ CompositeSerial.readBytes(bmp_swap, 384);
+ uint8_t displayIndex = command - '0';
+ oleds[displayIndex]->clearDisplay();
+ oleds[displayIndex]->drawBitmap(32, 0, bmp_swap, 64, 48, WHITE);
+ } else if (command == 'D') {
+ resetToDefaultLayout();
+ } else if (command == 'B') {
displayContrast(HIGH);
- }
- else if(command == 'b'){ //low brightness
+ } else if (command == 'b') {
displayContrast(LOW);
}
}
-
- //OLED09.setCursor(32, 10);
- //OLED09.setTextColor(WHITE);
- //OLED09.setTextSize(1);
- //OLED09.print(cursor);
+}
- OLED01.display();
- OLED02.display();
- OLED03.display();
- OLED04.display();
- OLED05.display();
- OLED06.display();
- OLED07.display();
- OLED08.display();
- OLED09.display();
+void resetToDefaultLayout() {
+ defaultLayoutActive = true;
+ const uint8_t* bitmaps[] = {bmp_mute, bmp_volume_down, bmp_volume_up, bmp_backward,
+ bmp_play, bmp_forward, bmp_explorer, bmp_snapshot, bmp_calc};
+ for (uint8_t i = 0; i < 9; i++) {
+ oleds[i]->clearDisplay();
+ oleds[i]->drawBitmap(32, 0, bitmaps[i], 64, 48, WHITE);
+ }
+}
- button01.read();
- button02.read();
- button03.read();
- button04.read();
- button05.read();
- button06.read();
- button07.read();
- button08.read();
- button09.read();
+void sendKeyboardShortcut(uint8_t modifiers, char key) {
+ Keyboard.press(modifiers);
+ Keyboard.press(key);
+ Keyboard.release(key);
+ Keyboard.release(modifiers);
+}
+void openCalculator() {
+ Keyboard.press(KEY_LEFT_GUI);
+ Keyboard.press('r');
+ Keyboard.release('r');
+ Keyboard.release(KEY_LEFT_GUI);
+ Keyboard.print("calc");
+ Keyboard.press('\n');
+ Keyboard.release('\n');
}
-void displayContrast(boolean contrast){
- byte contrastSetting = 0x35;
- if(contrast == HIGH) contrastSetting = 0x7F;
-
- OLED01.ssd1306_command(SSD1306_SETCONTRAST);
- OLED01.ssd1306_command(contrastSetting);
- OLED02.ssd1306_command(SSD1306_SETCONTRAST);
- OLED02.ssd1306_command(contrastSetting);
- OLED03.ssd1306_command(SSD1306_SETCONTRAST);
- OLED03.ssd1306_command(contrastSetting);
- OLED04.ssd1306_command(SSD1306_SETCONTRAST);
- OLED04.ssd1306_command(contrastSetting);
- OLED05.ssd1306_command(SSD1306_SETCONTRAST);
- OLED05.ssd1306_command(contrastSetting);
- OLED06.ssd1306_command(SSD1306_SETCONTRAST);
- OLED06.ssd1306_command(contrastSetting);
- OLED07.ssd1306_command(SSD1306_SETCONTRAST);
- OLED07.ssd1306_command(contrastSetting);
- OLED08.ssd1306_command(SSD1306_SETCONTRAST);
- OLED08.ssd1306_command(contrastSetting);
- OLED09.ssd1306_command(SSD1306_SETCONTRAST);
- OLED09.ssd1306_command(contrastSetting);
+void displayContrast(boolean contrast) {
+ uint8_t contrastSetting = contrast == HIGH ? 0x7F : 0x35;
+ for (uint8_t i = 0; i < 9; i++) {
+ oleds[i]->ssd1306_command(SSD1306_SETCONTRAST);
+ oleds[i]->ssd1306_command(contrastSetting);
+ }
}