From 1512a6bfd48fb75619a1f77394d41bdca7ea28b1 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 1 Oct 2018 18:00:14 -0700 Subject: [PATCH] Keymap: Update to drashna keymaps and userspace (#3992) * Enabled unicode support and send_unicode function * Unicode cleanup * More unicode tweaking * Update EEPROM stuff * Account for keyboard macros * Switch Equal to Plus on Ergodox * more tweaks * Minor Unicode tweaks * Correct matrix printing for keylogger * Fix unicode functions * Fix unicode mode set since it actually uses EEPROM * Re-add DISABLE_LEADER * Ergodox is easier to hit the tapping term, fix that * Fix stupid type on unicode mode check * Preliminary CRKBD/HeliDox support * Fixes to Helidox * Cleanup userspace from old merge stuff * Remove CCCV sounds * Make Mode NOEEPROM Again --- keyboards/crkbd/keymaps/drashna/config.h | 43 +++ keyboards/crkbd/keymaps/drashna/glcdfont.c | 244 ++++++++++++++++++ keyboards/crkbd/keymaps/drashna/keymap.c | 173 +++++++++++++ keyboards/crkbd/keymaps/drashna/rules.mk | 30 +++ layouts/community/ergodox/drashna/keymap.c | 18 +- layouts/community/ergodox/drashna/rules.mk | 4 +- users/drashna/config.h | 10 +- users/drashna/drashna.c | 75 +++--- users/drashna/drashna.h | 28 +- users/drashna/rgb_stuff.c | 5 +- users/drashna/rules.mk | 7 +- users/drashna/send_unicode.c | 58 +++++ .../{drashna_unicode.h => send_unicode.h} | 10 +- 13 files changed, 639 insertions(+), 66 deletions(-) create mode 100644 keyboards/crkbd/keymaps/drashna/config.h create mode 100644 keyboards/crkbd/keymaps/drashna/glcdfont.c create mode 100644 keyboards/crkbd/keymaps/drashna/keymap.c create mode 100644 keyboards/crkbd/keymaps/drashna/rules.mk create mode 100644 users/drashna/send_unicode.c rename users/drashna/{drashna_unicode.h => send_unicode.h} (90%) diff --git a/keyboards/crkbd/keymaps/drashna/config.h b/keyboards/crkbd/keymaps/drashna/config.h new file mode 100644 index 000000000..366f013dc --- /dev/null +++ b/keyboards/crkbd/keymaps/drashna/config.h @@ -0,0 +1,43 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +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 . +*/ + +#pragma once + + +/* Select hand configuration */ + +// #define MASTER_LEFT +// #define MASTER_RIGHT +#define EE_HANDS + +#define SSD1306OLED + +#define USE_SERIAL_PD2 + +// #define TAPPING_FORCE_HOLD +// #define TAPPING_TERM 100 + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 27 +#define RGBLIGHT_LIMIT_VAL 120 +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 diff --git a/keyboards/crkbd/keymaps/drashna/glcdfont.c b/keyboards/crkbd/keymaps/drashna/glcdfont.c new file mode 100644 index 000000000..4e7b27bc0 --- /dev/null +++ b/keyboards/crkbd/keymaps/drashna/glcdfont.c @@ -0,0 +1,244 @@ +// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. +// See gfxfont.h for newer custom bitmap font info. + +#ifndef FONT5X7_H +#define FONT5X7_H + +#ifdef __AVR__ + #include + #include +#elif defined(ESP8266) + #include +#else + #define PROGMEM +#endif + +// Standard ASCII 5x7 font + +static const unsigned char font[] PROGMEM = { +0x00, 0x00, 0x00, 0x00, 0x00, 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, +0x00, 0x00, 0x5F, 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, 0x56, 0x20, 0x50, 0x00, +0x00, 0x08, 0x07, 0x03, 0x00, 0x00, +0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, +0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, +0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, +0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, +0x00, 0x80, 0x70, 0x30, 0x00, 0x00, +0x08, 0x08, 0x08, 0x08, 0x08, 0x00, +0x00, 0x00, 0x60, 0x60, 0x00, 0x00, +0x20, 0x10, 0x08, 0x04, 0x02, 0x00, +0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, +0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, +0x72, 0x49, 0x49, 0x49, 0x46, 0x00, +0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, +0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, +0x27, 0x45, 0x45, 0x45, 0x39, 0x00, +0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, +0x41, 0x21, 0x11, 0x09, 0x07, 0x00, +0x36, 0x49, 0x49, 0x49, 0x36, 0x00, +0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, +0x00, 0x00, 0x14, 0x00, 0x00, 0x00, +0x00, 0x40, 0x34, 0x00, 0x00, 0x00, +0x00, 0x08, 0x14, 0x22, 0x41, 0x00, +0x14, 0x14, 0x14, 0x14, 0x14, 0x00, +0x00, 0x41, 0x22, 0x14, 0x08, 0x00, +0x02, 0x01, 0x59, 0x09, 0x06, 0x00, +0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, +0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, +0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, +0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, +0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, +0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, +0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, +0x3E, 0x41, 0x41, 0x51, 0x73, 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, 0x1C, 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, +0x26, 0x49, 0x49, 0x49, 0x32, 0x00, +0x03, 0x01, 0x7F, 0x01, 0x03, 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, +0x03, 0x04, 0x78, 0x04, 0x03, 0x00, +0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, +0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, +0x02, 0x04, 0x08, 0x10, 0x20, 0x00, +0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, +0x04, 0x02, 0x01, 0x02, 0x04, 0x00, +0x40, 0x40, 0x40, 0x40, 0x40, 0x00, +0x00, 0x03, 0x07, 0x08, 0x00, 0x00, +0x20, 0x54, 0x54, 0x78, 0x40, 0x00, +0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, +0x38, 0x44, 0x44, 0x44, 0x28, 0x00, +0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, +0x38, 0x54, 0x54, 0x54, 0x18, 0x00, +0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, +0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00, +0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, +0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, +0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, +0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, +0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, +0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, +0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, +0x38, 0x44, 0x44, 0x44, 0x38, 0x00, +0xFC, 0x18, 0x24, 0x24, 0x18, 0x00, +0x18, 0x24, 0x24, 0x18, 0xFC, 0x00, +0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, +0x48, 0x54, 0x54, 0x54, 0x24, 0x00, +0x04, 0x04, 0x3F, 0x44, 0x24, 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, +0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, +0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, +0x00, 0x08, 0x36, 0x41, 0x00, 0x00, +0x00, 0x00, 0x77, 0x00, 0x00, 0x00, +0x00, 0x41, 0x36, 0x08, 0x00, 0x00, +0x02, 0x01, 0x02, 0x04, 0x02, 0x00, +0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x0E, 0x3F, 0xFF, 0xFF, +0xFF, 0xFF, 0xFE, 0xE0, 0x80, 0x00, +0x00, 0x00, 0x00, 0x00, 0x1E, 0xBE, +0x7F, 0xFF, 0xFF, 0xFE, 0xFE, 0xF0, +0xE0, 0xC0, 0x80, 0x00, 0x0E, 0xEF, +0xDF, 0xDE, 0xBE, 0x3C, 0x38, 0x70, +0xE0, 0xDD, 0xBB, 0x7B, 0x07, 0x0E, +0x0E, 0x0C, 0x98, 0xF0, 0xE0, 0xF0, +0xF0, 0xF8, 0x78, 0x3C, 0x1C, 0x1E, +0x0E, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, +0x1F, 0xFE, 0xFE, 0xF8, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, +0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, +0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, +0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, +0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, +0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, +0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, +0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, +0x00, 0x00, 0x00, 0x00, 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, +0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFE, +0xF8, 0xF0, 0xE0, 0xC0, 0x80, 0x7F, +0xFF, 0xFE, 0xFD, 0xFB, 0x1B, 0x07, +0x07, 0x0F, 0x1F, 0x1F, 0x1E, 0x1D, +0x0B, 0x07, 0x01, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, +0xF8, 0xFE, 0xFF, 0xFF, 0x1F, 0x07, +0x01, 0x01, 0x01, 0x03, 0x06, 0x06, +0x0C, 0x0C, 0x08, 0x0C, 0x0C, 0x0E, +0x07, 0x83, 0xC1, 0xE0, 0x70, 0x30, +0x18, 0x1C, 0x7C, 0xCC, 0x8C, 0xDC, +0xF8, 0xC0, 0xE0, 0xE0, 0x70, 0xB8, +0xF0, 0x60, 0x00, 0x00, 0x80, 0xC0, +0xE0, 0xF0, 0x70, 0xF8, 0xFC, 0xFC, +0x3C, 0x30, 0x38, 0xF8, 0xF8, 0xF8, +0x78, 0x00, 0x80, 0x80, 0xC0, 0xE0, +0x70, 0x38, 0x38, 0x9C, 0xDC, 0xFC, +0x7C, 0x38, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, +0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, +0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, +0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, +0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, +0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, +0x0F, 0x7F, 0x0F, 0x00, 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, 0x01, 0x03, 0x07, +0x1F, 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, +0x7E, 0x7D, 0x3B, 0x17, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x07, +0x0F, 0x1F, 0x3F, 0x3F, 0x7E, 0x7C, +0x78, 0x70, 0x70, 0x70, 0x70, 0x70, +0x70, 0x78, 0x38, 0x18, 0x1C, 0x0E, +0x07, 0x0F, 0x1F, 0x3F, 0x3C, 0x38, +0x38, 0x18, 0x0C, 0x06, 0x03, 0x01, +0x01, 0x01, 0x01, 0x0E, 0x1F, 0x1F, +0x1C, 0x1C, 0x1E, 0x0F, 0x0F, 0x03, +0x1D, 0x0E, 0x07, 0x03, 0x01, 0x00, +0x00, 0x0E, 0x1F, 0x1F, 0x1D, 0x1E, +0x0F, 0x07, 0x03, 0x03, 0x0F, 0x1F, +0x1F, 0x19, 0x19, 0x19, 0x19, 0x0C, +0x0C, 0x04, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; +#endif // FONT5X7_H diff --git a/keyboards/crkbd/keymaps/drashna/keymap.c b/keyboards/crkbd/keymaps/drashna/keymap.c new file mode 100644 index 000000000..7bced8de3 --- /dev/null +++ b/keyboards/crkbd/keymaps/drashna/keymap.c @@ -0,0 +1,173 @@ +#include QMK_KEYBOARD_H +#include "drashna.h" +#ifdef PROTOCOL_LUFA + #include "lufa.h" + #include "split_util.h" +#endif +#ifdef SSD1306OLED + #include "ssd1306.h" +#endif + +extern keymap_config_t keymap_config; +extern uint8_t is_master; + +#ifdef RGBLIGHT_ENABLE +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; +#endif + +enum crkbd_keycodes { + RGBRST = NEW_SAFE_RANGE +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = LAYOUT_wrapper( + KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, + KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + [_COLEMAK] = LAYOUT_wrapper( + KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, + KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + [_DVORAK] = LAYOUT_wrapper( + KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, + KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + [_WORKMAN] = LAYOUT_wrapper( + KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, + KC_TAB, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, + KC_MLSF, _________________QWERTY_L3_________________, _________________QWERTY_R3_________________, KC_MRSF, + LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE + ), + + [_MODS] = LAYOUT_wrapper( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT, + _______, _______, _______, _______, _______, _______ + ), + + [_LOWER] = LAYOUT_wrapper( + KC_TILD, _________________LOWER_L1__________________, _________________LOWER_R1__________________, KC_BSPC, + KC_F11, _________________LOWER_L2__________________, _________________LOWER_R2__________________, KC_PIPE, + KC_F12, _________________LOWER_L3__________________, _________________LOWER_R3__________________, _______, + _______, _______, _______, _______, _______, _______ + ), + + [_RAISE] = LAYOUT_wrapper( \ + KC_GRV, _________________RAISE_L1__________________, _________________RAISE_R1__________________, KC_BSPC, + _______, _________________RAISE_L2__________________, _________________RAISE_R2__________________, KC_BSLS, + _______, _________________RAISE_L3__________________, _________________RAISE_R3__________________, _______, + _______, _______, _______, _______, _______, _______ //`--------------------' `--------------------' + ), + + [_ADJUST] = LAYOUT_wrapper( \ + KC_MAKE, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, KC_RESET, + VRSN, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, EPRM, + TG_MODS, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY, + _______, _______, _______, _______, _______, _______ + ) +}; + +int RGB_current_mode; + +void matrix_init_keymap(void) { + #ifdef RGBLIGHT_ENABLE + RGB_current_mode = rgblight_config.mode; + #endif + //SSD1306 OLED init, make sure to add #define SSD1306OLED in config.h + #ifdef SSD1306OLED + iota_gfx_init(!has_usb()); // turns on the display + #endif + + DDRD &= ~(1<<5); + PORTD &= ~(1<<5); + + DDRB &= ~(1<<0); + PORTB &= ~(1<<0);} + +//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h +#ifdef SSD1306OLED + +// When add source files to SRC in rules.mk, you can use functions. +const char *read_layer_state(void); +const char *read_logo(void); +void set_keylog(uint16_t keycode, keyrecord_t *record); +const char *read_keylog(void); +const char *read_keylogs(void); + +// const char *read_mode_icon(bool swap); +// const char *read_host_led_state(void); +// void set_timelog(void); +// const char *read_timelog(void); + +void matrix_scan_keymap(void) { + iota_gfx_task(); +} + +void matrix_render_user(struct CharacterMatrix *matrix) { + if (is_master) { + // If you want to change the display of OLED, you need to change here + matrix_write_ln(matrix, read_layer_state()); + matrix_write_ln(matrix, read_keylog()); + matrix_write_ln(matrix, read_keylogs()); + //matrix_write_ln(matrix, read_mode_icon(keymap_config.swap_lalt_lgui)); + //matrix_write_ln(matrix, read_host_led_state()); + //matrix_write_ln(matrix, read_timelog()); + } else { + matrix_write(matrix, read_logo()); + } +} + +void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +void iota_gfx_task_user(void) { + struct CharacterMatrix matrix; + matrix_clear(&matrix); + matrix_render_user(&matrix); + matrix_update(&display, &matrix); +} + +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + set_keylog(keycode, record); + // set_timelog(); + } + + switch (keycode) { + case RGB_MOD: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + rgblight_mode_noeeprom(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_config.mode; + } + #endif + return false; + break; + case RGBRST: + #ifdef RGBLIGHT_ENABLE + if (record->event.pressed) { + eeconfig_update_rgblight_default(); + rgblight_enable(); + RGB_current_mode = rgblight_config.mode; + } + #endif + break; + } + return true; +} + +#endif diff --git a/keyboards/crkbd/keymaps/drashna/rules.mk b/keyboards/crkbd/keymaps/drashna/rules.mk new file mode 100644 index 000000000..f490aa2ea --- /dev/null +++ b/keyboards/crkbd/keymaps/drashna/rules.mk @@ -0,0 +1,30 @@ + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SWAP_HANDS_ENABLE = no # Enable one-hand typing + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +# If you want to change the display of OLED, you need to change here +SRC += ./lib/rgb_state_reader.c \ + ./lib/layer_state_reader.c \ + ./lib/logo_reader.c \ + ./lib/keylogger.c \ + # ./lib/mode_icon_reader.c \ + # ./lib/host_led_state_reader.c \ + # ./lib/timelogger.c \ diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c index 4d7700f19..15153c469 100644 --- a/layouts/community/ergodox/drashna/keymap.c +++ b/layouts/community/ergodox/drashna/keymap.c @@ -57,11 +57,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_QWERTY] = LAYOUT_ergodox_pretty_wrapper( // left hand // right hand - KC_EQL, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, KC_MINS, + KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_MINS, KC_TAB, _________________QWERTY_L1_________________, TG(_DIABLO), TG(_DIABLO), _________________QWERTY_R1_________________, KC_BSLS, KC_C1R3, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT, KC_MLSF, _________________QWERTY_L3_________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________QWERTY_R3_________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, UC_IRNY, __________________ERGODOX_THUMB_CLUSTER_____________________ ), /* Keymap 0: COLEMAK layer @@ -89,11 +89,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Otherwise, it needs KC_* [_COLEMAK] = LAYOUT_ergodox_pretty_wrapper( // left hand // right hand - KC_EQL, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, KC_MINS, + KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_MINS, KC_TAB, _________________COLEMAK_L1________________, TG(_DIABLO), TG(_DIABLO), _________________COLEMAK_R1________________, KC_BSLS, KC_C1R3, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, KC_MLSF, _________________COLEMAK_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________COLEMAK_R3________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, UC_IRNY, __________________ERGODOX_THUMB_CLUSTER_____________________ ), /* Keymap 0: DVORAK Layout @@ -121,11 +121,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Otherwise, it needs KC_* [_DVORAK] = LAYOUT_ergodox_pretty_wrapper( // left hand // right hand - KC_EQL, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, KC_BSLS, + KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_BSLS, KC_TAB, _________________DVORAK_L1_________________, TG(_DIABLO), TG(_DIABLO), _________________DVORAK_R1_________________, KC_SLSH, KC_C1R3, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_MINS, KC_MLSF, _________________DVORAK_L3_________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________DVORAK_R3_________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, UC_IRNY, __________________ERGODOX_THUMB_CLUSTER_____________________ ), /* Keymap 0: WORKMAN layer @@ -153,11 +153,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { // Otherwise, it needs KC_* [_WORKMAN] = LAYOUT_ergodox_pretty_wrapper( // left hand - KC_EQL, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, KC_MINS, + KC_ESC, ________________NUMBER_LEFT________________, UC_FLIP, UC_TABL, ________________NUMBER_RIGHT_______________, KC_MINS, KC_TAB, _________________WORKMAN_L1________________, TG(_DIABLO), TG(_DIABLO), _________________WORKMAN_R1________________, KC_BSLS, KC_C1R3, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, KC_MLSF, _________________WORKMAN_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________WORKMAN_R3________________, KC_MRSF, - KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, KC_NO, + KC_GRV, ___________ERGODOX_BOTTOM_LEFT_____________, ___________ERGODOX_BOTTOM_RIGHT____________, UC_IRNY, __________________ERGODOX_THUMB_CLUSTER_____________________ ), @@ -197,7 +197,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [_GAMEPAD] = LAYOUT_ergodox_pretty_wrapper( KC_ESC, KC_NO, KC_1, KC_2, KC_3, HYPR(KC_Q), HYPR(KC_GRV), KC_TRNS, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, - KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + KC_F1, KC_K, KC_Q, KC_W, KC_E, KC_R, KC_T, UC_SHRG, UC_DISA, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TAB, KC_G, KC_A, KC_S, KC_D, KC_F, KC_I, KC_O, KC_NO, KC_NO, KC_NO, KC_NO, KC_LCTL, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_TRNS, TG(_GAMEPAD), KC_N, KC_M, KC_NO, KC_NO, KC_NO, KC_NO, KC_GRV, KC_U, KC_I, KC_Y, KC_T, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO, diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk index 30d513c91..8bf53950e 100644 --- a/layouts/community/ergodox/drashna/rules.mk +++ b/layouts/community/ergodox/drashna/rules.mk @@ -8,8 +8,8 @@ endif CONSOLE_ENABLE = no BOOTMAGIC_ENABLE = yes -UNICODE_ENABLE = no -UNICDOEMAP_ENABLE = yes +UNICODE_ENABLE = yes +UNICDOEMAP_ENABLE = no MACROS_ENABLED = no RGBLIGHT_TWINKLE = no diff --git a/users/drashna/config.h b/users/drashna/config.h index 92efcc5c7..3ddec93b1 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -55,7 +55,11 @@ #ifdef TAPPING_TERM #undef TAPPING_TERM #endif // TAPPING_TERM -#define TAPPING_TERM 175 +#ifdef KEYBOARD_ergodox_ez + #define TAPPING_TERM 185 +#else + #define TAPPING_TERM 175 +#endif // Disable action_get_macro and fn_actions, since we don't use these @@ -63,4 +67,8 @@ #define NO_ACTION_MACRO #define NO_ACTION_FUNCTION +#define DISABLE_LEADER + #define MACRO_TIMER 5 + + diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 9489fb456..aad9fab61 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -21,6 +21,7 @@ along with this program. If not, see . userspace_config_t userspace_config; +uint16_t copy_paste_timer; // Helper Functions @@ -131,7 +132,7 @@ void led_set_keymap(uint8_t usb_led) {} // Call user matrix init, set default RGB colors and then // call the keymap's init function void matrix_init_user(void) { - userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE); + userspace_config.raw = eeprom_read_dword(EECONFIG_USERSPACE); #ifdef BOOTLOADER_CATERINA @@ -143,7 +144,9 @@ void matrix_init_user(void) { #endif #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) - set_unicode_input_mode(UC_WINC); + if (eeprom_read_byte(EECONFIG_UNICODEMODE) != UC_WIN) { + set_unicode_input_mode(UC_WIN); + } #endif //UNICODE_ENABLE matrix_init_keymap(); } @@ -173,17 +176,12 @@ void shutdown_user (void) { shutdown_keymap(); } -void suspend_power_down_user(void) -{ +void suspend_power_down_user(void) { suspend_power_down_keymap(); } -void suspend_wakeup_init_user(void) -{ +void suspend_wakeup_init_user(void) { suspend_wakeup_init_keymap(); - #ifdef KEYBOARD_ergodox_ez - wait_ms(10); - #endif } @@ -216,7 +214,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE - xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); + #if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2) + xprintf("KL: col: %u, row: %u, pressed: %u\n", record->event.key.row, record->event.key.col, record->event.pressed); + #else + xprintf("KL: col: %u, row: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); + #endif #endif //KEYLOGGER_ENABLE switch (keycode) { @@ -249,7 +251,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader if (!record->event.pressed) { send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP -#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) +#if defined(__ARM__) + ":dfu-util" +#elif defined(BOOTLOADER_DFU) ":dfu" #elif defined(BOOTLOADER_HALFKAY) ":teensy" @@ -291,7 +295,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { // to save on firmware space, since it's limited. #ifdef MACROS_ENABLED case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros - if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); } + if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw); } #ifdef RGBLIGHT_ENABLE userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18); #endif //RGBLIGHT_ENABLE @@ -342,45 +346,40 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { register_code(KC_LCTL); tap(KC_C); unregister_code(KC_LCTL); -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_copy); -#endif } else { // Tap, paste register_code(KC_LCTL); tap(KC_V); unregister_code(KC_LCTL); -#ifdef AUDIO_ENABLE - PLAY_SONG(tone_paste); -#endif } } return false; break; #ifdef UNICODE_ENABLE - case UC_FLIP: // (╯°□°)╯ ︵ ┻━┻ + case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ if (record->event.pressed) { - register_code(KC_RSFT); - tap(KC_9); - unregister_code(KC_RSFT); - process_unicode((0x256F | QK_UNICODE), record); // Arm - process_unicode((0x00B0 | QK_UNICODE), record); // Eye - process_unicode((0x25A1 | QK_UNICODE), record); // Mouth - process_unicode((0x00B0 | QK_UNICODE), record); // Eye - register_code(KC_RSFT); - tap(KC_0); - unregister_code(KC_RSFT); - process_unicode((0x256F | QK_UNICODE), record); // Arm - tap(KC_SPC); - process_unicode((0x0361 | QK_UNICODE), record); // Flippy - tap(KC_SPC); - process_unicode((0x253B | QK_UNICODE), record); // Table - process_unicode((0x2501 | QK_UNICODE), record); // Table - process_unicode((0x253B | QK_UNICODE), record); // Table + send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); } return false; break; -#endif // UNICODE_ENABLE - + case UC_TABL: // ┬─┬ノ( º _ ºノ) + if (record->event.pressed) { + send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029"); + } + return false; + break; + case UC_SHRG: // ¯\_(ツ)_/¯ + if (record->event.pressed) { + send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); + } + return false; + break; + case UC_DISA: // ಠ_ಠ + if (record->event.pressed) { + send_unicode_hex_string("0CA0 005F 0CA0"); + } + return false; + break; +#endif } return process_record_keymap(keycode, record) && #ifdef RGBLIGHT_ENABLE diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index de8c3ba94..49e3fc870 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -19,9 +19,13 @@ along with this program. If not, see . #include "quantum.h" #include "version.h" #include "eeprom.h" +#include "send_unicode.h" + #ifdef RGB_MATRIX_ENABLE #include "rgb_matrix.h" #endif + + // Define layer names enum userspace_layers { _QWERTY = 0, @@ -59,19 +63,26 @@ inline void tap(uint16_t keycode){ register_code(keycode); unregister_code(keyco bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed); bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); -#define EECONFIG_USERSPACE (uint8_t *)19 +#define EECONFIG_USERSPACE (uint32_t *)19 typedef union { - uint8_t raw; + uint32_t raw; struct { bool rgb_layer_change :1; bool is_overwatch :1; bool nuke_switch :1; + uint8_t unicode_mod :4; }; } userspace_config_t; +#if defined(KEYMAP_SAFE_RANGE) + #define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE +#else + #define PLACEHOLDER_SAFE_RANGE SAFE_RANGE +#endif + enum userspace_custom_keycodes { - EPRM = SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init) + EPRM = PLACEHOLDER_SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init) VRSN, // Prints QMK Firmware and board info KC_QWERTY, // Sets default layer to QWERTY KC_COLEMAK, // Sets default layer to COLEMAK @@ -99,13 +110,14 @@ enum userspace_custom_keycodes { KC_SECRET_5, // test5 KC_CCCV, // Hold to copy, tap to paste KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! - -#ifdef UNICODE_ENABLE - UC_FLIP, // Table flip (not working?) -#endif //UNICODE_ENABLE + UC_FLIP, // (ಠ痊ಠ)┻━┻ + UC_TABL, // ┬─┬ノ( º _ ºノ) + UC_SHRG, // ¯\_(ツ)_/¯ + UC_DISA, // ಠ_ಠ NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes }; + #define LOWER MO(_LOWER) #define RAISE MO(_RAISE) #define ADJUST MO(_ADJUST) @@ -153,6 +165,8 @@ enum userspace_custom_keycodes { #define MG_NKRO MAGIC_TOGGLE_NKRO +#define UC_IRNY UC(0x2E2E) +#define UC_CLUE UC(0x203D) #ifdef TAP_DANCE_ENABLE enum { diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 03c55b132..4a1a8de69 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -230,7 +230,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { userspace_config.rgb_layer_change ^= 1; xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); - eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); + eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw); if (userspace_config.rgb_layer_change) { layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) } @@ -243,7 +243,7 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { if (userspace_config.rgb_layer_change) { userspace_config.rgb_layer_change = false; xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change); - eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); + eeprom_update_dword(EECONFIG_USERSPACE, userspace_config.raw); } } return true; break; @@ -273,6 +273,7 @@ void matrix_init_rgb(void) { default: rgblight_sethsv_noeeprom_cyan(); break; } + rgblight_mode_noeeprom(1); } } diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index e299f24a1..3d6213eff 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -1,4 +1,3 @@ - SRC += drashna.c ifneq ("$(wildcard $(USER_PATH)/secrets.c)","") @@ -9,7 +8,7 @@ ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) SRC += tap_dances.c endif -EXTRAFLAGS += -flto +EXTRAFLAGS += -flto ifeq ($(strip $(NO_SECRETS)), yes) OPT_DEFS += -DNO_SECRETS @@ -37,3 +36,7 @@ ifdef CONSOLE_ENABLE OPT_DEFS += -DKEYLOGGER_ENABLE endif endif + +ifeq ($(strip $(UNICODE_ENABLE)), yes) + SRC += send_unicode.c +endif diff --git a/users/drashna/send_unicode.c b/users/drashna/send_unicode.c new file mode 100644 index 000000000..cacfe1dc8 --- /dev/null +++ b/users/drashna/send_unicode.c @@ -0,0 +1,58 @@ +// Written by konstantin: vomindoraan +#include "send_unicode.h" +#include +#include + +__attribute__((weak)) +void send_unicode_hex_string(const char* str) { + if (!str) { return; } // Safety net + + while (*str) { + // Find the next code point (token) in the string + for (; *str == ' '; str++); + size_t n = strcspn(str, " "); // Length of the current token + char code_point[n+1]; + strncpy(code_point, str, n); + code_point[n] = '\0'; // Make sure it's null-terminated + + // Normalize the code point: make all hex digits lowercase + for (char *p = code_point; *p; p++) { + *p = tolower((unsigned char)*p); + } + + // Send the code point as a Unicode input string + unicode_input_start(); + send_string(code_point); + unicode_input_finish(); + + str += n; // Move to the first ' ' (or '\0') after the current token + } +} + +// (ノಠ痊ಠ)ノ彡┻━┻ +// send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); + +//Old code +// (╯°□°)╯ ︵ ┻━┻ + #if 0 + register_code(KC_RSFT); + tap(KC_9); + unregister_code(KC_RSFT); + process_unicode((0x256F | QK_UNICODE), record); // Arm + process_unicode((0x00B0 | QK_UNICODE), record); // Eye + process_unicode((0x25A1 | QK_UNICODE), record); // Mouth + process_unicode((0x00B0 | QK_UNICODE), record); // Eye + register_code(KC_RSFT); + tap(KC_0); + unregister_code(KC_RSFT); + process_unicode((0x256F | QK_UNICODE), record); // Arm + tap(KC_SPC); + process_unicode((0x0361 | QK_UNICODE), record); // Flippy + tap(KC_SPC); + process_unicode((0x253B | QK_UNICODE), record); // Table + process_unicode((0x2501 | QK_UNICODE), record); // Table + process_unicode((0x253B | QK_UNICODE), record); // Table + #endif + + +// If you need a good converter: https://r12a.github.io/app-conversion/ diff --git a/users/drashna/drashna_unicode.h b/users/drashna/send_unicode.h similarity index 90% rename from users/drashna/drashna_unicode.h rename to users/drashna/send_unicode.h index 3d1bc03f9..818b6e571 100644 --- a/users/drashna/drashna_unicode.h +++ b/users/drashna/send_unicode.h @@ -1,10 +1,11 @@ -#ifndef UNICODE_USERSPACE_H -#define UNICODE_USERSPACE_H +#pragma once +#include "quantum.h" +void send_unicode_hex_string(const char* str); /* use X(n) to call the */ - +#ifdef UNICODEMAP_ENABLE enum unicode_name { THINK, // thinking face 🤔 GRIN, // grinning face 😊 @@ -67,5 +68,4 @@ const uint32_t PROGMEM unicode_map[] = { [IRONY] = 0x02E2E, [DEGREE] = 0x000B0 }; - - #endif +#endif // UNICODEMAP_ENABLE -- 2.39.2