commit
40a8a88e72
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 121 KiB |
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 88 KiB |
@ -0,0 +1,44 @@
|
||||
Priyadi Keymap for Planck-like Keyboards
|
||||
========================================
|
||||
|
||||
Main layer modifications from default Planck layout:
|
||||
|
||||
* Enter moved to quotes position
|
||||
* Quotes moved to semicolon position.
|
||||
* QWERTZ style colon & semicolon. shift-. = : shift-, = ; This is done in hardware, no layout switching needed in software.
|
||||
* < & > occupied precious real estate, and so they are moved down to punctuation layer.
|
||||
* Right-shift on Enter position.
|
||||
* Removed arrow keys, they are on another layer now.
|
||||
* Put Ctrl-Alt-Super and Super-AltGr-Ctrl in left & right corners.
|
||||
* Lower & Raise is now called Num and Fun.
|
||||
* OS & Left keys become another thumb modifier: Empty & Greek (Empty because I used this for another use and my muscle memory is not adapted to it yet)
|
||||
|
||||
On Promethium, Trackpoint is enabled on PD2 and PD2. We impersonate a Thinkpad keyboard to be able to use Thinkpad driver on Windows (still needs verification).
|
||||
|
||||
AltGr & Compose dual use key. Tap for Compose (mapped to Scroll Lock in hardware) and press for AltGr.
|
||||
|
||||
Supported layouts: QWERTY, DVORAK, Colemak, Workman, Norman. Switchable from SYS layer. In DVORAK, semicolon is replaced by /? key.
|
||||
|
||||
Num activates NUM layer: hexkeypad on the right side and most punctuation on the left side. Hexkeypad is optimized for C-style hex, IPv6, HTML RGB triplets, etc.
|
||||
|
||||
Fun activates FUN layer: arrow cluster on right home row, F-numbers on left side.
|
||||
|
||||
Pressing Num+Fun activates PUNC layer: same punctuations as NUM layer on the left side, parens on the right side.
|
||||
|
||||
Greek activates either GREEKU or GREEKL layer, depending whether shift is pressed or not. Shift state changes are also taken into account when the layer is active.
|
||||
|
||||
Greek+Empty activates EMOJI layer. The whole keyboard now outputs emojis!
|
||||
|
||||
Pressing both spacebars (spacekeys, actually) activates GUI layer. QWERTYUIOP switches to a virtual desktop. J & L switches virtual desktop to the left or right. S & F behaves like Alt-Tab and Alt-Shift-Tab. This works by sending Alt press when entering the layer, and Alt release when other than S or F keys are pressed.
|
||||
|
||||
Pressing both Ctrls activates SYS layer for configuring the keyboard.
|
||||
|
||||
On Promethium, USB or Bluetooth output is detected on startup. If USB is connected, then USB is used initially. SYS-U and SYS-B switch output to USB or Bluetooth at runtime. Current active output is indicated with LEDs.
|
||||
|
||||
SYS-W, SYS-L, SYS-M switch Unicode input method. SYS-Q, SYS-D, SYS-C, SYS-K, SYS-N switch to QWERTY, DVORAK, Colemak, Workman and Norman, respectively.
|
||||
|
||||
On Planck, SYS-A (mnemonic: audio) toggles faux clicky: use buzzer to emit clicks on key presses and releases.
|
||||
|
||||
On Promethium there are 6 indicator LEDs, and under switch LEDs on each switches, including Trackpoint buttons. Totaling 57 LEDs. Output is limited to 0xF for each LEDs to conserve power. SYS-G (mnemonic: glow) toggles various backlighting modes.
|
||||
|
||||
On Promethium, there's a LED to indicate battery level. Hue indicates level: green is full, red is empty.
|
@ -1,108 +1,10 @@
|
||||
#ifndef PROMETHIUM_H
|
||||
#define PROMETHIUM_H
|
||||
|
||||
#include "quantum.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#define PS2_INIT_DELAY 2000
|
||||
#define UNICODE_TYPE_DELAY 0
|
||||
#define BATTERY_PIN 9
|
||||
#define BATTERY_POLL 30000
|
||||
#define MAX_VOLTAGE 4.2
|
||||
#define MIN_VOLTAGE 3.2
|
||||
|
||||
#define KEYMAP( \
|
||||
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
|
||||
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
|
||||
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
|
||||
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
|
||||
) \
|
||||
{ \
|
||||
{k11, k12, k13, k14, k15, k16}, \
|
||||
{k21, k22, k23, k24, k25, k26}, \
|
||||
{k31, k32, k33, k34, k35, k36}, \
|
||||
{k41, k42, k43, k44, k45, k46}, \
|
||||
{k17, k18, k19, k1a, k1b, k1c}, \
|
||||
{k27, k28, k29, k2a, k2b, k2c}, \
|
||||
{k37, k38, k39, k3a, k3b, k3c}, \
|
||||
{k47, k48, k49, k4a, k4b, k4c} \
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum led_sequence {
|
||||
LED_IND_BLUETOOTH,
|
||||
LED_IND_USB,
|
||||
LED_IND_BATTERY,
|
||||
|
||||
LED_IND_FUNC,
|
||||
LED_IND_NUM,
|
||||
LED_IND_EMOJI,
|
||||
|
||||
LED_BKSP,
|
||||
LED_ENT,
|
||||
LED_RSFT,
|
||||
LED_RCTL,
|
||||
|
||||
LED_RGUI,
|
||||
LED_SLSH,
|
||||
LED_SCLN,
|
||||
LED_P,
|
||||
|
||||
LED_O,
|
||||
LED_L,
|
||||
LED_DOT,
|
||||
LED_RALT,
|
||||
|
||||
LED_EMOJI,
|
||||
LED_COMM,
|
||||
LED_K,
|
||||
LED_I,
|
||||
|
||||
LED_U,
|
||||
LED_J,
|
||||
LED_M,
|
||||
LED_FUNC,
|
||||
|
||||
LED_RSPC,
|
||||
LED_N,
|
||||
LED_HH,
|
||||
LED_Y,
|
||||
|
||||
LED_TRACKPOINT3,
|
||||
LED_TRACKPOINT2,
|
||||
LED_TRACKPOINT1,
|
||||
|
||||
LED_LSPC,
|
||||
LED_B,
|
||||
LED_G,
|
||||
LED_T,
|
||||
|
||||
LED_R,
|
||||
LED_F,
|
||||
LED_V,
|
||||
LED_NUM,
|
||||
|
||||
LED_PUNC,
|
||||
LED_C,
|
||||
LED_D,
|
||||
LED_E,
|
||||
|
||||
LED_W,
|
||||
LED_S,
|
||||
LED_X,
|
||||
LED_LALT,
|
||||
|
||||
LED_LGUI,
|
||||
LED_Z,
|
||||
LED_A,
|
||||
LED_Q,
|
||||
|
||||
LED_TAB,
|
||||
LED_ESC,
|
||||
LED_LSFT,
|
||||
LED_LCTL,
|
||||
};
|
||||
void battery_poll(uint8_t level);
|
||||
void led_set_kb(uint8_t usb_led);
|
||||
void led_set_user(uint8_t usb_led);
|
||||
|
||||
#endif
|
||||
|
||||
void battery_poll(uint8_t level);
|
@ -0,0 +1,39 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
#define PRIYADI_PLANCK
|
||||
|
||||
/* bootmagic salt key */
|
||||
#define BOOTMAGIC_KEY_SALT KC_ESC
|
||||
|
||||
/* skip bootmagic and eeconfig */
|
||||
#define BOOTMAGIC_KEY_SKIP KC_SPACE
|
||||
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
|
||||
#define UNICODE_TYPE_DELAY 0
|
||||
|
||||
#define LAYOUT_DVORAK
|
||||
#define LAYOUT_COLEMAK
|
||||
#define LAYOUT_NORMAN
|
||||
#define LAYOUT_WORKMAN
|
||||
|
||||
#define DOUBLESPACE_LAYER_ENABLE
|
||||
// #define TOLELOT_ENABLE
|
||||
|
||||
#define KEYMAP( \
|
||||
k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, \
|
||||
k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, \
|
||||
k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, \
|
||||
k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c \
|
||||
) \
|
||||
{ \
|
||||
{k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c}, \
|
||||
{k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c}, \
|
||||
{k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c}, \
|
||||
{k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c} \
|
||||
}
|
||||
|
||||
#endif
|
@ -1,680 +1 @@
|
||||
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
|
||||
// this is the style you want to emulate.
|
||||
|
||||
#include "planck.h"
|
||||
#include "action_layer.h"
|
||||
#ifdef AUDIO_ENABLE
|
||||
#include "audio.h"
|
||||
#include "musical_notes.h"
|
||||
#endif
|
||||
#include "eeconfig.h"
|
||||
#include "process_unicode.h"
|
||||
#include "quantum.h"
|
||||
|
||||
// #define TOLELOT_ENABLE
|
||||
|
||||
extern keymap_config_t keymap_config;
|
||||
|
||||
enum layers {
|
||||
_QWERTY,
|
||||
_COLEMAK,
|
||||
_WORKMAN,
|
||||
_PUNC,
|
||||
_NUM,
|
||||
_FUNC,
|
||||
_EMOJI,
|
||||
_GREEKU,
|
||||
_GREEKL,
|
||||
_GUI,
|
||||
};
|
||||
|
||||
enum planck_keycodes {
|
||||
// layouts
|
||||
QWERTY = SAFE_RANGE,
|
||||
COLEMAK,
|
||||
WORKMAN,
|
||||
|
||||
// layer switchers
|
||||
PUNC,
|
||||
NUM,
|
||||
FUNC,
|
||||
EMOJI,
|
||||
GUI,
|
||||
GREEK,
|
||||
|
||||
// os switchers
|
||||
LINUX,
|
||||
WIN,
|
||||
OSX,
|
||||
};
|
||||
|
||||
// Fillers to make layering clearer
|
||||
|
||||
#define _______ KC_TRNS
|
||||
#define XXXXXXX KC_NO
|
||||
|
||||
// unicode map
|
||||
|
||||
enum unicode_name {
|
||||
GRIN, // grinning face 😊
|
||||
TJOY, // tears of joy 😂
|
||||
SMILE, // grining face with smiling eyes 😁
|
||||
HEART, // heart ❤
|
||||
EYERT, // smiling face with heart shaped eyes 😍
|
||||
CRY, // crying face 😭
|
||||
SMEYE, // smiling face with smiling eyes 😊
|
||||
UNAMU, // unamused 😒
|
||||
KISS, // kiss 😘
|
||||
HART2, // two hearts 💕
|
||||
WEARY, // weary 😩
|
||||
OKHND, // ok hand sign 👌
|
||||
PENSV, // pensive 😔
|
||||
SMIRK, // smirk 😏
|
||||
RECYC, // recycle ♻
|
||||
WINK, // wink 😉
|
||||
THMUP, // thumb up 👍
|
||||
THMDN, // thumb down 👎
|
||||
PRAY, // pray 🙏
|
||||
PHEW, // relieved 😌
|
||||
MUSIC, // musical notes
|
||||
FLUSH, // flushed 😳
|
||||
CELEB, // celebration 🙌
|
||||
CRY2, // crying face 😢
|
||||
COOL, // smile with sunglasses 😎
|
||||
NOEVS, // see no evil
|
||||
NOEVH, // hear no evil
|
||||
NOEVK, // speak no evil
|
||||
POO, // pile of poo
|
||||
EYES, // eyes
|
||||
VIC, // victory hand
|
||||
BHART, // broken heart
|
||||
SLEEP, // sleeping face
|
||||
SMIL2, // smiling face with open mouth & sweat
|
||||
HUNRD, // 100
|
||||
CONFU, // confused
|
||||
TONGU, // face with tongue & winking eye
|
||||
DISAP, // disappointed
|
||||
YUMMY, // face savoring delicious food
|
||||
CLAP, // hand clapping
|
||||
FEAR, // face screaming in fear
|
||||
HORNS, // smiling face with horns
|
||||
HALO, // smiling face with halo
|
||||
BYE, // waving hand
|
||||
SUN, // sun
|
||||
MOON, // moon
|
||||
SKULL, // skull
|
||||
|
||||
// greek letters
|
||||
UALPH,
|
||||
UBETA,
|
||||
UGAMM,
|
||||
UDELT,
|
||||
UEPSI,
|
||||
UZETA,
|
||||
UETA,
|
||||
UTHET,
|
||||
UIOTA,
|
||||
UKAPP,
|
||||
ULAMB,
|
||||
UMU,
|
||||
UNU,
|
||||
UXI,
|
||||
UOMIC,
|
||||
UPI,
|
||||
URHO,
|
||||
USIGM,
|
||||
UTAU,
|
||||
UUPSI,
|
||||
UPHI,
|
||||
UCHI,
|
||||
UPSI,
|
||||
UOMEG,
|
||||
|
||||
LALPH,
|
||||
LBETA,
|
||||
LGAMM,
|
||||
LDELT,
|
||||
LEPSI,
|
||||
LZETA,
|
||||
LETA,
|
||||
LTHET,
|
||||
LIOTA,
|
||||
LKAPP,
|
||||
LLAMB,
|
||||
LMU,
|
||||
LNU,
|
||||
LXI,
|
||||
LOMIC,
|
||||
LPI,
|
||||
LRHO,
|
||||
LSIGM,
|
||||
LTAU,
|
||||
LUPSI,
|
||||
LPHI,
|
||||
LCHI,
|
||||
LPSI,
|
||||
LOMEG,
|
||||
|
||||
FSIGM,
|
||||
};
|
||||
|
||||
const uint32_t PROGMEM unicode_map[] = {
|
||||
[GRIN] = 0x1F600,
|
||||
[TJOY] = 0x1F602,
|
||||
[SMILE] = 0x1F601,
|
||||
[HEART] = 0x2764,
|
||||
[EYERT] = 0x1f60d,
|
||||
[CRY] = 0x1f62d,
|
||||
[SMEYE] = 0x1F60A,
|
||||
[UNAMU] = 0x1F612,
|
||||
[KISS] = 0x1F618,
|
||||
[HART2] = 0x1F495,
|
||||
[WEARY] = 0x1F629,
|
||||
[OKHND] = 0x1F44C,
|
||||
[PENSV] = 0x1F614,
|
||||
[SMIRK] = 0x1F60F,
|
||||
[RECYC] = 0x267B,
|
||||
[WINK] = 0x1F609,
|
||||
[THMUP] = 0x1F44D,
|
||||
[THMDN] = 0x1F44E,
|
||||
[PRAY] = 0x1F64F,
|
||||
[PHEW] = 0x1F60C,
|
||||
[MUSIC] = 0x1F3B6,
|
||||
[FLUSH] = 0x1F633,
|
||||
[CELEB] = 0x1F64C,
|
||||
[CRY2] = 0x1F622,
|
||||
[COOL] = 0x1F60E,
|
||||
[NOEVS] = 0x1F648,
|
||||
[NOEVH] = 0x1F649,
|
||||
[NOEVK] = 0x1F64A,
|
||||
[POO] = 0x1F4A9,
|
||||
[EYES] = 0x1F440,
|
||||
[VIC] = 0x270C,
|
||||
[BHART] = 0x1F494,
|
||||
[SLEEP] = 0x1F634,
|
||||
[SMIL2] = 0x1F605,
|
||||
[HUNRD] = 0x1F4AF,
|
||||
[CONFU] = 0x1F615,
|
||||
[TONGU] = 0x1F61C,
|
||||
[DISAP] = 0x1F61E,
|
||||
[YUMMY] = 0x1F60B,
|
||||
[CLAP] = 0x1F44F,
|
||||
[FEAR] = 0x1F631,
|
||||
[HORNS] = 0x1F608,
|
||||
[HALO] = 0x1F607,
|
||||
[BYE] = 0x1F44B,
|
||||
[SUN] = 0x2600,
|
||||
[MOON] = 0x1F314,
|
||||
[SKULL] = 0x1F480,
|
||||
|
||||
// greek letters
|
||||
[UALPH] = 0x0391,
|
||||
[UBETA] = 0x0392,
|
||||
[UGAMM] = 0x0393,
|
||||
[UDELT] = 0x0394,
|
||||
[UEPSI] = 0x0395,
|
||||
[UZETA] = 0x0396,
|
||||
[UETA] = 0x0397,
|
||||
[UTHET] = 0x0398,
|
||||
[UIOTA] = 0x0399,
|
||||
[UKAPP] = 0x039A,
|
||||
[ULAMB] = 0x039B,
|
||||
[UMU] = 0x039C,
|
||||
[UNU] = 0x039D,
|
||||
[UXI] = 0x039E,
|
||||
[UOMIC] = 0x039F,
|
||||
[UPI] = 0x03A0,
|
||||
[URHO] = 0x03A1,
|
||||
[USIGM] = 0x03A3,
|
||||
[UTAU] = 0x03A4,
|
||||
[UUPSI] = 0x03A5,
|
||||
[UPHI] = 0x03A6,
|
||||
[UCHI] = 0x03A7,
|
||||
[UPSI] = 0x03A8,
|
||||
[UOMEG] = 0x03A9,
|
||||
[LALPH] = 0x03B1,
|
||||
[LBETA] = 0x03B2,
|
||||
[LGAMM] = 0x03B3,
|
||||
[LDELT] = 0x03B4,
|
||||
[LEPSI] = 0x03B5,
|
||||
[LZETA] = 0x03B6,
|
||||
[LETA] = 0x03B7,
|
||||
[LTHET] = 0x03B8,
|
||||
[LIOTA] = 0x03B9,
|
||||
[LKAPP] = 0x03BA,
|
||||
[LLAMB] = 0x03BB,
|
||||
[LMU] = 0x03BC,
|
||||
[LNU] = 0x03BD,
|
||||
[LXI] = 0x03BE,
|
||||
[LOMIC] = 0x03BF,
|
||||
[LPI] = 0x03C0,
|
||||
[LRHO] = 0x03C1,
|
||||
[LSIGM] = 0x03C3,
|
||||
[LTAU] = 0x03C4,
|
||||
[LUPSI] = 0x03C5,
|
||||
[LPHI] = 0x03C6,
|
||||
[LCHI] = 0x03C7,
|
||||
[LPSI] = 0x03C8,
|
||||
[LOMEG] = 0x03C9,
|
||||
[FSIGM] = 0x03C2,
|
||||
};
|
||||
|
||||
|
||||
// hybrid shift - =
|
||||
// #undef KC_LSFT
|
||||
// #define KC_LSFT MT(MOD_LSFT, KC_MINS)
|
||||
// #undef KC_RSFT
|
||||
// #define KC_RSFT MT(MOD_LSFT, KC_EQL)
|
||||
|
||||
|
||||
// hybrid right-gui & scroll lock (mapped to Compose in OS)
|
||||
#undef KC_RCTL
|
||||
#define KC_RCTL MT(MOD_LCTL, KC_SLCK)
|
||||
|
||||
// keymaps
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
/* Qwerty
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | A | S | D | F | G | H | J | K | L | ; |Enter |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | N | M | , | . | / |Shift |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |Greek |AltGr | Ctrl |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_QWERTY] = {
|
||||
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
|
||||
{KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT },
|
||||
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT},
|
||||
{KC_LCTL, KC_LALT, KC_LGUI, PUNC, NUM, KC_SPC, KC_SPC, FUNC, EMOJI, GREEK, KC_RALT, KC_RCTL}
|
||||
},
|
||||
|
||||
/* Colemak
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | A | R | S | T | D | H | N | E | I | O |Enter |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| Z | X | C | V | B | K | M | , | . | / |Shift |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_COLEMAK] = {
|
||||
{_______, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, _______},
|
||||
{_______, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, _______},
|
||||
{_______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, _______},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
|
||||
},
|
||||
|
||||
/* Workman
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | Tab | Q | D | R | W | B | J | F | U | P | ; | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | A | S | H | T | G | Y | N | E | O | I |Enter |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | Shift| Z | X | M | C | V | K | K | , | . | / |Shift |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Ctrl | GUI | Alt | Punc | Num | Space | Func |Emoji |AltGr | GUI | Ctrl |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_WORKMAN] = {
|
||||
{_______, KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, _______},
|
||||
{_______, KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I, _______},
|
||||
{_______, KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH, _______},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
|
||||
},
|
||||
|
||||
/* Uppercase Greek
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_GREEKU] = {
|
||||
{_______, _______, _______,X(UEPSI), X(URHO), X(UTAU),X(UUPSI),X(UTHET),X(UIOTA),X(UOMIC), X(UPI), _______},
|
||||
{_______,X(UALPH),X(USIGM),X(UDELT), X(UPHI),X(UGAMM), X(UETA), X(UXI),X(UKAPP),X(ULAMB), _______, _______},
|
||||
{_______,X(UZETA), X(UCHI), X(UPSI),X(UOMEG),X(UBETA), X(UNU), X(UMU), _______, _______, _______, _______},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
|
||||
},
|
||||
|
||||
/* Lowercase Greek
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_GREEKL] = {
|
||||
{_______, _______,X(FSIGM),X(LEPSI), X(LRHO), X(LTAU),X(LUPSI),X(LTHET),X(LIOTA),X(LOMIC), X(LPI), _______},
|
||||
{_______,X(LALPH),X(LSIGM),X(LDELT), X(LPHI),X(LGAMM), X(LETA), X(LXI),X(LKAPP),X(LLAMB), _______, _______},
|
||||
{_______,X(LZETA), X(LCHI), X(LPSI),X(LOMEG),X(LBETA), X(LNU), X(LMU), _______, _______, _______, _______},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
|
||||
},
|
||||
|
||||
/* Punc
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | ` |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | | \ | - | = | < | > | ( | ) | ' | | |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | | | | _ | + | { | } | [ | ] | " | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_PUNC] = {
|
||||
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_GRV },
|
||||
{XXXXXXX, XXXXXXX, KC_BSLS, KC_MINS, KC_EQL, KC_LABK, KC_RABK, KC_LPRN, KC_RPRN, KC_QUOT, XXXXXXX, XXXXXXX},
|
||||
{XXXXXXX, XXXXXXX, KC_PIPE, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_LBRC, KC_RBRC, KC_DQUO, XXXXXXX, XXXXXXX},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
|
||||
},
|
||||
|
||||
/* Num
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | ^ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | Esc | @ | A | B | C | ( | ) | 4 | 5 | 6 | : |Enter |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | & | # | D | E | F | [ | ] | 1 | 2 | 3 | / | * |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | x | | | 0 | , | . | + | - |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_NUM] = {
|
||||
{KC_CIRC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
|
||||
{ KC_ESC, KC_AT, S(KC_A), S(KC_B), S(KC_C), KC_LPRN, KC_RPRN, KC_4, KC_5, KC_6, KC_COLN, KC_ENT},
|
||||
{KC_AMPR, KC_HASH, S(KC_D), S(KC_E), S(KC_F), KC_LBRC, KC_RBRC, KC_1, KC_2, KC_3, KC_SLSH, KC_ASTR},
|
||||
{_______, _______, _______, KC_X, _______, KC_SPC, KC_SPC, KC_0, KC_COMM, KC_DOT, KC_PLUS, KC_MINS}
|
||||
},
|
||||
|
||||
/* Func
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | F1 | F2 | F3 | F4 | | | PgUp | Up | PgDn | PgUp | Del |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | F5 | F6 | F7 | F8 |PrtSc | | Left | Down | Right| PgDn | Ins |
|
||||
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||
* | | F9 | F10 | F11 | F12 | | | | Home | End | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_FUNC] = {
|
||||
{XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL},
|
||||
{XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8,KC_PSCREEN,XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS},
|
||||
{_______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______},
|
||||
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
|
||||
},
|
||||
|
||||
/* Emoji
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | | | | | | | | | | | | |
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_EMOJI] = {
|
||||
{X(HART2), X(CRY2),X(WEARY),X(EYERT),X(SMIRK), X(TJOY),X(RECYC),X(UNAMU),X(MUSIC),X(OKHND),X(PENSV), X(PHEW)},
|
||||
{X(THMUP), X(PRAY),X(SMILE),X(SMIL2),X(FLUSH), X(GRIN),X(HEART), X(BYE), X(KISS),X(CELEB), X(COOL),X(NOEVS)},
|
||||
{X(THMDN),X(SLEEP), X(CLAP), X(CRY), X(VIC),X(BHART), X(SUN),X(SMEYE), X(WINK), X(MOON),X(CONFU),X(NOEVH)},
|
||||
{ X(POO), X(EYES),X(HUNRD), _______,X(SKULL),X(HORNS), X(HALO), X(FEAR), _______,X(YUMMY),X(DISAP),X(NOEVK)}
|
||||
},
|
||||
|
||||
/* GUI
|
||||
* ,-----------------------------------------------------------------------------------.
|
||||
* | | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 | D10 | |
|
||||
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||
* |Linux | | Vol- | Mute | Vol+ | | | D- | | D+ | |Qwerty|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | Win | | Prev | Play | Next | | | | | | |Colmak|
|
||||
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||
* | OSX | | | | | BL- | BL+ | | | | |Workmn|
|
||||
* `-----------------------------------------------------------------------------------'
|
||||
*/
|
||||
[_GUI] = {
|
||||
{_______, LGUI(KC_1),LGUI(KC_2),LGUI(KC_3),LGUI(KC_4),LGUI(KC_5),LGUI(KC_6),LGUI(KC_7),LGUI(KC_8),LGUI(KC_9),LGUI(KC_0), _______},
|
||||
{ LINUX, _______, KC_VOLD, KC_MUTE, KC_VOLU,_______,_______,KC_WWW_BACK,_______,KC_WWW_FORWARD,_______, QWERTY},
|
||||
{ WIN, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, _______, _______, _______, COLEMAK},
|
||||
{ OSX, _______, _______, _______, _______, BL_DEC, BL_INC, _______, _______, _______, _______, WORKMAN}
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
float tone_startup[][2] = SONG(STARTUP_SOUND);
|
||||
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
|
||||
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
|
||||
float tone_workman[][2] = SONG(DVORAK_SOUND);
|
||||
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
|
||||
float tone_linux[][2] = SONG(CAPS_LOCK_ON_SOUND);
|
||||
float tone_windows[][2] = SONG(SCROLL_LOCK_ON_SOUND);
|
||||
float tone_osx[][2] = SONG(NUM_LOCK_ON_SOUND);
|
||||
float tone_click[][2] = SONG(MUSICAL_NOTE(_F3, 2));
|
||||
float tone_release[][2] = SONG(MUSICAL_NOTE(_A3, 2));
|
||||
float tone_tolelot[][2] = SONG(Q__NOTE(_E5), Q__NOTE(_C5), Q__NOTE(_D5));
|
||||
#endif
|
||||
|
||||
void persistant_default_layer_set(uint16_t default_layer) {
|
||||
eeconfig_update_default_layer(default_layer);
|
||||
default_layer_set(default_layer);
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
// faux clicky
|
||||
// if (record->event.pressed) PLAY_NOTE_ARRAY(tone_click, false, 0);
|
||||
#ifdef AUDIO_ENABLE
|
||||
#ifdef TOLELOT_ENABLE
|
||||
if (record->event.pressed) {
|
||||
PLAY_NOTE_ARRAY(tone_tolelot, false, 0);
|
||||
}
|
||||
#else
|
||||
if (record->event.pressed) {
|
||||
PLAY_NOTE_ARRAY(tone_click, false, 0);
|
||||
} else {
|
||||
PLAY_NOTE_ARRAY(tone_release, false, 0);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT);
|
||||
bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT);
|
||||
|
||||
switch (keycode) {
|
||||
// Greek layer handling
|
||||
case GREEK:
|
||||
if (record->event.pressed) {
|
||||
if (lshifted || rshifted) {
|
||||
layer_on(_GREEKU);
|
||||
layer_off(_GREEKL);
|
||||
} else {
|
||||
layer_on(_GREEKL);
|
||||
layer_off(_GREEKU);
|
||||
}
|
||||
} else {
|
||||
layer_off(_GREEKU);
|
||||
layer_off(_GREEKL);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
||||
case KC_LSFT:
|
||||
case KC_RSFT:
|
||||
;
|
||||
uint8_t layer = biton32(layer_state);
|
||||
if (layer == _GREEKU || layer == _GREEKL) {
|
||||
if (record->event.pressed) {
|
||||
layer_on(_GREEKU);
|
||||
layer_off(_GREEKL);
|
||||
} else {
|
||||
if (lshifted ^ rshifted) { // if only one shift is pressed
|
||||
layer_on(_GREEKL);
|
||||
layer_off(_GREEKU);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
// QWERTZ style comma and dot: semicolon and colon when shifted
|
||||
case KC_COMM:
|
||||
if (record->event.pressed) {
|
||||
if (lshifted || rshifted) {
|
||||
if (lshifted) unregister_code(KC_LSFT);
|
||||
if (rshifted) unregister_code(KC_RSFT);
|
||||
register_code(KC_SCLN);
|
||||
unregister_code(KC_SCLN);
|
||||
if (lshifted) register_code(KC_LSFT);
|
||||
if (rshifted) register_code(KC_RSFT);
|
||||
} else {
|
||||
register_code(KC_COMM);
|
||||
unregister_code(KC_COMM);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case KC_DOT:
|
||||
if (record->event.pressed) {
|
||||
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT))) {
|
||||
register_code(KC_SCLN);
|
||||
unregister_code(KC_SCLN);
|
||||
} else {
|
||||
register_code(KC_DOT);
|
||||
unregister_code(KC_DOT);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
||||
// layout switcher
|
||||
case QWERTY:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
|
||||
#endif
|
||||
persistant_default_layer_set(1UL<<_QWERTY);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case COLEMAK:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
|
||||
#endif
|
||||
persistant_default_layer_set(1UL<<_COLEMAK);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case WORKMAN:
|
||||
if (record->event.pressed) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_workman, false, 0);
|
||||
#endif
|
||||
persistant_default_layer_set(1UL<<_WORKMAN);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
||||
// layer switchers
|
||||
case PUNC:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_PUNC);
|
||||
update_tri_layer(_PUNC, _EMOJI, _GUI);
|
||||
} else {
|
||||
layer_off(_PUNC);
|
||||
update_tri_layer(_PUNC, _EMOJI, _GUI);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case EMOJI:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_EMOJI);
|
||||
update_tri_layer(_PUNC, _EMOJI, _GUI);
|
||||
} else {
|
||||
layer_off(_EMOJI);
|
||||
update_tri_layer(_PUNC, _EMOJI, _GUI);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case NUM:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_NUM);
|
||||
} else {
|
||||
layer_off(_NUM);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
case FUNC:
|
||||
if (record->event.pressed) {
|
||||
layer_on(_FUNC);
|
||||
} else {
|
||||
layer_off(_FUNC);
|
||||
}
|
||||
return false;
|
||||
break;
|
||||
|
||||
// OS switchers
|
||||
case LINUX:
|
||||
set_unicode_input_mode(UC_LNX);
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_linux, false, 0);
|
||||
#endif
|
||||
return false;
|
||||
break;
|
||||
case WIN:
|
||||
set_unicode_input_mode(UC_WINC);
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_windows, false, 0);
|
||||
#endif
|
||||
return false;
|
||||
break;
|
||||
case OSX:
|
||||
set_unicode_input_mode(UC_OSX);
|
||||
#ifdef AUDIO_ENABLE
|
||||
PLAY_NOTE_ARRAY(tone_osx, false, 0);
|
||||
#endif
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void matrix_init_user(void) {
|
||||
#ifdef AUDIO_ENABLE
|
||||
startup_user();
|
||||
#endif
|
||||
set_unicode_input_mode(UC_LNX);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
|
||||
void startup_user()
|
||||
{
|
||||
_delay_ms(20); // gets rid of tick
|
||||
PLAY_NOTE_ARRAY(tone_startup, false, 0);
|
||||
}
|
||||
|
||||
void shutdown_user()
|
||||
{
|
||||
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
|
||||
_delay_ms(150);
|
||||
stop_all_notes();
|
||||
}
|
||||
|
||||
#endif
|
||||
#include "../../../handwired/promethium/keymaps/priyadi/keymap.c"
|
@ -0,0 +1,3 @@
|
||||
ifndef MAKEFILE_INCLUDED
|
||||
include ../../../Makefile
|
||||
endif
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright 2017 Priyadi Iman Nurcahyo
|
||||
|
||||
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 <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <timer.h>
|
||||
#include <fauxclicky.h>
|
||||
#include <stdbool.h>
|
||||
#include <musical_notes.h>
|
||||
|
||||
__attribute__ ((weak))
|
||||
float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, 2);
|
||||
__attribute__ ((weak))
|
||||
float fauxclicky_released_note[2] = MUSICAL_NOTE(_A3, 2);
|
||||
__attribute__ ((weak))
|
||||
float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, 2);
|
||||
|
||||
bool fauxclicky_enabled = true;
|
||||
uint16_t note_start = 0;
|
||||
bool note_playing = false;
|
||||
uint16_t note_period = 0;
|
||||
|
||||
void fauxclicky_init()
|
||||
{
|
||||
// Set port PC6 (OC3A and /OC4A) as output
|
||||
DDRC |= _BV(PORTC6);
|
||||
|
||||
// TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
|
||||
TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
|
||||
TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
|
||||
}
|
||||
|
||||
void fauxclicky_stop()
|
||||
{
|
||||
FAUXCLICKY_DISABLE_OUTPUT;
|
||||
note_playing = false;
|
||||
}
|
||||
|
||||
void fauxclicky_play(float note[2]) {
|
||||
if (!fauxclicky_enabled) return;
|
||||
if (note_playing) fauxclicky_stop();
|
||||
FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER));
|
||||
FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER)) / 2);
|
||||
note_playing = true;
|
||||
note_period = (note[1] / 16) * (60 / (float)FAUXCLICKY_TEMPO) * 100; // check this
|
||||
note_start = timer_read();
|
||||
FAUXCLICKY_ENABLE_OUTPUT;
|
||||
}
|
||||
|
||||
void fauxclicky_check() {
|
||||
if (!note_playing) return;
|
||||
|
||||
if (timer_elapsed(note_start) > note_period) {
|
||||
fauxclicky_stop();
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
/*
|
||||
Copyright 2017 Priyadi Iman Nurcahyo
|
||||
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#ifdef AUDIO_ENABLE
|
||||
#error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled"
|
||||
#endif
|
||||
|
||||
#include "musical_notes.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
__attribute__ ((weak))
|
||||
float fauxclicky_pressed_note[2];
|
||||
__attribute__ ((weak))
|
||||
float fauxclicky_released_note[2];
|
||||
__attribute__ ((weak))
|
||||
float fauxclicky_beep_note[2];
|
||||
|
||||
bool fauxclicky_enabled;
|
||||
|
||||
//
|
||||
// tempo in BPM
|
||||
//
|
||||
|
||||
#ifndef FAUXCLICKY_TEMPO
|
||||
#define FAUXCLICKY_TEMPO TEMPO_DEFAULT
|
||||
#endif
|
||||
|
||||
// beep on press
|
||||
#define FAUXCLICKY_ACTION_PRESS fauxclicky_play(fauxclicky_pressed_note)
|
||||
|
||||
// beep on release
|
||||
#define FAUXCLICKY_ACTION_RELEASE fauxclicky_play(fauxclicky_released_note)
|
||||
|
||||
// general purpose beep
|
||||
#define FAUXCLICKY_BEEP fauxclicky_play(fauxclicky_beep_note)
|
||||
|
||||
// enable
|
||||
#define FAUXCLICKY_ON fauxclicky_enabled = true
|
||||
|
||||
// disable
|
||||
#define FAUXCLICKY_OFF do { \
|
||||
fauxclicky_enabled = false; \
|
||||
fauxclicky_stop(); \
|
||||
} while (0)
|
||||
|
||||
// toggle
|
||||
#define FAUXCLICKY_TOGGLE do { \
|
||||
if (fauxclicky_enabled) { \
|
||||
FAUXCLICKY_OFF; \
|
||||
} else { \
|
||||
FAUXCLICKY_ON; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
//
|
||||
// pin configuration
|
||||
//
|
||||
|
||||
#ifndef FAUXCLICKY_CPU_PRESCALER
|
||||
#define FAUXCLICKY_CPU_PRESCALER 8
|
||||
#endif
|
||||
|
||||
#ifndef FAUXCLICKY_ENABLE_OUTPUT
|
||||
#define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1);
|
||||
#endif
|
||||
|
||||
#ifndef FAUXCLICKY_DISABLE_OUTPUT
|
||||
#define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0));
|
||||
#endif
|
||||
|
||||
#ifndef FAUXCLICKY_TIMER_PERIOD
|
||||
#define FAUXCLICKY_TIMER_PERIOD ICR3
|
||||
#endif
|
||||
|
||||
#ifndef FAUXCLICKY_DUTY_CYCLE
|
||||
#define FAUXCLICKY_DUTY_CYCLE OCR3A
|
||||
#endif
|
||||
|
||||
//
|
||||
// definitions
|
||||
//
|
||||
|
||||
void fauxclicky_init(void);
|
||||
void fauxclicky_stop(void);
|
||||
void fauxclicky_play(float note[2]);
|
||||
void fauxclicky_check(void);
|
||||
|
@ -0,0 +1,133 @@
|
||||
#include "process_ucis.h"
|
||||
|
||||
qk_ucis_state_t qk_ucis_state;
|
||||
|
||||
void qk_ucis_start(void) {
|
||||
qk_ucis_state.count = 0;
|
||||
qk_ucis_state.in_progress = true;
|
||||
|
||||
qk_ucis_start_user();
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void qk_ucis_start_user(void) {
|
||||
unicode_input_start();
|
||||
register_hex(0x2328);
|
||||
unicode_input_finish();
|
||||
}
|
||||
|
||||
static bool is_uni_seq(char *seq) {
|
||||
uint8_t i;
|
||||
|
||||
for (i = 0; seq[i]; i++) {
|
||||
uint16_t code;
|
||||
if (('1' <= seq[i]) && (seq[i] <= '0'))
|
||||
code = seq[i] - '1' + KC_1;
|
||||
else
|
||||
code = seq[i] - 'a' + KC_A;
|
||||
|
||||
if (i > qk_ucis_state.count || qk_ucis_state.codes[i] != code)
|
||||
return false;
|
||||
}
|
||||
|
||||
return (qk_ucis_state.codes[i] == KC_ENT ||
|
||||
qk_ucis_state.codes[i] == KC_SPC);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void qk_ucis_symbol_fallback (void) {
|
||||
for (uint8_t i = 0; i < qk_ucis_state.count - 1; i++) {
|
||||
uint8_t code = qk_ucis_state.codes[i];
|
||||
register_code(code);
|
||||
unregister_code(code);
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
void register_ucis(const char *hex) {
|
||||
for(int i = 0; hex[i]; i++) {
|
||||
uint8_t kc = 0;
|
||||
char c = hex[i];
|
||||
|
||||
switch (c) {
|
||||
case '0':
|
||||
kc = KC_0;
|
||||
break;
|
||||
case '1' ... '9':
|
||||
kc = c - '1' + KC_1;
|
||||
break;
|
||||
case 'a' ... 'f':
|
||||
kc = c - 'a' + KC_A;
|
||||
break;
|
||||
case 'A' ... 'F':
|
||||
kc = c - 'A' + KC_A;
|
||||
break;
|
||||
}
|
||||
|
||||
if (kc) {
|
||||
register_code (kc);
|
||||
unregister_code (kc);
|
||||
wait_ms (UNICODE_TYPE_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool process_ucis (uint16_t keycode, keyrecord_t *record) {
|
||||
uint8_t i;
|
||||
|
||||
if (!qk_ucis_state.in_progress)
|
||||
return true;
|
||||
|
||||
if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH &&
|
||||
!(keycode == KC_BSPC || keycode == KC_ESC || keycode == KC_SPC || keycode == KC_ENT)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!record->event.pressed)
|
||||
return true;
|
||||
|
||||
qk_ucis_state.codes[qk_ucis_state.count] = keycode;
|
||||
qk_ucis_state.count++;
|
||||
|
||||
if (keycode == KC_BSPC) {
|
||||
if (qk_ucis_state.count >= 2) {
|
||||
qk_ucis_state.count -= 2;
|
||||
return true;
|
||||
} else {
|
||||
qk_ucis_state.count--;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (keycode == KC_ENT || keycode == KC_SPC || keycode == KC_ESC) {
|
||||
bool symbol_found = false;
|
||||
|
||||
for (i = qk_ucis_state.count; i > 0; i--) {
|
||||
register_code (KC_BSPC);
|
||||
unregister_code (KC_BSPC);
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
}
|
||||
|
||||
if (keycode == KC_ESC) {
|
||||
qk_ucis_state.in_progress = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
unicode_input_start();
|
||||
for (i = 0; ucis_symbol_table[i].symbol; i++) {
|
||||
if (is_uni_seq (ucis_symbol_table[i].symbol)) {
|
||||
symbol_found = true;
|
||||
register_ucis(ucis_symbol_table[i].code + 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!symbol_found) {
|
||||
qk_ucis_symbol_fallback();
|
||||
}
|
||||
unicode_input_finish();
|
||||
|
||||
qk_ucis_state.in_progress = false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
#ifndef PROCESS_UCIS_H
|
||||
#define PROCESS_UCIS_H
|
||||
|
||||
#include "quantum.h"
|
||||
#include "process_unicode_common.h"
|
||||
|
||||
#ifndef UCIS_MAX_SYMBOL_LENGTH
|
||||
#define UCIS_MAX_SYMBOL_LENGTH 32
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char *symbol;
|
||||
char *code;
|
||||
} qk_ucis_symbol_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t count;
|
||||
uint16_t codes[UCIS_MAX_SYMBOL_LENGTH];
|
||||
bool in_progress:1;
|
||||
} qk_ucis_state_t;
|
||||
|
||||
extern qk_ucis_state_t qk_ucis_state;
|
||||
|
||||
#define UCIS_TABLE(...) {__VA_ARGS__, {NULL, NULL}}
|
||||
#define UCIS_SYM(name, code) {name, #code}
|
||||
|
||||
extern const qk_ucis_symbol_t ucis_symbol_table[];
|
||||
|
||||
void qk_ucis_start(void);
|
||||
void qk_ucis_start_user(void);
|
||||
void qk_ucis_symbol_fallback (void);
|
||||
void register_ucis(const char *hex);
|
||||
bool process_ucis (uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
#endif
|
@ -0,0 +1,85 @@
|
||||
#include "process_unicode_common.h"
|
||||
|
||||
uint8_t mods;
|
||||
|
||||
void set_unicode_input_mode(uint8_t os_target)
|
||||
{
|
||||
input_mode = os_target;
|
||||
}
|
||||
|
||||
uint8_t get_unicode_input_mode(void) {
|
||||
return input_mode;
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_input_start (void) {
|
||||
// save current mods
|
||||
mods = keyboard_report->mods;
|
||||
|
||||
// unregister all mods to start from clean state
|
||||
if (mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT);
|
||||
if (mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT);
|
||||
if (mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL);
|
||||
if (mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL);
|
||||
if (mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT);
|
||||
if (mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT);
|
||||
if (mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI);
|
||||
if (mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI);
|
||||
|
||||
switch(input_mode) {
|
||||
case UC_OSX:
|
||||
register_code(KC_LALT);
|
||||
break;
|
||||
case UC_LNX:
|
||||
register_code(KC_LCTL);
|
||||
register_code(KC_LSFT);
|
||||
register_code(KC_U);
|
||||
unregister_code(KC_U);
|
||||
unregister_code(KC_LSFT);
|
||||
unregister_code(KC_LCTL);
|
||||
break;
|
||||
case UC_WIN:
|
||||
register_code(KC_LALT);
|
||||
register_code(KC_PPLS);
|
||||
unregister_code(KC_PPLS);
|
||||
break;
|
||||
case UC_WINC:
|
||||
register_code(KC_RALT);
|
||||
unregister_code(KC_RALT);
|
||||
register_code(KC_U);
|
||||
unregister_code(KC_U);
|
||||
}
|
||||
wait_ms(UNICODE_TYPE_DELAY);
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_input_finish (void) {
|
||||
switch(input_mode) {
|
||||
case UC_OSX:
|
||||
case UC_WIN:
|
||||
unregister_code(KC_LALT);
|
||||
break;
|
||||
case UC_LNX:
|
||||
register_code(KC_SPC);
|
||||
unregister_code(KC_SPC);
|
||||
break;
|
||||
}
|
||||
|
||||
// reregister previously set mods
|
||||
if (mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT);
|
||||
if (mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT);
|
||||
if (mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL);
|
||||
if (mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL);
|
||||
if (mods & MOD_BIT(KC_LALT)) register_code(KC_LALT);
|
||||
if (mods & MOD_BIT(KC_RALT)) register_code(KC_RALT);
|
||||
if (mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI);
|
||||
if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI);
|
||||
}
|
||||
|
||||
void register_hex(uint16_t hex) {
|
||||
for(int i = 3; i >= 0; i--) {
|
||||
uint8_t digit = ((hex >> (i*4)) & 0xF);
|
||||
register_code(hex_to_keycode(digit));
|
||||
unregister_code(hex_to_keycode(digit));
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
#ifndef PROCESS_UNICODE_COMMON_H
|
||||
#define PROCESS_UNICODE_COMMON_H
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#ifndef UNICODE_TYPE_DELAY
|
||||
#define UNICODE_TYPE_DELAY 10
|
||||
#endif
|
||||
|
||||
__attribute__ ((unused))
|
||||
static uint8_t input_mode;
|
||||
|
||||
void set_unicode_input_mode(uint8_t os_target);
|
||||
uint8_t get_unicode_input_mode(void);
|
||||
void unicode_input_start(void);
|
||||
void unicode_input_finish(void);
|
||||
void register_hex(uint16_t hex);
|
||||
|
||||
#define UC_OSX 0 // Mac OS X
|
||||
#define UC_LNX 1 // Linux
|
||||
#define UC_WIN 2 // Windows 'HexNumpad'
|
||||
#define UC_BSD 3 // BSD (not implemented)
|
||||
#define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose
|
||||
|
||||
#define UC_BSPC UC(0x0008)
|
||||
|
||||
#define UC_SPC UC(0x0020)
|
||||
|
||||
#define UC_EXLM UC(0x0021)
|
||||
#define UC_DQUT UC(0x0022)
|
||||
#define UC_HASH UC(0x0023)
|
||||
#define UC_DLR UC(0x0024)
|
||||
#define UC_PERC UC(0x0025)
|
||||
#define UC_AMPR UC(0x0026)
|
||||
#define UC_QUOT UC(0x0027)
|
||||
#define UC_LPRN UC(0x0028)
|
||||
#define UC_RPRN UC(0x0029)
|
||||
#define UC_ASTR UC(0x002A)
|
||||
#define UC_PLUS UC(0x002B)
|
||||
#define UC_COMM UC(0x002C)
|
||||
#define UC_DASH UC(0x002D)
|
||||
#define UC_DOT UC(0x002E)
|
||||
#define UC_SLSH UC(0x002F)
|
||||
|
||||
#define UC_0 UC(0x0030)
|
||||
#define UC_1 UC(0x0031)
|
||||
#define UC_2 UC(0x0032)
|
||||
#define UC_3 UC(0x0033)
|
||||
#define UC_4 UC(0x0034)
|
||||
#define UC_5 UC(0x0035)
|
||||
#define UC_6 UC(0x0036)
|
||||
#define UC_7 UC(0x0037)
|
||||
#define UC_8 UC(0x0038)
|
||||
#define UC_9 UC(0x0039)
|
||||
|
||||
#define UC_COLN UC(0x003A)
|
||||
#define UC_SCLN UC(0x003B)
|
||||
#define UC_LT UC(0x003C)
|
||||
#define UC_EQL UC(0x003D)
|
||||
#define UC_GT UC(0x003E)
|
||||
#define UC_QUES UC(0x003F)
|
||||
#define UC_AT UC(0x0040)
|
||||
|
||||
#define UC_A UC(0x0041)
|
||||
#define UC_B UC(0x0042)
|
||||
#define UC_C UC(0x0043)
|
||||
#define UC_D UC(0x0044)
|
||||
#define UC_E UC(0x0045)
|
||||
#define UC_F UC(0x0046)
|
||||
#define UC_G UC(0x0047)
|
||||
#define UC_H UC(0x0048)
|
||||
#define UC_I UC(0x0049)
|
||||
#define UC_J UC(0x004A)
|
||||
#define UC_K UC(0x004B)
|
||||
#define UC_L UC(0x004C)
|
||||
#define UC_M UC(0x004D)
|
||||
#define UC_N UC(0x004E)
|
||||
#define UC_O UC(0x004F)
|
||||
#define UC_P UC(0x0050)
|
||||
#define UC_Q UC(0x0051)
|
||||
#define UC_R UC(0x0052)
|
||||
#define UC_S UC(0x0053)
|
||||
#define UC_T UC(0x0054)
|
||||
#define UC_U UC(0x0055)
|
||||
#define UC_V UC(0x0056)
|
||||
#define UC_W UC(0x0057)
|
||||
#define UC_X UC(0x0058)
|
||||
#define UC_Y UC(0x0059)
|
||||
#define UC_Z UC(0x005A)
|
||||
|
||||
#define UC_LBRC UC(0x005B)
|
||||
#define UC_BSLS UC(0x005C)
|
||||
#define UC_RBRC UC(0x005D)
|
||||
#define UC_CIRM UC(0x005E)
|
||||
#define UC_UNDR UC(0x005F)
|
||||
|
||||
#define UC_GRV UC(0x0060)
|
||||
|
||||
#define UC_a UC(0x0061)
|
||||
#define UC_b UC(0x0062)
|
||||
#define UC_c UC(0x0063)
|
||||
#define UC_d UC(0x0064)
|
||||
#define UC_e UC(0x0065)
|
||||
#define UC_f UC(0x0066)
|
||||
#define UC_g UC(0x0067)
|
||||
#define UC_h UC(0x0068)
|
||||
#define UC_i UC(0x0069)
|
||||
#define UC_j UC(0x006A)
|
||||
#define UC_k UC(0x006B)
|
||||
#define UC_l UC(0x006C)
|
||||
#define UC_m UC(0x006D)
|
||||
#define UC_n UC(0x006E)
|
||||
#define UC_o UC(0x006F)
|
||||
#define UC_p UC(0x0070)
|
||||
#define UC_q UC(0x0071)
|
||||
#define UC_r UC(0x0072)
|
||||
#define UC_s UC(0x0073)
|
||||
#define UC_t UC(0x0074)
|
||||
#define UC_u UC(0x0075)
|
||||
#define UC_v UC(0x0076)
|
||||
#define UC_w UC(0x0077)
|
||||
#define UC_x UC(0x0078)
|
||||
#define UC_y UC(0x0079)
|
||||
#define UC_z UC(0x007A)
|
||||
|
||||
#define UC_LCBR UC(0x007B)
|
||||
#define UC_PIPE UC(0x007C)
|
||||
#define UC_RCBR UC(0x007D)
|
||||
#define UC_TILD UC(0x007E)
|
||||
#define UC_DEL UC(0x007F)
|
||||
|
||||
#endif
|
@ -0,0 +1,54 @@
|
||||
#include "process_unicodemap.h"
|
||||
|
||||
__attribute__((weak))
|
||||
const uint32_t PROGMEM unicode_map[] = {
|
||||
};
|
||||
|
||||
void register_hex32(uint32_t hex) {
|
||||
uint8_t onzerostart = 1;
|
||||
for(int i = 7; i >= 0; i--) {
|
||||
if (i <= 3) {
|
||||
onzerostart = 0;
|
||||
}
|
||||
uint8_t digit = ((hex >> (i*4)) & 0xF);
|
||||
if (digit == 0) {
|
||||
if (onzerostart == 0) {
|
||||
register_code(hex_to_keycode(digit));
|
||||
unregister_code(hex_to_keycode(digit));
|
||||
}
|
||||
} else {
|
||||
register_code(hex_to_keycode(digit));
|
||||
unregister_code(hex_to_keycode(digit));
|
||||
onzerostart = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak))
|
||||
void unicode_map_input_error() {}
|
||||
|
||||
bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
|
||||
if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
|
||||
const uint32_t* map = unicode_map;
|
||||
uint16_t index = keycode - QK_UNICODE_MAP;
|
||||
uint32_t code = pgm_read_dword_far(&map[index]);
|
||||
if (code > 0xFFFF && code <= 0x10ffff && input_mode == UC_OSX) {
|
||||
// Convert to UTF-16 surrogate pair
|
||||
code -= 0x10000;
|
||||
uint32_t lo = code & 0x3ff;
|
||||
uint32_t hi = (code & 0xffc00) >> 10;
|
||||
unicode_input_start();
|
||||
register_hex32(hi + 0xd800);
|
||||
register_hex32(lo + 0xdc00);
|
||||
unicode_input_finish();
|
||||
} else if ((code > 0x10ffff && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) {
|
||||
// when character is out of range supported by the OS
|
||||
unicode_map_input_error();
|
||||
} else {
|
||||
unicode_input_start();
|
||||
register_hex32(code);
|
||||
unicode_input_finish();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#ifndef PROCESS_UNICODEMAP_H
|
||||
#define PROCESS_UNICODEMAP_H
|
||||
|
||||
#include "quantum.h"
|
||||
#include "process_unicode_common.h"
|
||||
|
||||
void unicode_map_input_error(void);
|
||||
bool process_unicode_map(uint16_t keycode, keyrecord_t *record);
|
||||
#endif
|
Loading…
Reference in new issue