summaryrefslogtreecommitdiff
path: root/keyboards/helix/rev2
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2021-09-17 18:39:16 -0700
committerDrashna Jael're <drashna@live.com>2021-09-17 18:39:16 -0700
commitc14abd8c14f512ca160f99a942734b0f652a453c (patch)
tree8a944dd15388348b4a7f8c79f5e6bf9061289d83 /keyboards/helix/rev2
parentefde8d657ac43d7b007437caa72dee96e149e94a (diff)
parent7c09b2667b49839d6c1a27133751d43642149a84 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'keyboards/helix/rev2')
-rw-r--r--keyboards/helix/rev2/keymaps/five_rows/config.h6
-rw-r--r--keyboards/helix/rev2/keymaps/five_rows/matrix_output_unselect_delay.c31
-rw-r--r--keyboards/helix/rev2/keymaps/five_rows/oled_display.c92
-rw-r--r--keyboards/helix/rev2/keymaps/five_rows/rules.mk13
4 files changed, 128 insertions, 14 deletions
diff --git a/keyboards/helix/rev2/keymaps/five_rows/config.h b/keyboards/helix/rev2/keymaps/five_rows/config.h
index b9961f5c48..e1c124f419 100644
--- a/keyboards/helix/rev2/keymaps/five_rows/config.h
+++ b/keyboards/helix/rev2/keymaps/five_rows/config.h
@@ -29,7 +29,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
see tmk_core/common/action_tapping.c */
#undef OLED_UPDATE_INTERVAL
-#define OLED_UPDATE_INTERVAL 50
+#ifdef DEBUG_MATRIX_SCAN_RATE
+# define OLED_UPDATE_INTERVAL 500
+#else
+# define OLED_UPDATE_INTERVAL 50
+#endif
// place overrides here
diff --git a/keyboards/helix/rev2/keymaps/five_rows/matrix_output_unselect_delay.c b/keyboards/helix/rev2/keymaps/five_rows/matrix_output_unselect_delay.c
new file mode 100644
index 0000000000..a093afe0a4
--- /dev/null
+++ b/keyboards/helix/rev2/keymaps/five_rows/matrix_output_unselect_delay.c
@@ -0,0 +1,31 @@
+/* Copyright 2021 mtei
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include QMK_KEYBOARD_H
+
+void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
+ /* If none of the keys are pressed,
+ * there is no need to wait for time for the next line. */
+ if (key_pressed) {
+# ifdef MATRIX_IO_DELAY
+# if MATRIX_IO_DELAY > 0
+ wait_us(MATRIX_IO_DELAY);
+# endif
+# else
+ wait_us(30);
+# endif
+ }
+}
diff --git a/keyboards/helix/rev2/keymaps/five_rows/oled_display.c b/keyboards/helix/rev2/keymaps/five_rows/oled_display.c
index 090e8aaec3..fcbd81c9b6 100644
--- a/keyboards/helix/rev2/keymaps/five_rows/oled_display.c
+++ b/keyboards/helix/rev2/keymaps/five_rows/oled_display.c
@@ -64,6 +64,55 @@ void matrix_update(struct CharacterMatrix *dest,
}
# endif
+static char *sprint_decimal(char *buf, int data) {
+ if (data > 9) {
+ buf = sprint_decimal(buf, data/10);
+ }
+ *buf++ = "0123456789"[data%10];
+ *buf = '\0';
+ return buf;
+}
+
+static char *sprint_hex(char *buf, uint32_t data) {
+ if (data > 0xf) {
+ buf = sprint_hex(buf, data/0x10);
+ }
+ *buf++ = "0123456789abcdef"[data & 0xf];
+ *buf = '\0';
+ return buf;
+}
+
+char *sprints(char *buf, char *src) {
+ while (*src) {
+ *buf++ = *src++;
+ }
+ *buf = '\0';
+ return buf;
+}
+
+char *sprintx(char *buf, char *leadstr, uint32_t data) {
+ buf = sprints(buf, leadstr);
+ buf = sprint_hex(buf, data);
+ return buf;
+}
+
+char *sprintd(char *buf, char *leadstr, int data) {
+ buf = sprints(buf, leadstr);
+ buf = sprint_decimal(buf, data);
+ return buf;
+}
+
+char *sprint2d(char *buf, char *leadstr, int data) {
+ buf = sprints(buf, leadstr);
+ if (data > 99) {
+ return sprint_decimal(buf, data);
+ }
+ if (data < 10) {
+ *buf++ = ' ';
+ }
+ return sprint_decimal(buf, data);
+}
+
# ifdef SSD1306OLED
static void render_logo(struct CharacterMatrix *matrix) {
# else
@@ -76,20 +125,35 @@ static void render_logo(void) {
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
0};
oled_write_P(helix_logo, false);
-# ifdef RGBLIGHT_ENABLE
char buf[30];
+ char *bufp;
+# ifdef RGBLIGHT_ENABLE
if (RGBLIGHT_MODES > 1 && rgblight_is_enabled()) {
- snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
- rgblight_get_mode(),
- rgblight_get_hue()/RGBLIGHT_HUE_STEP,
- rgblight_get_sat()/RGBLIGHT_SAT_STEP,
- rgblight_get_val()/RGBLIGHT_VAL_STEP);
+ bufp = sprint2d(buf, " LED ", rgblight_get_mode());
+# ifdef DEBUG_MATRIX_SCAN_RATE
+ bufp = sprintd(bufp, " scan:", get_matrix_scan_rate());
+# else
+ bufp = sprintd(bufp, ": ", rgblight_get_hue()/RGBLIGHT_HUE_STEP);
+ bufp = sprintd(bufp, ",", rgblight_get_sat()/RGBLIGHT_SAT_STEP);
+ bufp = sprintd(bufp, ",", rgblight_get_val()/RGBLIGHT_VAL_STEP);
+ bufp = sprints(bufp, " ");
+# endif
oled_write(buf, false);
# ifndef SSD1306OLED
} else {
+# ifdef DEBUG_MATRIX_SCAN_RATE
+ bufp = sprintd(buf, " scan:", get_matrix_scan_rate());
+ oled_write(buf, false);
+# endif
oled_write_P( PSTR("\n"), false);
# endif
}
+# else
+# ifdef DEBUG_MATRIX_SCAN_RATE
+ bufp = sprintd(buf, " scan:", get_matrix_scan_rate());
+ bufp = sprints(bufp, " ");
+ oled_write(buf, false);
+# endif
# endif
}
@@ -142,6 +206,11 @@ void render_status(void) {
int name_num;
uint32_t lstate;
oled_write_P(layer_names[current_default_layer], false);
+# ifdef DEBUG_MATRIX_SCAN_RATE
+ char buf[16];
+ sprintd(buf, " scan:", get_matrix_scan_rate());
+ oled_write(buf, false);
+# endif
oled_write_P(PSTR("\n"), false);
for (lstate = layer_state, name_num = 0;
lstate && name_num < sizeof(layer_names)/sizeof(char *);
@@ -152,14 +221,13 @@ void render_status(void) {
}
}
}
+ oled_write_P(PSTR("\n"), false);
// Host Keyboard LED Status
- char led[40];
- snprintf(led, sizeof(led), "\n%s %s %s",
- (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
- (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
- (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
- oled_write(led, false);
+ led_t led_state = host_keyboard_led_state();
+ oled_write_P(led_state.num_lock ? PSTR("NUMLOCK ") : PSTR(" "), false);
+ oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
+ oled_write_P(led_state.scroll_lock ? PSTR("SCLK ") : PSTR(" "), false);
}
# ifdef SSD1306OLED
diff --git a/keyboards/helix/rev2/keymaps/five_rows/rules.mk b/keyboards/helix/rev2/keymaps/five_rows/rules.mk
index 5f7e4668fc..8a091605ac 100644
--- a/keyboards/helix/rev2/keymaps/five_rows/rules.mk
+++ b/keyboards/helix/rev2/keymaps/five_rows/rules.mk
@@ -25,9 +25,11 @@ HELIX_ROWS = 5 # Helix Rows is 4 or 5
# LED_ANIMATIONS = yes # LED animations
# IOS_DEVICE_ENABLE = no # connect to IOS device (iPad,iPhone)
+CUSTOM_DELAY = yes
+
ifneq ($(strip $(HELIX)),)
define KEYMAP_OPTION_PARSE
- # parse 'dispoff', 'consloe', 'na', 'ani', 'mini-ani'
+ # parse 'dispoff', 'consloe', 'na', 'ani', 'mini-ani', 'scan-api',
$(if $(SHOW_PARCE),$(info parse -$1-)) #debug
ifeq ($(strip $1),dispoff)
OLED_ENABLE = no
@@ -72,6 +74,11 @@ ifneq ($(strip $(HELIX)),)
ifneq ($(filter nolto no-lto no_lto,$(strip $1)),)
LTO_ENABLE = no
endif
+ ifeq ($(strip $1),scan-api)
+ # use DEBUG_MATRIX_SCAN_RATE
+ # see docs/newbs_testing_debugging.md
+ DEBUG_MATRIX_SCAN_RATE_ENABLE = api
+ endif
endef # end of KEYMAP_OPTION_PARSE
COMMA=,
@@ -95,3 +102,7 @@ endif
ifeq ($(strip $(OLED_ENABLE)), yes)
SRC += oled_display.c
endif
+
+ifeq ($(strip $(CUSTOM_DELAY)),yes)
+ SRC += matrix_output_unselect_delay.c
+endif