summaryrefslogtreecommitdiff
path: root/keyboards/hadron/ver2/ver2.c
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-09-13 14:59:53 +0100
committerGitHub <noreply@github.com>2021-09-13 14:59:53 +0100
commitcb4346edb74b415928e3274d166802f5afd3004d (patch)
treead9bb2c4bfbae0686a6c56184f312a82592107f3 /keyboards/hadron/ver2/ver2.c
parent8a3f97b20fe532ee9b085e8ba407bfcc8fac3504 (diff)
Migrate hadron away from QWIIC_DRIVERS (#14415)
Diffstat (limited to 'keyboards/hadron/ver2/ver2.c')
-rw-r--r--keyboards/hadron/ver2/ver2.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/keyboards/hadron/ver2/ver2.c b/keyboards/hadron/ver2/ver2.c
index f00b4f26d6..ca13427497 100644
--- a/keyboards/hadron/ver2/ver2.c
+++ b/keyboards/hadron/ver2/ver2.c
@@ -1 +1,65 @@
#include "ver2.h"
+
+#ifdef OLED_ENABLE
+__attribute__ ((weak))
+oled_rotation_t oled_init_user(oled_rotation_t rotation) {
+ return OLED_ROTATION_180;
+}
+
+__attribute__ ((weak))
+void oled_task_user(void) {
+ oled_write_P(PSTR("LAYER "), false);
+ oled_write_char(get_highest_layer(layer_state) + 0x30, true);
+
+ led_t led_state = host_keyboard_led_state();
+ oled_set_cursor(18, 0);
+ oled_write_P(PSTR("NUM"), led_state.num_lock);
+ oled_set_cursor(18, 1);
+ oled_write_P(PSTR("CAP"), led_state.caps_lock);
+ oled_set_cursor(18, 2);
+ oled_write_P(PSTR("SCR"), led_state.scroll_lock);
+
+ uint8_t mod_state = get_mods();
+ oled_set_cursor(10, 3);
+ oled_write_P(PSTR("S"), mod_state & MOD_MASK_SHIFT);
+ oled_advance_char();
+ oled_write_P(PSTR("C"), mod_state & MOD_MASK_CTRL);
+ oled_advance_char();
+ oled_write_P(PSTR("A"), mod_state & MOD_MASK_ALT);
+ oled_advance_char();
+ oled_write_P(PSTR("G"), mod_state & MOD_MASK_GUI);
+ oled_advance_char();
+
+/* Matrix display is 12 x 12 pixels */
+#define MATRIX_DISPLAY_X 5
+#define MATRIX_DISPLAY_Y 18
+
+ // matrix
+ for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
+ for (uint8_t y = 0; y < MATRIX_COLS; y++) {
+ bool on = (matrix_get_row(x) & (1 << y)) > 0;
+ oled_write_pixel(MATRIX_DISPLAY_X + y + 2, MATRIX_DISPLAY_Y + x + 2, on);
+ }
+ }
+
+ // outline
+ for (uint8_t x = 0; x < 19; x++) {
+ oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y, true);
+ oled_write_pixel(MATRIX_DISPLAY_X + x, MATRIX_DISPLAY_Y + 9, true);
+ }
+ for (uint8_t y = 0; y < 9; y++) {
+ oled_write_pixel(MATRIX_DISPLAY_X, MATRIX_DISPLAY_Y+y, true);
+ oled_write_pixel(MATRIX_DISPLAY_X + 19, MATRIX_DISPLAY_Y+y, true);
+ }
+
+ // oled location
+ for (uint8_t x = 0; x < 3; x++) {
+ oled_write_pixel(MATRIX_DISPLAY_X + 14 + x, MATRIX_DISPLAY_Y + 2, true);
+ }
+
+ // bodge for layer number left hand side
+ for (uint8_t y = 0; y < 8; y++) {
+ oled_write_pixel(35, 0 + y, true);
+ }
+}
+#endif