Skip to content

Commit

Permalink
Add OLED logo DP3000 macropad (qmk#21936)
Browse files Browse the repository at this point in the history
  • Loading branch information
depermana12 authored and Karl committed Oct 26, 2023
1 parent d74abf0 commit e207fb0
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 8 deletions.
71 changes: 63 additions & 8 deletions keyboards/dp3000/dp3000.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,75 @@
*/
#include "quantum.h"

bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
#define LOGO_TIMEOUT 3000

static uint32_t logo_timer = 0;
static bool display_logo = true;

void dp3000_logo(void) {
static const char PROGMEM dp3000_logo[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x60, 0x7c, 0x7c, 0x60, 0x60, 0x60, 0x60,
0x7c, 0x7c, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x7c, 0x60, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x86, 0x86, 0x86, 0xff, 0xff, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0xf0, 0xe0,
0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0xf8, 0xf0, 0x00, 0x00, 0xff, 0xff, 0x86, 0x86, 0x86, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0x98, 0x98, 0xf8, 0xf0, 0x00, 0xf0, 0xf8, 0x18, 0x18, 0xf8, 0xf0,
0x00, 0xf0, 0xf8, 0x18, 0x18, 0xf8, 0xf0, 0x00, 0xf0, 0xf8, 0x18, 0x18, 0xf8, 0xf0, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x61, 0x61, 0x61, 0xff, 0xff, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x0f, 0x07,
0x00, 0x00, 0x1f, 0x1f, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0xff, 0xff, 0x61, 0x61, 0x61, 0x00,
0x00, 0x00, 0x00, 0x18, 0x18, 0x19, 0x19, 0x1f, 0x0f, 0x00, 0x0f, 0x1f, 0x18, 0x18, 0x1f, 0x0f,
0x00, 0x0f, 0x1f, 0x18, 0x18, 0x1f, 0x0f, 0x00, 0x0f, 0x1f, 0x18, 0x18, 0x1f, 0x0f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x06, 0x3e, 0x3e, 0x06, 0x06, 0x06, 0x06,
0x3e, 0x3e, 0x06, 0x06, 0x06, 0x06, 0x3e, 0x3e, 0x06, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
oled_write_raw_P(dp3000_logo, sizeof(dp3000_logo));
}

void default_status(void) {
oled_set_cursor(0, 0);
oled_write_P(PSTR("LAYER: "), false);
oled_write_char('0' + get_highest_layer(layer_state), false);

oled_advance_page(true);
oled_write_P(PSTR("LOCK: "), false);
led_t led_state = host_keyboard_led_state();
oled_set_cursor(0, 1);
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_set_cursor(0, 2);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_set_cursor(0, 3);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
}

bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
if (display_logo && timer_elapsed32(logo_timer) > LOGO_TIMEOUT) {
display_logo = false;
oled_clear();
logo_timer = 0;
}
if (display_logo) {
dp3000_logo();
} else {
default_status();
}

return false;
}
22 changes: 22 additions & 0 deletions keyboards/dp3000/post_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2023 deddia permana (@depermana12)
*
* 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/>.
*/

#pragma once

#if !defined(OLED_TIMEOUT)
# define OLED_TIMEOUT 30000
#endif

0 comments on commit e207fb0

Please sign in to comment.