       Serial.write('=');
       Serial.println(state);
       m_lastPinState = state;
-      updateJoystick();
-    }
-  }
-}
-
-// map to joystick events
-void digitalPin::updateJoystick() const {
-  uint8_t buttonId = 0x80;
-  switch (m_id) {
-    case 10:
-      buttonId = 6;
-      break;
-    case 11:
-      buttonId = 7;
-      break;
-  }
-  if (buttonId < 0x80) {
-    Joystick.setButton(buttonId,m_lastPinState);
+      // map to joystick events
+      handleSlaveButton(m_id,m_lastPinState);
+    }
   }
 }
 

uint8_t joy2switch = 0;

// almost copy from ksp-gegi-mini!

class digitalPin {
  public:

void updateAnalogs() {
  for (auto &p : analogInPins) {
    p.update();
  }
}

