From ec8c1e05af7871b160e1f6c330dc5f7f73d74c43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Reibl=20J=C3=A1nos=20D=C3=A1niel?=
 <janos.daniel.reibl@protonmail.com>
Date: Sun, 24 Oct 2021 00:20:18 +0200
Subject: [PATCH] [Keymap] Add logo to riblee userspace (#14875)

---
 users/riblee/riblee.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/users/riblee/riblee.c b/users/riblee/riblee.c
index 6f608f94f5..04e37b2428 100644
--- a/users/riblee/riblee.c
+++ b/users/riblee/riblee.c
@@ -189,8 +189,29 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 
 static char receive_buffer[128] = {};
 static uint8_t receive_buffer_length = 0;
+uint16_t startup_timer;
 
-void oled_task_user(void) {
+oled_rotation_t oled_init_user(oled_rotation_t rotation) {
+    startup_timer = timer_read();
+    return rotation;
+}
+
+static void render_logo(void) {
+    static const char PROGMEM raw_logo[] = {
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0, 96, 96, 96,240,248,255, 63, 56,255,255,248, 63, 63,248,255,255, 56, 63,255,248,240, 96, 96, 96,  0,  0,  0,  0,  0,252,254, 38, 54, 60,  8,240,152,152,248,240, 24,248,224,248,120,224,240,120, 96,248,248,248,248, 32,248,248, 24, 24,240,248,248,248,240,240,248,152,152,254,254,  0,  0,  0,254,254,152,248,240, 24,248,224,240,120,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,219,219,219,255,255,255,240,192,143,159, 63,  0,  0, 63,159,143,192,240,255,255,255,219,219,219,  0,  0,  0,  0,  0,192,225,112, 48, 48, 48,112,225,129,  1,240,240,240,193,  1,  0,  1,193,240,240,241,  1,  1,241,240,193,225,112, 48,  0,  1,  1,  1,  1,240,241, 49, 49, 49,  0,240,240,  0,129,193,129,193,192,  0,196,135,193,192,128,128,192,192,128,  0,  0,192,128,  0,128,192,128,  0,  0,192,192,128,128,192,192,192,128,  0,128,192,128,192,192,  0,128,192,192,192,128,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  6,  6,  6, 15, 31,255,255, 31,255,255, 31,252,252, 31,255,255, 31,255,255, 31, 15,  6,  6,  6,  0,  0,  0,  0,  0, 15, 31, 56, 48, 48, 48, 60,127,103, 96, 63, 63,  0,  7, 63, 56, 31,  7,  0, 63, 63,  0,  0, 63, 63,  7, 30, 60, 48,  0,  0,  0,  0,  0, 63, 31,  3,  3,  3,  0, 63, 63,  0, 31, 63,  1,  0,  0,  0, 63, 31,  0,  1, 63, 63,  0,  0, 63, 63,  0,  7, 63, 60, 63,  7, 31, 60, 63, 15,  0, 28, 60, 54, 54, 63, 63,  0, 63, 63,  1,  0,  0, 31, 63, 54, 54, 55, 55,  2,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,128,128,128,128,128,128,  0,  0,192,192,192,  0,192,192,192,  0,  0,  0,  0,  0,  0,192,192,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255, 29,127,255,247,224,  0,254,254,254,  0,255,255,255,198,254,254,254,  0,  0,255,255,255,124,254,254,214,214,222,222, 92,124,254,254,214,214,222,222, 92,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    };
+
+    oled_write_raw_P(raw_logo, sizeof(raw_logo));
+}
+
+static void render_info(void) {
     // Keyboard Layer Status
     oled_write_P(PSTR("Layer: "), false);
 
@@ -227,6 +248,19 @@ void oled_task_user(void) {
     oled_write_ln(receive_buffer, false);
 }
 
+void oled_task_user(void) {
+    static bool finished_timer = false;
+    if (!finished_timer && (timer_elapsed(startup_timer) < 1000)) {
+        render_logo();
+    } else {
+        if (!finished_timer) {
+            oled_clear();
+            finished_timer = true;
+        }
+        render_info();
+    }
+}
+
 #ifdef RAW_ENABLE
 
 void raw_hid_receive(uint8_t *data, uint8_t length) {