mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-27 11:31:13 +00:00
post 2nd @drashna review
This commit is contained in:
parent
1d00dfc5d9
commit
0774cb31aa
@ -1,33 +0,0 @@
|
||||
// Copyright 2023 binepad (@binepad)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "candypad.h"
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
|
||||
// OLED functions
|
||||
uint8_t oled_mode = OLED_SPLASH;
|
||||
bool oled_repaint_requested = false;
|
||||
uint32_t oled_splash_timer = 0;
|
||||
|
||||
void housekeeping_task_kb(void) {
|
||||
if (0 != oled_splash_timer) {
|
||||
if (timer_elapsed(oled_splash_timer) > OLED_SPLASH_TIMEOUT) {
|
||||
switch (oled_mode) {
|
||||
case OLED_SPLASH:
|
||||
default:
|
||||
oled_mode = OLED_DEFAULT;
|
||||
oled_splash_timer = 0; // disable
|
||||
break;
|
||||
}
|
||||
oled_repaint_requested = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void suspend_wakeup_init_kb(void) {
|
||||
oled_on();
|
||||
suspend_wakeup_init_user();
|
||||
}
|
||||
|
||||
#endif // OLED_ENABLE
|
@ -1,33 +0,0 @@
|
||||
// Copyright 2023 binepad (@binepad)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
|
||||
# ifndef OLED_SPLASH_TIMEOUT
|
||||
# define OLED_SPLASH_TIMEOUT 2500
|
||||
# endif
|
||||
|
||||
// clang-format off
|
||||
enum oled_modes {
|
||||
OLED_SPLASH,
|
||||
OLED_DEFAULT,
|
||||
OLED_OFF,
|
||||
__NUM_OLED_MODES
|
||||
} oled_modes_t;
|
||||
// clang-format on
|
||||
|
||||
bool candypad_render_logo_user(void);
|
||||
bool candypad_render_logo_kb(void);
|
||||
bool candypad_render_default_user(void);
|
||||
bool candypad_render_default_kb(void);
|
||||
|
||||
// OLED functions
|
||||
extern uint8_t oled_mode;
|
||||
extern bool oled_repaint_requested;
|
||||
extern uint32_t oled_splash_timer;
|
||||
|
||||
#endif
|
@ -3,40 +3,11 @@
|
||||
// Portions of this code are based on [Andrew Kannan](https://github.com/awkannan1)'s
|
||||
// work on the Satisfaction75
|
||||
|
||||
#include "candypad.h"
|
||||
#include "quantum.h"
|
||||
#include "keymap_introspection.h"
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
|
||||
/* CandyPad Logo */
|
||||
static void __candypad_render_logo_default(void) {
|
||||
// Generated from https://joric.github.io/qle/
|
||||
static const char PROGMEM raw_logo[] = {
|
||||
0, 0, 0, 0, 128, 192, 224, 96, 240, 240, 152, 24, 24, 24, 24, 24, 24, 24, 24, 56, 48, 96, 224, 192, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 192, 248, 62, 7, 15, 28, 56, 112, 225, 195, 135, 14, 28, 56, 112, 224, 192, 128, 0, 0, 0, 0, 1, 7, 62, 252, 192, 0, 128, 192, 224, 112, 48, 48, 48, 112, 96, 0, 128, 192, 224, 96,
|
||||
48, 48, 48, 112, 224, 240, 240, 0, 0, 240, 240, 96, 112, 48, 48, 48, 112, 224, 192, 128, 0, 0, 128, 192, 224, 112, 48, 48, 48, 112, 224, 255, 255, 0, 48, 112, 224, 128, 0, 0, 0, 0, 128, 224, 112, 48, 0, 240, 240, 224, 112, 48, 48, 48, 112, 224, 192, 128, 0, 0, 128, 192, 224, 96, 48, 48, 48, 112, 224, 240, 240, 0, 0, 128, 192, 224, 112, 48, 48, 48, 112, 224, 255, 255, 0, 0, 3, 31, 124, 224, 192, 0, 0, 0, 0, 1, 3, 7, 14, 28, 56, 112, 225, 195, 135, 14, 28, 56, 240, 224, 124, 63, 3, 0, 15, 31, 56, 112, 96, 96, 96, 112, 48, 0, 15, 31, 56, 112, 96, 96, 96, 112, 56, 127, 127, 0, 0, 127, 127, 0, 0, 0, 0, 0, 0, 1, 127, 127, 0, 0, 15, 31, 56, 112, 96, 96, 96, 112, 56, 127, 127, 0, 0, 0, 3, 15, 62, 240, 248, 62, 15,
|
||||
3, 0, 0, 0, 255, 255, 56, 112, 96, 96, 96, 112, 56, 31, 15, 0, 0, 15, 31, 56, 112, 96, 96, 96, 112, 56, 127, 127, 0, 0, 15, 63, 56, 112, 96, 96, 96, 112, 56, 127, 127, 0, 0, 0, 0, 0, 1, 3, 7, 6, 14, 12, 24, 24, 24, 24, 24, 24, 24, 24, 25, 15, 15, 6, 7, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 31, 7, 1, 0, 0, 0, 0, 0, 0, 31, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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));
|
||||
}
|
||||
|
||||
// Weak so that user keymaps can make their own
|
||||
__attribute__((weak)) bool candypad_render_logo_user(void) {
|
||||
return false; // Return true if your user keymap renders its own
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool candypad_render_logo_kb(void) {
|
||||
if (!candypad_render_logo_user()) {
|
||||
__candypad_render_logo_default();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
|
||||
oled_mode = OLED_SPLASH;
|
||||
oled_splash_timer = sync_timer_read();
|
||||
return rotation;
|
||||
}
|
||||
|
||||
static char *get_enc_mode(uint8_t encoder) {
|
||||
# ifdef ENCODER_MAP_ENABLE
|
||||
|
||||
@ -206,38 +177,16 @@ __attribute__((weak)) bool candypad_render_default_kb(void) {
|
||||
return true; // Was handled here
|
||||
}
|
||||
|
||||
void oled_request_repaint(void) {
|
||||
oled_clear();
|
||||
}
|
||||
|
||||
bool oled_task_kb(void) {
|
||||
if (!oled_task_user()) {
|
||||
return false;
|
||||
}
|
||||
// if (!oled_task_needs_to_repaint()) { return false; }
|
||||
/* !! : oled_clear(); // Is broken !!! */
|
||||
if (oled_repaint_requested) {
|
||||
oled_repaint_requested = false;
|
||||
oled_clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (oled_mode) {
|
||||
case OLED_OFF:
|
||||
// Do nothing
|
||||
// This PCB has no digital switch to power off the OLED :(
|
||||
break;
|
||||
|
||||
case OLED_SPLASH:
|
||||
if (candypad_render_logo_kb()) {
|
||||
break;
|
||||
} else {
|
||||
oled_mode = OLED_DEFAULT;
|
||||
// don't break - let the default draw
|
||||
}
|
||||
|
||||
case OLED_DEFAULT:
|
||||
default:
|
||||
candypad_render_default_kb();
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,8 @@
|
||||
# define I2C_DRIVER I2CD1
|
||||
|
||||
/* Configure oled driver for the 128x32 oled */
|
||||
# define OLED_TIMEOUT (15 * 60 * 1000) // 15 minutes
|
||||
# define OLED_TIMEOUT (2 * 60 * 1000) // 2 minutes
|
||||
# define OLED_UPDATE_INTERVAL 33 // ~30fps
|
||||
|
||||
/* Font */
|
||||
# define OLED_FONT_H "keyboards/binepad/candypad/glcdfont.c"
|
||||
# define OLED_FONT_END 127
|
||||
#endif // OLED_ENABLE
|
||||
|
||||
/* ---- Direct pins, for use in (custom) `matrix.c` (please read that file) ----- */
|
||||
|
@ -1,142 +0,0 @@
|
||||
// Copyright 2023 binepad (@binepad)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "progmem.h"
|
||||
|
||||
/* based on https://lexus2k.github.io/ssd1306/ssd1306__fonts_8c_source.html, chars 32 - 127 */
|
||||
/* generated and tested on https://joric.github.io/qle/ */
|
||||
// clang-format off
|
||||
static const unsigned char PROGMEM font[] = {
|
||||
0xFF, 0x81, 0x81, 0x81, 0xFF, 0x00,
|
||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
|
||||
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
|
||||
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
|
||||
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
|
||||
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
|
||||
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
|
||||
0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
|
||||
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
|
||||
0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
|
||||
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
|
||||
0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
|
||||
0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
|
||||
0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
|
||||
0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
|
||||
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
|
||||
0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
|
||||
0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
|
||||
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
|
||||
0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
|
||||
0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
|
||||
0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
|
||||
0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
|
||||
0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
|
||||
0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
|
||||
0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
|
||||
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
|
||||
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
|
||||
0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
|
||||
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
|
||||
0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
|
||||
0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
|
||||
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // sp
|
||||
0x00, 0x00, 0x2F, 0x00, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
|
||||
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
|
||||
0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
|
||||
0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
|
||||
0x36, 0x49, 0x55, 0x22, 0x50, 0x00,
|
||||
0x00, 0x05, 0x03, 0x00, 0x00, 0x00,
|
||||
0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
|
||||
0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
|
||||
0x14, 0x08, 0x3E, 0x08, 0x14, 0x00,
|
||||
0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
|
||||
0x00, 0x00, 0xA0, 0x60, 0x00, 0x00,
|
||||
0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
|
||||
0x00, 0x60, 0x60, 0x00, 0x00, 0x00,
|
||||
0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
|
||||
0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
|
||||
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
|
||||
0x42, 0x61, 0x51, 0x49, 0x46, 0x00,
|
||||
0x21, 0x41, 0x45, 0x4B, 0x31, 0x00,
|
||||
0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
|
||||
0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
|
||||
0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00,
|
||||
0x01, 0x71, 0x09, 0x05, 0x03, 0x00,
|
||||
0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
|
||||
0x06, 0x49, 0x49, 0x29, 0x1E, 0x00,
|
||||
0x00, 0x36, 0x36, 0x00, 0x00, 0x00,
|
||||
0x00, 0x56, 0x36, 0x00, 0x00, 0x00,
|
||||
0x08, 0x14, 0x22, 0x41, 0x00, 0x00,
|
||||
0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
|
||||
0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
|
||||
0x02, 0x01, 0x51, 0x09, 0x06, 0x00,
|
||||
|
||||
0x32, 0x49, 0x59, 0x51, 0x3E, 0x00,
|
||||
0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
|
||||
0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00,
|
||||
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
|
||||
0x3E, 0x41, 0x49, 0x49, 0x7A, 0x00,
|
||||
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
|
||||
0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
|
||||
0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
|
||||
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
|
||||
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
|
||||
0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x00,
|
||||
0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
|
||||
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
|
||||
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
|
||||
0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
|
||||
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
|
||||
0x46, 0x49, 0x49, 0x49, 0x31, 0x00,
|
||||
0x01, 0x01, 0x7F, 0x01, 0x01, 0x00,
|
||||
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
|
||||
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
|
||||
0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
|
||||
0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
|
||||
0x07, 0x08, 0x70, 0x08, 0x07, 0x00,
|
||||
0x61, 0x51, 0x49, 0x45, 0x43, 0x00,
|
||||
0x00, 0x7F, 0x41, 0x41, 0x00, 0x00,
|
||||
0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
|
||||
0x00, 0x41, 0x41, 0x7F, 0x00, 0x00,
|
||||
0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
|
||||
|
||||
0x00, 0x01, 0x02, 0x04, 0x00, 0x00,
|
||||
0x20, 0x54, 0x54, 0x54, 0x78, 0x00,
|
||||
0x7F, 0x48, 0x44, 0x44, 0x38, 0x00,
|
||||
0x38, 0x44, 0x44, 0x44, 0x20, 0x00,
|
||||
0x38, 0x44, 0x44, 0x48, 0x7F, 0x00,
|
||||
0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
|
||||
0x08, 0x7E, 0x09, 0x01, 0x02, 0x00,
|
||||
0x18, 0xA4, 0xA4, 0xA4, 0x7C, 0x00,
|
||||
0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
|
||||
0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
|
||||
0x40, 0x80, 0x84, 0x7D, 0x00, 0x00,
|
||||
0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
|
||||
0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
|
||||
0x7C, 0x04, 0x18, 0x04, 0x78, 0x00,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
|
||||
0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
|
||||
0xFC, 0x24, 0x24, 0x24, 0x18, 0x00,
|
||||
0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
|
||||
0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
|
||||
0x48, 0x54, 0x54, 0x54, 0x20, 0x00,
|
||||
0x04, 0x3F, 0x44, 0x40, 0x20, 0x00,
|
||||
0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
|
||||
0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
|
||||
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
|
||||
0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
|
||||
0x1C, 0xA0, 0xA0, 0xA0, 0x7C, 0x00,
|
||||
0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,
|
||||
0x00, 0x00, 0x08, 0x77, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x7F, 0x00, 0x00,
|
||||
0x00, 0x00, 0x77, 0x08, 0x00, 0x00,
|
||||
0x00, 0x10, 0x08, 0x10, 0x08, 0x00,
|
||||
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA
|
||||
};
|
||||
// clang-format on
|
Loading…
Reference in New Issue
Block a user