summaryrefslogtreecommitdiff
path: root/users/riblee
diff options
context:
space:
mode:
authorReibl János Dániel <janos.daniel.reibl@protonmail.com>2020-11-02 22:20:22 +0100
committerGitHub <noreply@github.com>2020-11-02 21:20:22 +0000
commit4ba0cb7ebc7607ba235f34c32a66ccde880ca4a0 (patch)
tree5ce269803a0ad3aa29a947e4615c5585fabe13b8 /users/riblee
parent4b839db3841f001f78291373b2b6c3eca34582ed (diff)
Add OLED support for Riblee F411 (#10778)
* Add OLED support for Riblee F422 * Fix typo
Diffstat (limited to 'users/riblee')
-rw-r--r--users/riblee/riblee.c64
-rw-r--r--users/riblee/riblee.h6
2 files changed, 68 insertions, 2 deletions
diff --git a/users/riblee/riblee.c b/users/riblee/riblee.c
index e1fe607ef2..6e548f1d8d 100644
--- a/users/riblee/riblee.c
+++ b/users/riblee/riblee.c
@@ -15,6 +15,8 @@
*/
#include "riblee.h"
+#include "raw_hid.h"
+#include <string.h>
const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT);
@@ -150,6 +152,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
+ case HUNGARIAN:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(_HUNGARIAN);
+ }
+ return false;
+ break;
case BACKLIT:
if (record->event.pressed) {
register_code(keycode_config(KC_LGUI));
@@ -164,3 +172,59 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return true;
};
+
+#ifdef OLED_DRIVER_ENABLE
+
+static char receive_buffer[128] = {};
+static uint8_t receive_buffer_length = 0;
+
+void oled_task_user(void) {
+ // Keyboard Layer Status
+ oled_write_P(PSTR("Layer: "), false);
+
+ switch (get_highest_layer(layer_state)) {
+ case _QWERTY:
+ oled_write_P(PSTR("Default\n"), false);
+ break;
+ case _LOWER:
+ oled_write_P(PSTR("Lower\n"), false);
+ break;
+ case _RAISE:
+ oled_write_P(PSTR("Raise\n"), false);
+ break;
+ case _ADJUST:
+ oled_write_P(PSTR("Adjust\n"), false);
+ break;
+ default:
+ oled_write_P(PSTR("Undefined\n"), false);
+ }
+
+ // Print string received via HID RAW
+ oled_write_ln(receive_buffer, false);
+}
+
+#ifdef RAW_ENABLE
+
+void raw_hid_receive(uint8_t *data, uint8_t length) {
+
+ // Append data to receive_buffer, without the first byte
+ memcpy(receive_buffer + receive_buffer_length, data + 1, length - 1);
+ receive_buffer_length += (length - 1);
+
+ // First byte indicate if we will recive more package for the current string
+ // If it's 1 then this was the last package and we can reset the offset
+ if (data[0] == 1) {
+ // Reset the offset for memcpy to the begining of our buffer
+ receive_buffer_length = 0;
+ }
+
+ // Reset the offset to prevent overwriting memory outside of the buffer
+ if (receive_buffer_length + 32 >= 128) {
+ receive_buffer_length = 0;
+ }
+
+}
+
+#endif
+
+#endif \ No newline at end of file
diff --git a/users/riblee/riblee.h b/users/riblee/riblee.h
index bdaa9f3211..a4038765a6 100644
--- a/users/riblee/riblee.h
+++ b/users/riblee/riblee.h
@@ -18,8 +18,9 @@
#include QMK_KEYBOARD_H
-enum preonic_layers {
+enum layer_names {
_QWERTY,
+ _HUNGARIAN,
_COLEMAK,
_DVORAK,
_LOWER,
@@ -27,8 +28,9 @@ enum preonic_layers {
_ADJUST
};
-enum preonic_keycodes {
+enum custom_keycodes {
QWERTY = SAFE_RANGE,
+ HUNGARIAN,
COLEMAK,
DVORAK,
BACKLIT