summaryrefslogtreecommitdiff
path: root/keyboards/converter/usb_usb/custom_matrix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/converter/usb_usb/custom_matrix.cpp')
-rw-r--r--keyboards/converter/usb_usb/custom_matrix.cpp40
1 files changed, 16 insertions, 24 deletions
diff --git a/keyboards/converter/usb_usb/custom_matrix.cpp b/keyboards/converter/usb_usb/custom_matrix.cpp
index 00b5bc5053..a92feeb6c1 100644
--- a/keyboards/converter/usb_usb/custom_matrix.cpp
+++ b/keyboards/converter/usb_usb/custom_matrix.cpp
@@ -58,36 +58,31 @@ extern "C" {
*/
#define ROW_MASK 0xF0
#define COL_MASK 0x0F
-#define CODE(row, col) (((row) << 4) | (col))
-#define ROW(code) (((code) & ROW_MASK) >> 4)
-#define COL(code) ((code) & COL_MASK)
-#define ROW_BITS(code) (1 << COL(code))
-
+#define CODE(row, col) (((row) << 4) | (col))
+#define ROW(code) (((code) & ROW_MASK) >> 4)
+#define COL(code) ((code) & COL_MASK)
+#define ROW_BITS(code) (1 << COL(code))
// Integrated key state of all keyboards
static report_keyboard_t local_keyboard_report;
-static bool matrix_is_mod = false;
-
/*
* USB Host Shield HID keyboards
* This supports two cascaded hubs and four keyboards
*/
USB usb_host;
-HIDBoot<HID_PROTOCOL_KEYBOARD> kbd1(&usb_host);
-HIDBoot<HID_PROTOCOL_KEYBOARD> kbd2(&usb_host);
-HIDBoot<HID_PROTOCOL_KEYBOARD> kbd3(&usb_host);
-HIDBoot<HID_PROTOCOL_KEYBOARD> kbd4(&usb_host);
+USBHub hub1(&usb_host);
+USBHub hub2(&usb_host);
+HIDBoot<HID_PROTOCOL_KEYBOARD> kbd1(&usb_host);
+HIDBoot<HID_PROTOCOL_KEYBOARD> kbd2(&usb_host);
+HIDBoot<HID_PROTOCOL_KEYBOARD> kbd3(&usb_host);
+HIDBoot<HID_PROTOCOL_KEYBOARD> kbd4(&usb_host);
KBDReportParser kbd_parser1;
KBDReportParser kbd_parser2;
KBDReportParser kbd_parser3;
KBDReportParser kbd_parser4;
-USBHub hub1(&usb_host);
-USBHub hub2(&usb_host);
-
-extern "C"
-{
+extern "C" {
uint8_t matrix_rows(void) { return MATRIX_ROWS; }
uint8_t matrix_cols(void) { return MATRIX_COLS; }
bool matrix_has_ghost(void) { return false; }
@@ -135,6 +130,7 @@ extern "C"
}
uint8_t matrix_scan(void) {
+ bool changed = false;
static uint16_t last_time_stamp1 = 0;
static uint16_t last_time_stamp2 = 0;
static uint16_t last_time_stamp3 = 0;
@@ -158,15 +154,13 @@ extern "C"
or_report(kbd_parser3.report);
or_report(kbd_parser4.report);
- matrix_is_mod = true;
+ changed = true;
dprintf("state: %02X %02X", local_keyboard_report.mods, local_keyboard_report.reserved);
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
dprintf(" %02X", local_keyboard_report.keys[i]);
}
dprint("\r\n");
- } else {
- matrix_is_mod = false;
}
uint16_t timer;
@@ -189,7 +183,7 @@ extern "C"
}
}
matrix_scan_quantum();
- return 1;
+ return changed;
}
bool matrix_is_on(uint8_t row, uint8_t col) {
@@ -234,13 +228,11 @@ extern "C"
}
}
- void led_set(uint8_t usb_led)
- {
+ void led_set(uint8_t usb_led) {
if (kbd1.isReady()) kbd1.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd2.isReady()) kbd2.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd3.isReady()) kbd3.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd4.isReady()) kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
led_set_kb(usb_led);
}
-
-};
+}