Initial commit

This commit is contained in:
2023-10-12 17:40:51 -05:00
parent 248dddf937
commit 66594e1270
23 changed files with 1561 additions and 0 deletions

449
draculad/keymap.c Normal file
View File

@@ -0,0 +1,449 @@
/*
Copyright 2021 @mangoiv
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/>.
*/
#include QMK_KEYBOARD_H
enum layer_number {
_BASE,
_NAV,
_NUM,
_SYM,
_FUN,
_MUS,
_ADJ
};
enum custom_keycodes {
BALL_HUI = SAFE_RANGE, //cycles hue
BALL_WHT, //cycles white
BALL_DEC, //decreased color
BALL_SCR, //scrolls
BALL_NCL, //left click
BALL_RCL, //right click
BALL_MCL, //middle click
M_PASS1,
M_PASS2
};
//Tap Dance Declarations
enum {
TD_ESC_Q,
TD_ESC_A,
};
//Tap Dance Definitions
tap_dance_action_t tap_dance_actions[] = {
//Tap once for Q, twice for Esc
[TD_ESC_Q] = ACTION_TAP_DANCE_DOUBLE(KC_Q, KC_ESC),
//Tap once for A, twice for Tab
[TD_ESC_A] = ACTION_TAP_DANCE_DOUBLE(KC_A, KC_TAB)
};
// LEFT THUMB KEYS
#define MUSIC_ESC LT(_MUS, KC_ESC)
#define NAV_BKSP LT(_NAV, KC_BSPC)
#define ADJ_TAB LT(_ADJ, KC_TAB)
// RIGHT THUMB KEYS
#define SYM_ENTER LT(_SYM, KC_ENTER)
#define NUM_SPC LT(_NUM, KC_SPC)
#define FUN_DEL LT(_FUN, KC_DEL)
// LEFT HOME KEY MODS
#define GUIA MT(MOD_LGUI,KC_A)
#define ALTS MT(MOD_LALT,KC_S)
#define CTLD MT(MOD_LCTL,KC_D)
#define SHTF MT(MOD_LSFT,KC_F)
// RIGHT HOME KEY MODS
#define SHTJ MT(MOD_LSFT | MOD_RSFT,KC_J)
#define CTLK MT(MOD_LCTL | MOD_RCTL,KC_K)
#define ALTL MT(MOD_LALT | MOD_RALT,KC_L)
#define GUIQUOT MT(MOD_LGUI | MOD_RGUI,KC_QUOT)
// Tap Dance
#define KC_EscTap TD(TD_ESC_Q)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BASE] = LAYOUT(
// ┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
KC_EscTap,KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
GUIA, ALTS, CTLD, SHTF, KC_G, KC_H, SHTJ, CTLK, ALTL, GUIQUOT,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,
// └────────┴────────┴────────┴────────┼────────┤ ├────────┼────────┴────────┴────────┴────────┘
KC_MUTE, TG(_ADJ),
// ┌────────┬────────┼────────┼ ┼────────┼────────┬────────┐
MUSIC_ESC,NAV_BKSP,ADJ_TAB, SYM_ENTER,NUM_SPC,FUN_DEL
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
),
[_NAV] = LAYOUT(
// ┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
_______, _______, _______, _______, _______, _______, KC_PSTE, KC_COPY, KC_CUT, KC_UNDO,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
_______, _______, _______, _______, _______, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
_______, _______, _______, M_PASS2, M_PASS1, _______, KC_HOME, KC_PGUP, KC_PGDN, KC_END,
// └────────┴────────┴────────┴────────┼────────┤ ├────────┼────────┴────────┴────────┴────────┘
_______, _______,
// ┌────────┬────────┼────────┼ ┼────────┼────────┬────────┐
_______, _______, _______, _______, _______, _______
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
),
[_NUM] = LAYOUT(
// ┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, _______, _______, _______, _______, _______,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, _______, _______, _______, _______, _______,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
KC_DOT, KC_1, KC_2, KC_3, KC_MINS, _______, _______, _______, _______, _______,
// └────────┴────────┴────────┴────────┼────────┤ ├────────┼────────┴────────┴────────┴────────┘
_______, _______,
// ┌────────┬────────┼────────┼ ┼────────┼────────┬────────┐
KC_0, KC_MINUS, _______, _______, _______, _______
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
),
[_SYM] = LAYOUT(
// ┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RBRC, _______, _______, _______, _______, _______,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, KC_LPRN, KC_RPRN, _______, _______, _______,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, KC_LPRN, KC_RPRN, _______, _______, _______,
// └────────┴────────┴────────┴────────┼────────┤ ├────────┼────────┴────────┴────────┴────────┘
_______, _______,
// ┌────────┬────────┼────────┼ ┼────────┼────────┬────────┐
KC_RPRN, KC_UNDS, _______, _______, _______, _______
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
),
[_FUN] = LAYOUT(
// ┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
_______, _______, _______, _______, _______, KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
_______, _______, _______, _______, _______, KC_F11, KC_F4, KC_F5, KC_F6, _______,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
_______, _______, _______, _______, _______, KC_F10, KC_F1, KC_F2, KC_F3, _______,
// └────────┴────────┴────────┴────────┼────────┤ ├────────┼────────┴────────┴────────┴────────┘
_______, _______,
// ┌────────┬────────┼────────┼ ┼────────┼────────┬────────┐
KC_RPRN, KC_UNDS, _______, _______, _______, _______
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
),
[_MUS] = LAYOUT(
// ┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
KC_LCTL, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
KC_LALT, KC_BTN3, KC_BTN2, KC_BTN1, BALL_SCR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
KC_LSFT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
// └────────┴────────┴────────┴────────┼────────┤ ├────────┼────────┴────────┴────────┴────────┘
_______, _______,
// ┌────────┬────────┼────────┼ ┼────────┼────────┬────────┐
_______, _______, _______, _______, _______, _______
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
),
[_ADJ] = LAYOUT(
// ┌────────┬────────┬────────┬────────┬────────┐ ┌────────┬────────┬────────┬────────┬────────┐
QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BALL_HUI, BALL_WHT, BALL_DEC, XXXXXXX, XXXXXXX,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
EE_CLR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG,
// ├────────┼────────┼────────┼────────┼────────┤ ├────────┼────────┼────────┼────────┼────────┤
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_RMOD,RGB_HUD, RGB_SAD, RGB_VAD, _______,
// └────────┴────────┴────────┴────────┼────────┤ ├────────┼────────┴────────┴────────┴────────┘
_______, _______,
// ┌────────┬────────┼────────┼ ┼────────┼────────┬────────┐
_______, _______, _______, _______, _______, _______
// └────────┴────────┴────────┘ └────────┴────────┴────────┘
)
};
#ifdef OLED_ENABLE
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_master()) {
if(is_keyboard_left()){
return OLED_ROTATION_270;
}
else {
return OLED_ROTATION_90;
}
} else {
return OLED_ROTATION_0;
}
}
static void render_logo(void) {
static const char PROGMEM drac_logo[] = {
// drac_logo, 128x64px
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, 0x80,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 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, 0x04, 0x04, 0x0c, 0x18, 0x78, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x07, 0x3e, 0xfc, 0xf0, 0x00, 0x00, 0x00,
0xf0, 0xf0, 0x60, 0x30, 0x30, 0x30, 0x00, 0x00, 0xe0, 0xe0, 0x30, 0x30, 0x30, 0x30, 0x30, 0xe0,
0xe0, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x30, 0x30, 0x30, 0x70, 0xe0, 0xc0, 0x00, 0x00,
0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0,
0x80, 0x00, 0x00, 0x00, 0x80, 0xe0, 0xf8, 0xf0, 0x80, 0xc0, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3f, 0xff, 0xff,
0xff, 0xff, 0xfe, 0xfc, 0xf8, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xe0, 0x7c, 0x3f, 0x0f, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0xcc, 0x8c, 0x84, 0x86, 0x86, 0xc6, 0xff,
0xff, 0x80, 0x80, 0x00, 0x3f, 0x7f, 0xe0, 0xc0, 0x80, 0x80, 0x80, 0xc0, 0xf0, 0x71, 0x00, 0x00,
0x1f, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x03, 0x07, 0x0f, 0x0f, 0x0f, 0x1f,
0x7f, 0x7f, 0x3e, 0x3e, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xf8, 0xfc,
0xfc, 0xfe, 0xfe, 0x7e, 0x7c, 0x78, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x60, 0x60,
0x60, 0x60, 0x60, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xe0, 0x60, 0x60, 0x60, 0xc0,
0xc0, 0xff, 0xff, 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, 0x07,
0x0f, 0x3e, 0x7c, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf8,
0xf8, 0xf8, 0xfc, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf1, 0x99, 0x18, 0x08,
0x0c, 0x0c, 0x8c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xc1, 0x80, 0x00, 0x00, 0x00, 0x80,
0xc3, 0xff, 0xff, 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, 0x07, 0x0f, 0x0f, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f,
0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x07, 0x03, 0x03, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03,
0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x03, 0x00, 0x00, 0x01, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01,
0x01, 0x03, 0x03, 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, 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(drac_logo, sizeof(drac_logo));
}
static void render_status(void) {
oled_write_P(PSTR("This is\n~~~~~~~~~\nDracu\nLad\n~~~~~~~~~\nv1.0\n~~~~~~~~~\n"), false);
uint8_t n = get_current_wpm();
char wpm_counter[4];
wpm_counter[3] = '\0';
wpm_counter[2] = '0' + n % 10;
wpm_counter[1] = (n /= 10) % 10 ? '0' + (n) % 10 : (n / 10) % 10 ? '0' : ' ';
wpm_counter[0] = n / 10 ? '0' + n / 10 : ' ';
oled_write_P(PSTR("WPM:"), false);
oled_write(wpm_counter, false);
led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("\nCaps: "), false);
oled_write_P(led_state.caps_lock ? PSTR("on ") : PSTR("off"), false);
oled_write_P(PSTR("\n"), false);
switch (get_highest_layer(layer_state)) {
case _BASE:
oled_write_P(PSTR("Base "), false);
break;
case _NAV:
oled_write_P(PSTR("Navigat"), false);
break;
case _NUM:
oled_write_P(PSTR("Numbers"), false);
break;
case _SYM:
oled_write_P(PSTR("Symbols"), false);
break;
case _ADJ:
oled_write_P(PSTR("Adjust "), false);
break;
case _MUS:
oled_write_P(PSTR("Mouse "), false);
break;
case _FUN:
oled_write_P(PSTR("Functio"), false);
break;
default:
oled_write_P(PSTR("Unkn "), false);
break;
}
}
bool oled_task_user(void) {
if (is_keyboard_master()) {
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_logo();
}
return false;
}
#endif //OLED_ENABLE
uint8_t white = 0;
uint8_t red = 255;
uint8_t green = 0;
uint8_t blue = 0;
bool set_scrolling = false;
report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
if (set_scrolling) {
mouse_report.h = mouse_report.x;
mouse_report.v = mouse_report.y;
mouse_report.x = mouse_report.y = 0;
}
return mouse_report;
}
void ball_increase_hue(void){
if(red!=255&&green!=255&&blue!=255){
red =255;
}
if (red==255&&green<255&&blue==0){
green += 15;
} else if(green==255&&blue==0&&red>0){
red-=15;
} else if(red==0&&blue<255&&green==255){
blue+=15;
} else if(blue==255&&green>0&&red==0){
green -= 15;
} else if(green == 0&&blue==255&&red<255){
red +=15;
} else if(green ==0&&blue>0&&red==255){
blue -=15;
}
pimoroni_trackball_set_rgbw(red,green,blue,white);
}
void decrease_color(void){
if (green>0){
green-=15;
}
if (red>0){
red-=15;
}
if (blue>0){
blue-=15;
}
pimoroni_trackball_set_rgbw(red,green,blue,white);
}
void cycle_white(void){
if (white<255){
white +=15;
} else{
white=0;
}
pimoroni_trackball_set_rgbw(red,green,blue,white);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record){
switch (keycode){
case M_PASS1:
if (record->event.pressed) {
SEND_STRING("T3lg3Ranch!2023");
}
return false;
case M_PASS2:
if (record->event.pressed) {
SEND_STRING("C0pperfield!2023");
}
return false;
case BALL_HUI:
if(record->event.pressed){
ball_increase_hue();
}
break;
case BALL_WHT:
if(record-> event.pressed){
cycle_white();
}
break;
case BALL_DEC:
if(record-> event.pressed){
decrease_color();
}
break;
case BALL_SCR:
if(record->event.pressed){
set_scrolling = true;
} else{
set_scrolling = false;
}
break;
case BALL_NCL:
record->event.pressed?register_code(KC_BTN1):unregister_code(KC_BTN1);
break;
case BALL_RCL:
record->event.pressed?register_code(KC_BTN2):unregister_code(KC_BTN2);
break;
case BALL_MCL:
record->event.pressed?register_code(KC_BTN3):unregister_code(KC_BTN3);
break;
}
return true;
}
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
// Volume control
if (clockwise) {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
else if (index == 2) {
switch (get_highest_layer(layer_state)) {
case _ADJ:
clockwise?ball_increase_hue():cycle_white();
break;
case _MUS:
clockwise?tap_code(KC_WH_U):tap_code(KC_WH_D);
break;
default:
clockwise?tap_code(KC_PGUP):tap_code(KC_PGDN);
break;
}
}
// I only have 2 encoders on the the pimoroni example board, just add else ifs for your other encoders...
// the missing ones are encoder 1 on the right side and encoder 3 on the left side
return true;
}
#endif // ENCODER_ENABLE