diff --git a/keyboards/ciaanh/kanagawa/config.h b/keyboards/ciaanh/kanagawa/config.h new file mode 100644 index 00000000000..b8c5759db6b --- /dev/null +++ b/keyboards/ciaanh/kanagawa/config.h @@ -0,0 +1,3 @@ +#pragma once + +#include "config_common.h" diff --git a/keyboards/ciaanh/kanagawa/kanagawa.c b/keyboards/ciaanh/kanagawa/kanagawa.c new file mode 100644 index 00000000000..2b7f0847711 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/kanagawa.c @@ -0,0 +1 @@ +#include "kanagawa.h" diff --git a/keyboards/ciaanh/kanagawa/kanagawa.h b/keyboards/ciaanh/kanagawa/kanagawa.h new file mode 100644 index 00000000000..ab445c721e4 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/kanagawa.h @@ -0,0 +1,5 @@ +#pragma once + +#ifdef KEYBOARD_ciaanh_kanagawa_rev1 + #include "rev1.h" +#endif \ No newline at end of file diff --git a/keyboards/ciaanh/kanagawa/keymaps/default/config.h b/keyboards/ciaanh/kanagawa/keymaps/default/config.h new file mode 100644 index 00000000000..271f48d0011 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/keymaps/default/config.h @@ -0,0 +1,3 @@ +#pragma once + +// place overrides here diff --git a/keyboards/ciaanh/kanagawa/keymaps/default/keycodes.h b/keyboards/ciaanh/kanagawa/keymaps/default/keycodes.h new file mode 100644 index 00000000000..f77fe122b44 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/keymaps/default/keycodes.h @@ -0,0 +1,23 @@ +#pragma once + +enum layers +{ + _BASE, + _LOWER, + _UPPER, + _CODE +}; + +enum custom_keycodes +{ + ENCODER = SAFE_RANGE, + NEW_SAFE_RANGE, +}; + +#define TO_BASE TO(_BASE) +#define TO_CODE TG(_CODE) + +#define L_UP MO(_UPPER) +#define L_DWN MO(_LOWER) + +#define _SCRNSHOT LSFT(LGUI(KC_S)) diff --git a/keyboards/ciaanh/kanagawa/keymaps/default/keymap.c b/keyboards/ciaanh/kanagawa/keymaps/default/keymap.c new file mode 100644 index 00000000000..69e3b515a3a --- /dev/null +++ b/keyboards/ciaanh/kanagawa/keymaps/default/keymap.c @@ -0,0 +1,258 @@ +#include QMK_KEYBOARD_H +#include "keycodes.h" + +/* Keyboard layout + ,---------. ,---------------------------------------. ,---------------------------------------. ,---------------------------------------. ,---------. + | ka0 | | ka1 | ka2 | ka3 | ka4 | | ka5 | ka6 | ka7 | ka8 | | ka9 | ka10 | ka11 | ka12 | | sw99 | + `---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------' + ,-------------------------------------------------------------------------------------------------------------------------------------------. ,---------. + | kb0 | kb1 | kb2 | kb3 | kb4 | kb5 | kb6 | kb7 | kb8 | kb9 | kb10 | kb11 | kb12 | kb13 | | kd13 | + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| |---------| + | kc0 | kc1 | kc2 | kc3 | kc4 | kc5 | kc6 | kc7 | kc8 | kc9 | kc10 | kc11 | kc12 | kc13 | | ke13 | + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' |---------| + | kd0 | kd1 | kd2 | kd3 | kd4 | kd5 | kd6 | kd7 | kd8 | kd9 | kd10 | kd11 | kd12 | | kf13 | + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' `---------' + | ke0 | ke1 | ke2 | ke3 | ke4 | ke5 | ke6 | ke7 | ke8 | ke9 | ke10 | ke11 | ,---------. + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| | ke12 | + | kf0 | kf1 | kf2 | ,-------------------. ,-------------------. | kf7 | kf8 | kf9 | ,---------|---------|---------. + |---------+---------+---------+ | kf3 | kf4 | | kf5 | kf6 | +---------+---------+---------' | kf10 | kf11 | kf12 | + `---------+---------' `---------+---------' `---------+---------+---------' +*/ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Keymap: BASE +* +* +* ,---------. ,---------------------------------------. ,---------------------------------------. ,---------------------------------------. ,---------. +* | ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 | F10 | F11 | F12 | | ENCODER | +* `---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------' +* ,-------------------------------------------------------------------------------------------------------------------------------------------. ,---------. +* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Backspace| | Delete | +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| |---------| +* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | | HOME | +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' |---------| +* | CapsL | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | | END | +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' `---------' +* | LShift | Z | X | C | V | B | N | M | , | . | / | RShift | ,---------. +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| | UP | +* | LCtrl | LGUI | LAlt | ,-------------------. ,-------------------. | RAlt | CODE | RCtrl | ,---------|---------|---------. +* |---------+---------+---------+ | Lower | Space | | Space | Upper | +---------+---------+---------' | LEFT | DOWN | RIGHT | +* `---------+---------' `---------+---------' `---------+---------+---------' +* +* +*/ + [_BASE] = LAYOUT_84_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ENCODER, /*KC_MPLY*/ \ + + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, \ + KC_CAPS, KC_A, LT(0,KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, \ + KC_LSFT, KC_Z, LT(0,KC_X), LT(0,KC_C), LT(0,KC_V), KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ + KC_LCTL, KC_LGUI, KC_LALT, L_DWN, KC_SPC, KC_SPC, L_UP, KC_RALT, TO_CODE, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ + ), + + + [_CODE] = LAYOUT_84_ansi( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, TO_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ + ), + + + [_LOWER] = LAYOUT_84_ansi( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + + _SCRNSHOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ + ), + + + [_UPPER] = LAYOUT_84_ansi( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ + ) + + + +}; + + + + + +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ + +#ifdef OLED_ENABLE + // oled_rotation_t oled_init_user(oled_rotation_t rotation) { + // return OLED_ROTATION_180; + // } + + static void render_status(void) { + // 21 characters per line + // 16 cols / 8 rows + + oled_write_P(PSTR(" Kanagawa rev 1.1 "), false); + //oled_write_ln("", false); + + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + switch (get_highest_layer(layer_state)) { + case _BASE: + oled_write_P(PSTR("_\n"), false); + break; + case _LOWER: + oled_write_P(PSTR("[Low]\n"), false); + break; + case _UPPER: + oled_write_P(PSTR("[Up]\n"), false); + break; + case _CODE: + oled_write_P(PSTR("[Code]\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + } + + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_ln(led_state.caps_lock ? "CAPLOCK" : " ", false); + // oled_write_P(PSTR(" "), false); + + // oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); + // oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); + // oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); + + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + } + + // static void render_kanagawa_logo(void) { + // static const char PROGMEM kanagawa_logo[] = { + // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,192,192, 64, 96, 96, 48, 24, 24, 8, 12, 12, 12, 4, 4, 6,134,134,195,194,194,210,250,250,254,254,254,188,124,252,232,248,216, 48,160,224,192,192,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,192, 96, 48, 48, 24, 12, 4, 6, 3, 3, 0,192,192,208,248,248,252,255,255,127,254,158, 46,158,220, 63, 63, 63, 63, 63, 15, 7, 63, 63, 63,255,255,247,255,255,255,255,255,255,191,255,255,175, 28, 32,160,224,224,224,224,192,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + // 0, 0,128,192, 96, 96, 48, 24, 12, 6, 3, 3, 0,128,128,192,192,192, 0, 0, 0, 0, 0, 0,143,153, 31, 63, 38,191,247,240,248,254,127,137,224,252,206, 7,192,240, 24, 60, 70,146,227,225,241,123,127,127, 55, 55,255,255,255,255,255,127,254,255,223, 63,255,255,255,255,255,158, 30, 56, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 56, + // 56,248,249,241,248,248,224,240,240,252,254,255,255,239,231,239,255,255,253,252,248,216,254,254,252,255,255,255,255,254,254,253,251,247,255,254,255,255,255,255,255,255,253,249, 88,126,255,255, 15, 1, 0, 0, 0, 0, 0, 0, 3, 3, 1, 7, 1, 1, 1, 3, 31, 31, 27, 31, 31, 27, 3, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, + // 62,124,208,240,185,135,135,195,255,255,255,255,199,159,255,255,255,255,255,255,255,255, 63,127, 63, 63,126,255,255,255,255,255,255,255,255,223,191,255,255,255,207,111,111,127,243,255,248,204,143,255,252,224,192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,224, 48, 0, 0, 0, 0, 0,128,192,192, 0, 0, 10, + // 31,255,255,223,135, 63,111,255, 95,127,191,255,127,127,255,215, 63, 63,127,127,254,252,253,249,255,255,255,255,252,253,124,127, 63, 31, 15, 7, 3, 1, 0,128,224,224, 0, 0, 1, 1, 1, 3, 7, 63,127,239,238,124,224, 0, 0,128,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192,224,224,224,224,192,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,192, 64, 96,176,152,200,204,195,227,193,192,224,248,176, 60, 63,191,255,116, 9, 0, 0, 0, 0, 1, + // 3, 0, 0, 0, 0, 3, 3, 2, 1, 11,204,207, 7, 12, 14, 13, 8, 96,244,247,227,225,225,193, 0,192,192,192,192,232,184,252,236,240,255,254,255,127,255,255,252,216,236,252,240,224,248,248,240,241,131, 7,142, 32,126,255,255,239,198,228,236,216,240,240,248,248,236,228,230,230,199, 71, 71, 71,199, 79,207,207,199,207, 79,238,238,108,236,232,184,240,240,208,216,248,232,236, 52,126,254,255,251,249,253,252,252,254,253,255,255,255,127,125,253,253,255,254,239,231, 31, 31, 63, 0, 96, 0, 0, 0, + // 32,224,112,224,192,128, 0, 0, 0, 0, 0,224,224, 0, 0, 0,252,120, 14,126,127,103,255,255,127,127,239,240,241,249,241,225,241,247,255,255,253,252,252,252,252,255,255,255,251,241,143, 63,255,143, 63,239,143, 63,127,255,254, 56,113,243,246,229,235,239,255,243,163,231, 78,221,219,179,167,143,158, 31, 63, 55,127,126,112,193,192,212,191,188,167, 7, 95,126,254,254,255,120,124,127,127,127,255,255,255,247,231, 47, 47, 31, 31, 15,231,243, 51, 51,115,115, 3, 1, 1, 0,192,192,192,192, 0, + // }; + // oled_write_raw_P(kanagawa_logo, sizeof(kanagawa_logo)); + // } + + // static void render_kanagawa_logo(void) { + // //oled_set_cursor(0, 5); + + // static const char PROGMEM kanagawa_logo[] = { + // 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + // 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + // 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 + // }; + + // oled_write_P(kanagawa_logo, false); + // } + + bool oled_task_user(void) { + // switch (get_highest_layer(layer_state)) { + // case _UPPER: + // render_kanagawa_logo(); + // break; + // default: + // render_status(); + // } + + render_status(); + + return false; + } +#endif + +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case ENCODER: + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + tap_code16(G(A(KC_K))); + } else { + tap_code(KC_MPLY); + } + } + break; + case LT(0,KC_X): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_X)); // Intercept hold function to send Ctrl-X + return false; + } + return true; + case LT(0,KC_C): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_C)); // Intercept hold function to send Ctrl-C + return false; + } + return true; + case LT(0,KC_V): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_V)); // Intercept hold function to send Ctrl-V + return false; + } + return true; + case LT(0,KC_S): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_S)); // Intercept hold function to send Ctrl-S + return false; + } + return true; + } + return true; +} + +#ifdef ENCODER_ENABLE + bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + switch (get_highest_layer(layer_state)) { + case _CODE: + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + break; + default: + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + break; + } + } + return true; + } +#endif diff --git a/keyboards/ciaanh/kanagawa/keymaps/default/rules.mk b/keyboards/ciaanh/kanagawa/keymaps/default/rules.mk new file mode 100644 index 00000000000..84b40dd3533 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/keymaps/default/rules.mk @@ -0,0 +1,6 @@ +ENCODER_ENABLE = yes +OLED_ENABLE = yes + +CONSOLE_ENABLE = no +LTO_ENABLE = yes +MOUSEKEY_ENABLE = no \ No newline at end of file diff --git a/keyboards/ciaanh/kanagawa/keymaps/via/keycodes.h b/keyboards/ciaanh/kanagawa/keymaps/via/keycodes.h new file mode 100644 index 00000000000..f77fe122b44 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/keymaps/via/keycodes.h @@ -0,0 +1,23 @@ +#pragma once + +enum layers +{ + _BASE, + _LOWER, + _UPPER, + _CODE +}; + +enum custom_keycodes +{ + ENCODER = SAFE_RANGE, + NEW_SAFE_RANGE, +}; + +#define TO_BASE TO(_BASE) +#define TO_CODE TG(_CODE) + +#define L_UP MO(_UPPER) +#define L_DWN MO(_LOWER) + +#define _SCRNSHOT LSFT(LGUI(KC_S)) diff --git a/keyboards/ciaanh/kanagawa/keymaps/via/keymap.c b/keyboards/ciaanh/kanagawa/keymaps/via/keymap.c new file mode 100644 index 00000000000..cdd5efa4a7f --- /dev/null +++ b/keyboards/ciaanh/kanagawa/keymaps/via/keymap.c @@ -0,0 +1,211 @@ +#include QMK_KEYBOARD_H +#include "keycodes.h" + +/* Keyboard layout + ,---------. ,---------------------------------------. ,---------------------------------------. ,---------------------------------------. ,---------. + | ka0 | | ka1 | ka2 | ka3 | ka4 | | ka5 | ka6 | ka7 | ka8 | | ka9 | ka10 | ka11 | ka12 | | sw99 | + `---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------' + ,-------------------------------------------------------------------------------------------------------------------------------------------. ,---------. + | kb0 | kb1 | kb2 | kb3 | kb4 | kb5 | kb6 | kb7 | kb8 | kb9 | kb10 | kb11 | kb12 | kb13 | | kd13 | + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| |---------| + | kc0 | kc1 | kc2 | kc3 | kc4 | kc5 | kc6 | kc7 | kc8 | kc9 | kc10 | kc11 | kc12 | kc13 | | ke13 | + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' |---------| + | kd0 | kd1 | kd2 | kd3 | kd4 | kd5 | kd6 | kd7 | kd8 | kd9 | kd10 | kd11 | kd12 | | kf13 | + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' `---------' + | ke0 | ke1 | ke2 | ke3 | ke4 | ke5 | ke6 | ke7 | ke8 | ke9 | ke10 | ke11 | ,---------. + |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| | ke12 | + | kf0 | kf1 | kf2 | ,-------------------. ,-------------------. | kf7 | kf8 | kf9 | ,---------|---------|---------. + |---------+---------+---------+ | kf3 | kf4 | | kf5 | kf6 | +---------+---------+---------' | kf10 | kf11 | kf12 | + `---------+---------' `---------+---------' `---------+---------+---------' +*/ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Keymap: BASE +* +* +* ,---------. ,---------------------------------------. ,---------------------------------------. ,---------------------------------------. ,---------. +* | ESC | | F1 | F2 | F3 | F4 | | F5 | F6 | F7 | F8 | | F9 | F10 | F11 | F12 | | ENCODER | +* `---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------+---------+---------+---------' `---------' +* ,-------------------------------------------------------------------------------------------------------------------------------------------. ,---------. +* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Backspace| | Delete | +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| |---------| +* | Tab | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | | HOME | +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' |---------| +* | CapsL | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | | END | +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------' `---------' +* | LShift | Z | X | C | V | B | N | M | , | . | / | RShift | ,---------. +* |---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------| | UP | +* | LCtrl | LGUI | LAlt | ,-------------------. ,-------------------. | RAlt | CODE | RCtrl | ,---------|---------|---------. +* |---------+---------+---------+ | Lower | Space | | Space | Upper | +---------+---------+---------' | LEFT | DOWN | RIGHT | +* `---------+---------' `---------+---------' `---------+---------+---------' +* +* +*/ + [_BASE] = LAYOUT_84_ansi( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ENCODER, /*KC_MPLY*/ \ + + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, \ + KC_CAPS, KC_A, LT(0,KC_S), KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_END, \ + KC_LSFT, KC_Z, LT(0,KC_X), LT(0,KC_C), LT(0,KC_V), KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ + KC_LCTL, KC_LGUI, KC_LALT, L_DWN, KC_SPC, KC_SPC, L_UP, KC_RALT, TO_CODE, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT \ + ), + + + [_CODE] = LAYOUT_84_ansi( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, TO_BASE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ + ), + + + [_LOWER] = LAYOUT_84_ansi( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + + _SCRNSHOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ + ), + + + [_UPPER] = LAYOUT_84_ansi( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX \ + ) + + + +}; + + + + + +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ + +#ifdef OLED_ENABLE + static void render_status(void) { + oled_write_P(PSTR(" Kanagawa rev 1.1v "), false); + + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + switch (get_highest_layer(layer_state)) { + case _BASE: + oled_write_P(PSTR("_\n"), false); + break; + case _LOWER: + oled_write_P(PSTR("[Low]\n"), false); + break; + case _UPPER: + oled_write_P(PSTR("[Up]\n"), false); + break; + case _CODE: + oled_write_P(PSTR("[Code]\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + } + + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_ln(led_state.caps_lock ? "CAPLOCK" : " ", false); + + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + } + + bool oled_task_user(void) { + render_status(); + + return false; + } +#endif + +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case ENCODER: + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + tap_code16(G(A(KC_K))); + } else { + tap_code(KC_MPLY); + } + } + break; + case LT(0,KC_X): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_X)); // Intercept hold function to send Ctrl-X + return false; + } + return true; + case LT(0,KC_C): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_C)); // Intercept hold function to send Ctrl-C + return false; + } + return true; + case LT(0,KC_V): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_V)); // Intercept hold function to send Ctrl-V + return false; + } + return true; + case LT(0,KC_S): + if (!record->tap.count && record->event.pressed) { + tap_code16(C(KC_S)); // Intercept hold function to send Ctrl-S + return false; + } + return true; + } + return true; +} + +#ifdef ENCODER_ENABLE + bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { + switch (get_highest_layer(layer_state)) { + case _CODE: + if (clockwise) { + tap_code(KC_PGDN); + } else { + tap_code(KC_PGUP); + } + break; + default: + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + break; + } + } + return true; + } +#endif diff --git a/keyboards/ciaanh/kanagawa/keymaps/via/rules.mk b/keyboards/ciaanh/kanagawa/keymaps/via/rules.mk new file mode 100644 index 00000000000..d43b4d8b5d4 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/keymaps/via/rules.mk @@ -0,0 +1,7 @@ +ENCODER_ENABLE = yes +OLED_ENABLE = yes + +VIA_ENABLE = yes +BOOTMAGIC_ENABLE = lite +LTO_ENABLE = yes +MOUSEKEY_ENABLE = no \ No newline at end of file diff --git a/keyboards/ciaanh/kanagawa/lib/oledfont.c b/keyboards/ciaanh/kanagawa/lib/oledfont.c new file mode 100644 index 00000000000..153007ef1a3 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/lib/oledfont.c @@ -0,0 +1,277 @@ +#include "progmem.h" + + + +const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 000 => + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, // 0x01 001 => sad + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, // 0x02 002 => smile + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, // 0x03 003 => heart + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, // 0x04 004 => diamond + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, // 0x05 005 => clover + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, // 0x06 006 => spade + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, // 0x07 007 => + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, // 0x08 008 => + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, // 0x09 009 => + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, // 0x0A 010 => + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, // 0x0B 011 => male symbol + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, // 0x0C 012 => female symbol + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, // 0x0D 013 => + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, // 0x0E 014 => + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, // 0x0F 015 => + + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, // 0x10 016 => right + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, // 0x11 017 => left + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, // 0x12 018 => + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, // 0x13 019 => !! + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, // 0x14 020 => + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, // 0x15 021 => + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, // 0x16 022 => + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, // 0x17 023 => + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, // 0x18 024 => + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, // 0x19 025 => + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, // 0x1A 026 => + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, // 0x1B 027 => + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, // 0x1C 028 => + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, // 0x1D 029 => + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, // 0x1E 030 => + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, // 0x1F 031 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 032 => sp + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, // 0x21 033 => ! + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, // 0x22 034 => " + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, // 0x23 035 => # + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, // 0x24 036 => $ + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, // 0x25 037 => % + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, // 0x26 038 => & + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, // 0x27 039 => ' + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, // 0x28 040 => ( + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, // 0x29 041 => ) + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, // 0x2A 042 => * + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, // 0x2B 043 => + + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, // 0x2C 044 => , + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, // 0x2D 045 => - + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, // 0x2E 046 => . + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, // 0x2F 047 => / + + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, // 0x30 048 => 0 + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, // 0x31 049 => 1 + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, // 0x32 050 => 2 + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, // 0x33 051 => 3 + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, // 0x34 052 => 4 + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, // 0x35 053 => 5 + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, // 0x36 054 => 6 + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, // 0x37 055 => 7 + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, // 0x38 056 => 8 + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, // 0x39 057 => 9 + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, // 0x3A 058 => : + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, // 0x3B 059 => ; + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, // 0x3C 060 => < + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, // 0x3D 061 => = + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, // 0x3E 062 => > + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, // 0x3F 063 => ? + + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, // 0x40 064 => @ + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, // 0x41 065 => A + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, // 0x42 066 => B + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, // 0x43 067 => C + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, // 0x44 068 => D + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, // 0x45 069 => E + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, // 0x46 070 => F + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, // 0x47 071 => G + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, // 0x48 072 => H + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, // 0x49 073 => I + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, // 0x4A 074 => J + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, // 0x4B 075 => K + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, // 0x4C 076 => L + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, // 0x4D 077 => M + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, // 0x4E 078 => N + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, // 0x4F 079 => O + + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, // 0x50 080 => P + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, // 0x51 081 => Q + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, // 0x52 082 => R + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, // 0x53 083 => S + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, // 0x54 084 => T + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, // 0x55 085 => U + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, // 0x56 086 => V + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, // 0x57 087 => W + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, // 0x58 088 => X + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, // 0x59 089 => Y + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, // 0x5A 090 => Z + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, // 0x5B 091 => [ + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, // 0x5C 092 => '\' + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, // 0x5D 093 => ] + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, // 0x5E 094 => ^ + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, // 0x5F 095 => _ + + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, // 0x60 096 => ` + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, // 0x61 097 => a + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, // 0x62 098 => b + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, // 0x63 099 => c + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, // 0x64 100 => d + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, // 0x65 101 => e + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, // 0x66 102 => f + 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, // 0x67 103 => g + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, // 0x68 104 => h + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, // 0x69 105 => i + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, // 0x6A 106 => j + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, // 0x6B 107 => k + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, // 0x6C 108 => l + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, // 0x6D 109 => m + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, // 0x6E 110 => n + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, // 0x6F 111 => o + + 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, // 0x70 112 => p + 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, // 0x71 113 => q + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, // 0x72 114 => r + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, // 0x73 115 => s + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, // 0x74 116 => t + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, // 0x75 117 => u + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, // 0x76 118 => v + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, // 0x77 119 => w + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, // 0x78 120 => x + 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, // 0x79 121 => y + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, // 0x7A 122 => z + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, // 0x7B 123 => { + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // 0x7C 124 => | + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, // 0x7D 125 => } + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, // 0x7E 126 => ~ + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, // 0x7F 127 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 128 => ============================= LOGOS =============================== + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x81 129 => + 0x80, 0xC0, 0xC0, 0xC0, 0xE0, 0xF0, // 0x82 130 => + 0xF0, 0xF0, 0xF8, 0xF8, 0xFF, 0xFF, // 0x83 131 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, // 0x84 132 => + 0xF8, 0xF8, 0xE0, 0x00, 0x00, 0x00, // 0x85 133 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x86 134 => + 0xE0, 0xF0, 0xF8, 0xF8, 0xF0, 0xE0, // 0x87 135 => + 0xE0, 0xC0, 0xC0, 0x80, 0x00, 0x00, // 0x88 136 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x89 137 => + 0x00, 0x80, 0xE0, 0xF0, 0xE0, 0xE0, // 0x8A 138 => + 0xE0, 0x00, 0x00, 0x00, 0xC0, 0xC0, // 0x8B 139 => + 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, // 0x8C 140 => + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, // 0x8D 141 => + 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, // 0x8E 142 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, // 0x8F 143 => + + 0xC0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, // 0x90 144 => + 0x40, 0x00, 0x00, 0x00, 0x80, 0x80, // 0x91 145 => + 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x92 146 => + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, // 0x93 147 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x94 148 => + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, // 0x95 149 => + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, // 0x96 150 => + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, // 0x97 151 => + 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, // 0x98 152 => + 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, // 0x99 153 => + 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, // 0x9A 154 => + 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, // 0x9B 155 => + 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, // 0x9C 156 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x9D 157 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x9E 158 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x9F 159 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 160 => + 0x00, 0x0C, 0x0E, 0x8E, 0xCE, 0xFF, // 0xA1 161 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA2 162 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA3 163 => + 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA4 164 => + 0x7F, 0x1F, 0x0F, 0x00, 0x00, 0x00, // 0xA5 165 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA6 166 => + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA7 167 => + 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7E, // 0xA8 168 => + 0x3E, 0x3C, 0xDC, 0xE8, 0xF8, 0xFC, // 0xA9 169 => + 0xFE, 0xFF, 0xFF, 0x7F, 0x7F, 0xFF, // 0xAA 170 => + 0xFE, 0xFC, 0xF0, 0xE0, 0xFF, 0xFF, // 0xAB 171 => + 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, // 0xAC 172 => + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, // 0xAD 173 => + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, // 0xAE 174 => + 0x80, 0xE0, 0xF0, 0xF8, 0xFE, 0xFF, // 0xAF 175 => + + 0xFF, 0xFF, 0x7F, 0x7F, 0xFF, 0xFF, // 0xB0 176 => + 0xFC, 0xF0, 0xE0, 0x83, 0x0F, 0x0F, // 0xB1 177 => + 0x1F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, // 0xB2 178 => + 0xF9, 0xF1, 0xF1, 0xE1, 0xC1, 0xC0, // 0xB3 179 => + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB4 180 => + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, // 0xB5 181 => + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, // 0xB6 182 => + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, // 0xB7 183 => + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, // 0xB8 184 => + 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, // 0xB9 185 => + 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, // 0xBA 186 => + 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, // 0xBB 187 => + 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, // 0xBC 188 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xBD 189 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xBE 190 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xBF 191 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 192 => + 0x00, 0x00, 0x00, 0x01, 0x03, 0x0F, // 0xC1 193 => + 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, // 0xC2 194 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xC3 195 => + 0x7F, 0x7F, 0x7F, 0x3F, 0x1F, 0x1C, // 0xC4 196 => + 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, // 0xC5 197 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC6 198 => + 0x03, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, // 0xC7 199 => + 0x1F, 0x03, 0x01, 0x00, 0x00, 0x00, // 0xC8 200 => + 0x00, 0x00, 0x01, 0x1F, 0x1F, 0x1F, // 0xC9 201 => + 0x1F, 0x1F, 0x1E, 0x1E, 0x0E, 0x0F, // 0xCA 202 => + 0x0F, 0x1F, 0x1F, 0x01, 0x0F, 0x0F, // 0xCB 203 => + 0x0F, 0x1F, 0x1F, 0x1F, 0x0F, 0x1F, // 0xCC 204 => + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x1F, // 0xCD 205 => + 0x1F, 0x1F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xCE 206 => + 0x0F, 0x01, 0x1F, 0x1F, 0x1F, 0x1F, // 0xCF 207 => + + 0x1E, 0x1E, 0x1E, 0x0E, 0x0F, 0x0F, // 0xD0 208 => + 0x1F, 0x1F, 0x0F, 0x01, 0x00, 0x0E, // 0xD1 209 => + 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, // 0xD2 210 => + 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, // 0xD3 211 => + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD4 212 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD5 213 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD6 214 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD7 215 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD8 216 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD9 217 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDA 218 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDB 219 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDC 220 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDD 221 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDE 222 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDF 223 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 224 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE1 225 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE2 226 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE3 227 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE4 228 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE5 229 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE6 230 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE7 231 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE8 232 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE9 233 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEA 234 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEB 235 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEC 236 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xED 237 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEE 238 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEF 239 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 240 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF1 241 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF2 242 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF3 243 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF4 244 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF5 245 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF6 246 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF7 247 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF8 248 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF9 249 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFA 250 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFB 251 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFC 252 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFD 253 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFE 254 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // 0xFF 255 => +}; diff --git a/keyboards/ciaanh/kanagawa/readme.md b/keyboards/ciaanh/kanagawa/readme.md new file mode 100644 index 00000000000..086f1353b41 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/readme.md @@ -0,0 +1,16 @@ +# Kanagawa + +A 75% keyboard with oled and rotary encoder for Elite-C + + Keyboard Maintainer : Ciaanh + + Hardware Supported : Kanagawa PCB + + Hardware Availability : https://github.com/Ciaanh/keyboards/tree/main/Kanagawa + + +Make example for this keyboard (after setting up your build environment): + + qmk compile -kb ciaanh/kanagawa -km default + +Driver issues https://docs.qmk.fm/#/faq_build?id=unknown-device-for-dfu-bootloader diff --git a/keyboards/ciaanh/kanagawa/rev1/config.h b/keyboards/ciaanh/kanagawa/rev1/config.h new file mode 100644 index 00000000000..91a5f367b31 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/rev1/config.h @@ -0,0 +1,46 @@ +#pragma once + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xC1E0 +#define PRODUCT_ID 0x0010 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Ciaanh +#define PRODUCT Kanagawa +#define DESCRIPTION 75 with features + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 14 + +#define MATRIX_ROW_PINS { B2, B3, B1, F7, F6, F5 } +#define MATRIX_COL_PINS { B6, F0, F1, C7, D5, B7, B5, B4, E6, D7, C6, D4, D2, D3 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#ifdef OLED_ENABLE +# define OLED_DISPLAY_128X64 +# define OLED_FONT_H "lib/oledfont.c" +# define OLED_FONT_END 255 +// # define OLED_DISPLAY_ADDRESS 0x78 +#endif + +/* encoder support */ +#define ENCODERS_PAD_A \ + { B0 } +#define ENCODERS_PAD_B \ + { F4 } +#define ENCODERS_PAD_A_RIGHT \ + { F4 } +#define ENCODERS_PAD_B_RIGHT \ + { B0 } +#define ENCODER_RESOLUTION 2 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE diff --git a/keyboards/ciaanh/kanagawa/rev1/kanagawa.json b/keyboards/ciaanh/kanagawa/rev1/kanagawa.json new file mode 100644 index 00000000000..0551efec13d --- /dev/null +++ b/keyboards/ciaanh/kanagawa/rev1/kanagawa.json @@ -0,0 +1,21 @@ +{ + "name": "Kanagawa", + "vendorId": "0xC1E0", + "productId": "0x0010", + "lighting": "none", + "matrix": { "rows": 6, "cols": 14 }, + "layouts": { + "keymap": [ + [{ "c": "#777777" }, "0,0", { "x": 0.5, "c": "#cccccc" }, "0,1", "0,2", "0,3", "0,4", { "x": 0.25 }, "0,5", "0,6", "0,7", "0,8", { "x": 0.25 }, "0,9", "0,10", "0,11", "0,12", { "x": 2.25, "c": "#777777" }, "0,13"], + [{ "y": 0.25, "c": "#cccccc" }, "1,0", "1,1", "1,2", "1,3", "1,4", "1,5", "1,6", "1,7", "1,8", "1,9", "1,10", "1,11", "1,12", { "c": "#aaaaaa", "w": 2 }, "1,13", { "x": 1.25, "c": "#777777" }, "3,13"], + [{ "c": "#aaaaaa", "w": 1.5 }, "2,0", { "c": "#cccccc" }, "2,1", "2,2", "2,3", "2,4", "2,5", "2,6", "2,7", "2,8", "2,9", "2,10", "2,11", "2,12", { "w": 1.5 }, "2,13", { "x": 1.25, "c": "#777777" }, "4,13"], + [{ "c": "#aaaaaa", "w": 1.75 }, "3,0", { "c": "#cccccc" }, "3,1", "3,2", "3,3", "3,4", "3,5", "3,6", "3,7", "3,8", "3,9", "3,10", "3,11", { "c": "#777777", "w": 2.25 }, "3,12", { "x": 1.25 }, "5,13"], + [{ "c": "#aaaaaa", "w": 2.25 }, "4,0", { "c": "#cccccc" }, "4,1", "4,2", "4,3", "4,4", "4,5", "4,6", "4,7", "4,8", "4,9", "4,10", { "c": "#aaaaaa", "w": 1.75 }, "4,11"], + [{ "y": -0.75, "x": 14.25, "c": "#777777" }, "4,12"], + [{ "y": -0.25, "c": "#aaaaaa", "w": 1.25 }, "5,0", "5,1", { "w": 1.25 }, "5,2", { "x": 6.5 }, "5,7", "5,8", "5,9"], + [{ "y": -0.75, "x": 13.25, "c": "#777777" }, "5,10", "5,11", "5,12"], + [{ "r": 15, "rx": 3.75, "ry": 5.5, "y": -0.25 }, "5,3", { "w": 2 }, "5,4"], + [{ "r": -15, "rx": 9.75, "y": -0.25, "x": -3, "w": 2 }, "5,5", "5,6"] + ] + } +} \ No newline at end of file diff --git a/keyboards/ciaanh/kanagawa/rev1/rev1.c b/keyboards/ciaanh/kanagawa/rev1/rev1.c new file mode 100644 index 00000000000..fd021581d38 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/rev1/rev1.c @@ -0,0 +1,17 @@ +#include "kanagawa.h" + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { return encoder_update_user(index, clockwise); } +#endif + +void matrix_init_kb(void) { matrix_init_user(); }; + +void shutdown_user(void) { } \ No newline at end of file diff --git a/keyboards/ciaanh/kanagawa/rev1/rev1.h b/keyboards/ciaanh/kanagawa/rev1/rev1.h new file mode 100644 index 00000000000..ca8c09b2804 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/rev1/rev1.h @@ -0,0 +1,29 @@ +#pragma once +#include "quantum.h" + + +/* This a shortcut to help you visually see your layout. +* +* The first section contains all of the arguments representing the physical +* layout of the board and position of the K4ys. +* +* The second converts the arguments into a two-dimensional array which +* represents the switch matrix. +*/ +#define LAYOUT_84_ansi( \ + K00, K01,K02,K03,K04, K05,K06,K07,K08, K09,K010,K011,K012, K013, \ + \ + K10,K11,K12,K13,K14,K15,K16,K17,K18,K19,K110,K111,K112, K113 , K313, \ + K20 ,K21,K22,K23,K24,K25,K26,K27,K28,K29,K210,K211,K212, K213 , K413, \ + K30 ,K31,K32,K33,K34,K35,K36,K37,K38,K39,K310,K311, K312 , K513, \ + K40 ,K41,K42,K43,K44,K45,K46,K47,K48,K49,K410, K411 , K412, \ + K50 ,K51,K52 , K53,K54 , K55,K56, K57 ,K58,K59 , K510, K511, K512 \ +) \ +{ \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K010, K011, K012, K013 }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K110, K111, K112, K113 }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K210, K211, K212, K213 }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K310, K311, K312, K313 }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K410, K411, K412, K413 }, \ + { K50, K51, K52, K53, K54, K55, K56, K57, K58, K59, K510, K511, K512, K513 } \ +} diff --git a/keyboards/ciaanh/kanagawa/rev1/rules.mk b/keyboards/ciaanh/kanagawa/rev1/rules.mk new file mode 100644 index 00000000000..df78121d9c3 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/rev1/rules.mk @@ -0,0 +1,3 @@ +ENCODER_ENABLE = no +OLED_ENABLE = no + diff --git a/keyboards/ciaanh/kanagawa/rules.mk b/keyboards/ciaanh/kanagawa/rules.mk new file mode 100644 index 00000000000..731daafcd52 --- /dev/null +++ b/keyboards/ciaanh/kanagawa/rules.mk @@ -0,0 +1,33 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = qmk-dfu + +# 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 +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # 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 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +OLED_ENABLE = no + +DEFAULT_FOLDER = ciaanh/kanagawa/rev1 diff --git a/keyboards/ciaanh/kanagawa2040/config.h b/keyboards/ciaanh/kanagawa2040/config.h new file mode 100644 index 00000000000..cc4cbc940cb --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/config.h @@ -0,0 +1,131 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 + +#include "config_common.h" + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 3 + +/* Keyboard Matrix Assignments */ +// clang-format off +#define DIRECT_PINS { \ + { NO_PIN, NO_PIN, GP0 }, \ + { GP1, GP2, GP3 }, \ + { GP4, GP5, GP6 }, \ + { GP7, GP8, GP9 }, \ + { GP10, GP11, GP12 } \ +} +// clang-format on + +/* OLED SPI Defines */ +#define OLED_DISPLAY_128X64 +#define OLED_IC OLED_IC_SH1106 + +/* OLED SPI Pins */ +#define OLED_DC_PIN GP24 +#define OLED_CS_PIN GP22 +#define OLED_RST_PIN GP23 + +/* Shift OLED columns by 2 pixels */ +#define OLED_COLUMN_OFFSET 2 + +/* Divisor for OLED */ +#define OLED_SPI_DIVISOR 4 + +/* ChibiOS SPI definitions */ +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN GP26 +#define SPI_MOSI_PIN GP27 +#define SPI_MISO_PIN GP28 + +/* Encoders */ +#define ENCODERS_PAD_A { GP18 } +#define ENCODERS_PAD_B { GP17 } + +#define DEBOUNCE 5 + +/* Bootmagic lite */ +/* (Press the key bellow the encoder button while plugging the keyboard to enter the bootloader and clear flash) */ +#define BOOTMAGIC_LITE_ROW 1 +#define BOOTMAGIC_LITE_COLUMN 2 + +/* Double tap the side button to enter bootloader */ +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP13 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U + +/* Audio (Unsupported for now)*/ +// #define AUDIO_PIN GP16 +// #define SPEAKER_SHUTDOWN GP14 + +#ifdef RGB_MATRIX_ENABLE + + /* RGB Defines */ +# define RGB_DI_PIN GP19 +# define DRIVER_LED_TOTAL 12 +# define RGBLED_NUM 12 + + /* Enable Framebuffer and keypress effects */ +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS +# define RGB_MATRIX_KEYPRESSES + +# define ENABLE_RGB_MATRIX_ALPHAS_MODS +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BAND_SAT +# define ENABLE_RGB_MATRIX_BAND_VAL +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# define ENABLE_RGB_MATRIX_HUE_BREATHING +# define ENABLE_RGB_MATRIX_HUE_PENDULUM +# define ENABLE_RGB_MATRIX_HUE_WAVE +# define ENABLE_RGB_MATRIX_PIXEL_RAIN +# define ENABLE_RGB_MATRIX_PIXEL_FLOW +# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +# define ENABLE_RGB_MATRIX_TYPING_HEATMAP +# define ENABLE_RGB_MATRIX_DIGITAL_RAIN +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +# define ENABLE_RGB_MATRIX_SOLID_SPLASH +# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif diff --git a/keyboards/ciaanh/kanagawa2040/halconf.h b/keyboards/ciaanh/kanagawa2040/halconf.h new file mode 100644 index 00000000000..6cd66fd5207 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/halconf.h @@ -0,0 +1,28 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 + +#include_next + +#undef HAL_USE_SPI +#define HAL_USE_SPI TRUE + +#undef SPI_USE_WAIT +#define SPI_USE_WAIT TRUE + +#undef SPI_SELECT_MODE +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD diff --git a/keyboards/ciaanh/kanagawa2040/info.json b/keyboards/ciaanh/kanagawa2040/info.json new file mode 100644 index 00000000000..e9bd7d85b19 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/info.json @@ -0,0 +1,30 @@ +{ + "keyboard_name": "Macropad RP2040", + "manufacturer": "Adafruit", + "url": "https://learn.adafruit.com/adafruit-macropad-rp2040", + "maintainer": "Jpe230", + "usb": { + "vid": "0x239A", + "pid": "0x0108", + "device_version": "0.0.1" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Mute", "x":2, "y":0}, + {"label":"Enter", "x":0, "y":1}, + {"label":"KC_0", "x":1, "y":1}, + {"label":"BackSpace", "x":2, "y":1}, + {"label":"KC_7", "x":0, "y":2}, + {"label":"KC_8", "x":1, "y":2}, + {"label":"KC_9", "x":2, "y":2}, + {"label":"KC_4", "x":0, "y":3}, + {"label":"KC_5", "x":1, "y":3}, + {"label":"KC_6", "x":2, "y":3}, + {"label":"KC_1", "x":0, "y":4}, + {"label":"KC_2", "x":1, "y":4}, + {"label":"KC_3", "x":2, "y":4} + ] + } + } +} diff --git a/keyboards/ciaanh/kanagawa2040/keymaps/default/keymap.c b/keyboards/ciaanh/kanagawa2040/keymaps/default/keymap.c new file mode 100644 index 00000000000..34989ea0b60 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/keymaps/default/keymap.c @@ -0,0 +1,114 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_MUTE, + KC_ENT, KC_0, KC_BSPC, + KC_7, KC_8, KC_9, + KC_4, KC_5, KC_6, + KC_1, KC_2, KC_3 + ) +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, +}; +#endif + + +#ifdef OLED_ENABLE +static void render_qmk_logo(void) { + static const char PROGMEM qmk_logo[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3f, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, + 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x83, 0x83, 0x83, 0x83, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, + 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x83, 0x83, 0x83, 0x83, 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, + 0x81, 0x83, 0x83, 0x83, 0x83, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x83, 0x83, 0x83, 0x83, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x07, 0x1f, 0x3f, 0x7f, 0x7e, 0xf8, 0xf0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xff, 0xff, + 0xff, 0xff, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf8, 0x7e, 0x7f, 0x3f, 0x1f, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 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, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xfc, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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(qmk_logo, sizeof(qmk_logo)); +} + +bool oled_task_user(void) { + render_qmk_logo(); + return true; +} + +#endif + diff --git a/keyboards/ciaanh/kanagawa2040/keymaps/default/rules.mk b/keyboards/ciaanh/kanagawa2040/keymaps/default/rules.mk new file mode 100644 index 00000000000..ee325681483 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/ciaanh/kanagawa2040/keymaps/via/keymap.c b/keyboards/ciaanh/kanagawa2040/keymaps/via/keymap.c new file mode 100644 index 00000000000..6ef3d3e29dd --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/keymaps/via/keymap.c @@ -0,0 +1,138 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_MUTE, + KC_ENT, KC_0, KC_BSPC, + KC_7, KC_8, KC_9, + KC_4, KC_5, KC_6, + KC_1, KC_2, KC_3 + ), + [1] = LAYOUT( + _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______ + ), + [2] = LAYOUT( + _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______ + ), + [3] = LAYOUT( + _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______, + _______, _______, _______ + ), +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { + [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, + [1] = { ENCODER_CCW_CW(_______, _______) }, + [2] = { ENCODER_CCW_CW(_______, _______) }, + [3] = { ENCODER_CCW_CW(_______, _______) } +}; +#endif + + +#ifdef OLED_ENABLE +static void render_qmk_logo(void) { + static const char PROGMEM qmk_logo[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x3f, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3f, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, + 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x83, 0x83, 0x83, 0x83, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, + 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x83, 0x83, 0x83, 0x83, 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, + 0x81, 0x83, 0x83, 0x83, 0x83, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, + 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x83, 0x83, 0x83, 0x83, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x07, 0x1f, 0x3f, 0x7f, 0x7e, 0xf8, 0xf0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xff, 0xff, + 0xff, 0xff, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xf0, 0xf8, 0x7e, 0x7f, 0x3f, 0x1f, 0x07, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc0, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0xff, + 0xff, 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 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, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xfc, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, + 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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(qmk_logo, sizeof(qmk_logo)); +} + +bool oled_task_user(void) { + render_qmk_logo(); + return true; +} + +#endif + diff --git a/keyboards/ciaanh/kanagawa2040/keymaps/via/rules.mk b/keyboards/ciaanh/kanagawa2040/keymaps/via/rules.mk new file mode 100644 index 00000000000..715838ecc5d --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/keymaps/via/rules.mk @@ -0,0 +1,2 @@ +ENCODER_MAP_ENABLE = yes +VIA_ENABLE = yes diff --git a/keyboards/ciaanh/kanagawa2040/lib/oled_driver_spi.h b/keyboards/ciaanh/kanagawa2040/lib/oled_driver_spi.h new file mode 100644 index 00000000000..c8a2cd7d9a4 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/lib/oled_driver_spi.h @@ -0,0 +1,29 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 + +#ifndef OLED_DC_PIN +# error "The OLED driver in SPI needs a D/C pin defined" +#endif +#ifndef OLED_CS_PIN +# error "The OLED driver in SPI needs a CS pin defined" +#endif +#ifndef OLED_SPI_MODE +# define OLED_SPI_MODE 3 +#endif +#ifndef OLED_SPI_DIVISOR +# define OLED_SPI_DIVISOR 2 +#endif diff --git a/keyboards/ciaanh/kanagawa2040/lib/ssd1306_sh1106.c b/keyboards/ciaanh/kanagawa2040/lib/ssd1306_sh1106.c new file mode 100644 index 00000000000..dc1289fdb13 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/lib/ssd1306_sh1106.c @@ -0,0 +1,827 @@ +/* +Copyright 2019 Ryan Caltabiano +Copyright 2022 Jose Pablo Ramirez +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 . +*/ +#include "oled_driver.h" +#include "oled_driver_spi.h" + +#include "spi_master.h" + +#include +#include OLED_FONT_H +#include "timer.h" +#include "print.h" + +#include + +#include "progmem.h" + +#include "keyboard.h" + +// Used commands from spec sheet: https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf +// for SH1106: https://www.velleman.eu/downloads/29/infosheets/sh1106_datasheet.pdf + +// Fundamental Commands +#define CONTRAST 0x81 +#define DISPLAY_ALL_ON 0xA5 +#define DISPLAY_ALL_ON_RESUME 0xA4 +#define NORMAL_DISPLAY 0xA6 +#define INVERT_DISPLAY 0xA7 +#define DISPLAY_ON 0xAF +#define DISPLAY_OFF 0xAE +#define NOP 0xE3 + +// Scrolling Commands +#define ACTIVATE_SCROLL 0x2F +#define DEACTIVATE_SCROLL 0x2E +#define SCROLL_RIGHT 0x26 +#define SCROLL_LEFT 0x27 +#define SCROLL_RIGHT_UP 0x29 +#define SCROLL_LEFT_UP 0x2A + +// Addressing Setting Commands +#define MEMORY_MODE 0x20 +#define COLUMN_ADDR 0x21 +#define PAGE_ADDR 0x22 +#define PAM_SETCOLUMN_LSB 0x00 +#define PAM_SETCOLUMN_MSB 0x10 +#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7 + +// Hardware Configuration Commands +#define DISPLAY_START_LINE 0x40 +#define SEGMENT_REMAP 0xA0 +#define SEGMENT_REMAP_INV 0xA1 +#define MULTIPLEX_RATIO 0xA8 +#define COM_SCAN_INC 0xC0 +#define COM_SCAN_DEC 0xC8 +#define DISPLAY_OFFSET 0xD3 +#define COM_PINS 0xDA +#define COM_PINS_SEQ 0x02 +#define COM_PINS_ALT 0x12 +#define COM_PINS_SEQ_LR 0x22 +#define COM_PINS_ALT_LR 0x32 + +// Timing & Driving Commands +#define DISPLAY_CLOCK 0xD5 +#define PRE_CHARGE_PERIOD 0xD9 +#define VCOM_DETECT 0xDB + +// Advance Graphic Commands +#define FADE_BLINK 0x23 +#define ENABLE_FADE 0x20 +#define ENABLE_BLINK 0x30 + +// Charge Pump Commands +#define CHARGE_PUMP 0x8D + +// Misc defines +#ifndef OLED_BLOCK_COUNT +# define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) +#endif +#ifndef OLED_BLOCK_SIZE +# define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) +#endif + +#define OLED_ALL_BLOCKS_MASK (((((OLED_BLOCK_TYPE)1 << (OLED_BLOCK_COUNT - 1)) - 1) << 1) | 1) + +#define ARRAY_SIZE(arr) sizeof(arr)/sizeof(arr[0]) + +// spi defines +#define OLED_STATUS_SUCCESS SPI_STATUS_SUCCESS + +void oled_spi_init(void) { + spi_init(); + + setPinOutput(OLED_CS_PIN); + writePinHigh(OLED_CS_PIN); + + setPinOutput(OLED_DC_PIN); + writePinLow(OLED_DC_PIN); +} + +void oled_spi_start(void) { + spi_start(OLED_CS_PIN, false, OLED_SPI_MODE, OLED_SPI_DIVISOR); +} + +void oled_spi_stop(void) { + spi_stop(); +} + +// Transmit/Write Funcs. +bool oled_cmd(const uint8_t *data, uint16_t size) { + oled_spi_start(); + // Command Mode + writePinLow(OLED_DC_PIN); + // Send the commands + if(spi_transmit(data, size) != OLED_STATUS_SUCCESS){ + oled_spi_stop(); + return false; + } + oled_spi_stop(); + return true; +} + +bool oled_cmd_p(const uint8_t *data, uint16_t size) { + return oled_cmd(data, size); +} + +bool oled_write_reg(const uint8_t *data, uint16_t size) +{ + oled_spi_start(); + // Command Mode + writePinHigh(OLED_DC_PIN); + // Send the commands + if(spi_transmit(data, size) != OLED_STATUS_SUCCESS){ + oled_spi_stop(); + return false; + } + oled_spi_stop(); + return true; +} + +#define HAS_FLAGS(bits, flags) ((bits & flags) == flags) + +// Display buffer's is the same as the OLED memory layout +// this is so we don't end up with rounding errors with +// parts of the display unusable or don't get cleared correctly +// and also allows for drawing & inverting +uint8_t oled_buffer[OLED_MATRIX_SIZE]; +uint8_t * oled_cursor; +OLED_BLOCK_TYPE oled_dirty = 0; +bool oled_initialized = false; +bool oled_active = false; +bool oled_scrolling = false; +bool oled_inverted = false; +uint8_t oled_brightness = OLED_BRIGHTNESS; +oled_rotation_t oled_rotation = 0; +uint8_t oled_rotation_width = 0; +uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values +uint8_t oled_scroll_start = 0; +uint8_t oled_scroll_end = 7; +#if OLED_TIMEOUT > 0 +uint32_t oled_timeout; +#endif +#if OLED_SCROLL_TIMEOUT > 0 +uint32_t oled_scroll_timeout; +#endif +#if OLED_UPDATE_INTERVAL > 0 +uint16_t oled_update_timeout; +#endif + +// Flips the rendering bits for a character at the current cursor position +static void InvertCharacter(uint8_t *cursor) { + const uint8_t *end = cursor + OLED_FONT_WIDTH; + while (cursor < end) { + *cursor = ~(*cursor); + cursor++; + } +} + +bool oled_init(oled_rotation_t rotation) { + oled_rotation = oled_init_user(oled_init_kb(rotation)); + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + oled_rotation_width = OLED_DISPLAY_WIDTH; + } else { + oled_rotation_width = OLED_DISPLAY_HEIGHT; + } + + oled_spi_init(); + +#ifdef OLED_RST_PIN + /* Reset device */ + setPinOutput(OLED_RST_PIN); + writePinLow(OLED_RST_PIN); + wait_ms(20); + writePinHigh(OLED_RST_PIN); + wait_ms(20); +#endif + + static const uint8_t PROGMEM display_setup1[] = { + DISPLAY_OFF, + DISPLAY_CLOCK, + 0x80, + MULTIPLEX_RATIO, + OLED_DISPLAY_HEIGHT - 1, + DISPLAY_OFFSET, + 0x00, + DISPLAY_START_LINE | 0x00, + CHARGE_PUMP, + 0x14, +#if (OLED_IC != OLED_IC_SH1106) + // MEMORY_MODE is unsupported on SH1106 (Page Addressing only) + MEMORY_MODE, + 0x00, // Horizontal addressing mode +#endif + }; + + if (!oled_cmd_p(display_setup1, ARRAY_SIZE(display_setup1))) { + print("oled_init cmd set 1 failed\n"); + return false; + } + + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_180)) { + static const uint8_t PROGMEM display_normal[] = {SEGMENT_REMAP_INV, COM_SCAN_DEC}; + if (!oled_cmd_p(display_normal, ARRAY_SIZE(display_normal))) { + print("oled_init cmd normal rotation failed\n"); + return false; + } + } else { + static const uint8_t PROGMEM display_flipped[] = {SEGMENT_REMAP, COM_SCAN_INC}; + if (!oled_cmd_p(display_flipped, ARRAY_SIZE(display_flipped))) { + print("display_flipped failed\n"); + return false; + } + } + + static const uint8_t PROGMEM display_setup2[] = {COM_PINS, OLED_COM_PINS, CONTRAST, OLED_BRIGHTNESS, PRE_CHARGE_PERIOD, 0xF1, VCOM_DETECT, 0x20, DISPLAY_ALL_ON_RESUME, NORMAL_DISPLAY, DEACTIVATE_SCROLL, DISPLAY_ON}; + if (!oled_cmd_p(display_setup2, ARRAY_SIZE(display_setup2))) { + print("display_setup2 failed\n"); + return false; + } + +#if OLED_TIMEOUT > 0 + oled_timeout = timer_read32() + OLED_TIMEOUT; +#endif +#if OLED_SCROLL_TIMEOUT > 0 + oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT; +#endif + + oled_clear(); + oled_initialized = true; + oled_active = true; + oled_scrolling = false; + return true; +} + +__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + return rotation; +} +__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return rotation; +} + +void oled_clear(void) { + memset(oled_buffer, 0, sizeof(oled_buffer)); + oled_cursor = &oled_buffer[0]; + oled_dirty = OLED_ALL_BLOCKS_MASK; +} + +static void calc_bounds(uint8_t update_start, uint8_t *cmd_array) { + // Calculate commands to set memory addressing bounds. + uint8_t start_page = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_WIDTH; + uint8_t start_column = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_WIDTH; +#if (OLED_IC == OLED_IC_SH1106) + // Commands for Page Addressing Mode. Sets starting page and column; has no end bound. + // Column value must be split into high and low nybble and sent as two commands. + cmd_array[0] = PAM_PAGE_ADDR | start_page; + cmd_array[1] = PAM_SETCOLUMN_LSB | ((OLED_COLUMN_OFFSET + start_column) & 0x0f); + cmd_array[2] = PAM_SETCOLUMN_MSB | ((OLED_COLUMN_OFFSET + start_column) >> 4 & 0x0f); + cmd_array[3] = NOP; + cmd_array[4] = NOP; + cmd_array[5] = NOP; +#else + // Commands for use in Horizontal Addressing mode. + cmd_array[1] = start_column; + cmd_array[4] = start_page; + cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) % OLED_DISPLAY_WIDTH + cmd_array[1]; + cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_WIDTH - 1) / OLED_DISPLAY_WIDTH - 1; +#endif +} + +static void calc_bounds_90(uint8_t update_start, uint8_t *cmd_array) { + cmd_array[1] = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8; + cmd_array[4] = OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT; + cmd_array[2] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8 - 1 + cmd_array[1]; + ; + cmd_array[5] = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) % OLED_DISPLAY_HEIGHT / 8; +} + +uint8_t crot(uint8_t a, int8_t n) { + const uint8_t mask = 0x7; + n &= mask; + return a << n | a >> (-n & mask); +} + +static void rotate_90(const uint8_t *src, uint8_t *dest) { + for (uint8_t i = 0, shift = 7; i < 8; ++i, --shift) { + uint8_t selector = (1 << i); + for (uint8_t j = 0; j < 8; ++j) { + dest[i] |= crot(src[j] & selector, shift - (int8_t)j); + } + } +} + +void oled_render(void) { + if (!oled_initialized) { + return; + } + + // Do we have work to do? + oled_dirty &= OLED_ALL_BLOCKS_MASK; + if (!oled_dirty || oled_scrolling) { + return; + } + + // Find first dirty block + uint8_t update_start = 0; + while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) { + ++update_start; + } + + // Set column & page position + static uint8_t display_start[] = {COLUMN_ADDR, 0, OLED_DISPLAY_WIDTH - 1, PAGE_ADDR, 0, OLED_DISPLAY_HEIGHT / 8 - 1}; + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + calc_bounds(update_start, display_start); + } else { + calc_bounds_90(update_start, display_start); + } + + // Send column & page position + if (!oled_cmd(display_start, ARRAY_SIZE(display_start))) { + print("oled_render offset command failed\n"); + return; + } + + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + // Send render data chunk as is + if (!oled_write_reg(&oled_buffer[OLED_BLOCK_SIZE * update_start], OLED_BLOCK_SIZE)) { + print("oled_render data failed\n"); + return; + } + } else { + // Rotate the render chunks + const static uint8_t source_map[] = OLED_SOURCE_MAP; + const static uint8_t target_map[] = OLED_TARGET_MAP; + + static uint8_t temp_buffer[OLED_BLOCK_SIZE]; + memset(temp_buffer, 0, sizeof(temp_buffer)); + for (uint8_t i = 0; i < sizeof(source_map); ++i) { + rotate_90(&oled_buffer[OLED_BLOCK_SIZE * update_start + source_map[i]], &temp_buffer[target_map[i]]); + } + + // Send render data chunk after rotating + if (!oled_write_reg(temp_buffer, OLED_BLOCK_SIZE)) { + print("oled_render90 data failed\n"); + return; + } + } + + // Turn on display if it is off + oled_on(); + + // Clear dirty flag + oled_dirty &= ~((OLED_BLOCK_TYPE)1 << update_start); +} + +void oled_set_cursor(uint8_t col, uint8_t line) { + uint16_t index = line * oled_rotation_width + col * OLED_FONT_WIDTH; + + // Out of bounds? + if (index >= OLED_MATRIX_SIZE) { + index = 0; + } + + oled_cursor = &oled_buffer[index]; +} + +void oled_advance_page(bool clearPageRemainder) { + uint16_t index = oled_cursor - &oled_buffer[0]; + uint8_t remaining = oled_rotation_width - (index % oled_rotation_width); + + if (clearPageRemainder) { + // Remaining Char count + remaining = remaining / OLED_FONT_WIDTH; + + // Write empty character until next line + while (remaining--) + oled_write_char(' ', false); + } else { + // Next page index out of bounds? + if (index + remaining >= OLED_MATRIX_SIZE) { + index = 0; + remaining = 0; + } + + oled_cursor = &oled_buffer[index + remaining]; + } +} + +void oled_advance_char(void) { + uint16_t nextIndex = oled_cursor - &oled_buffer[0] + OLED_FONT_WIDTH; + uint8_t remainingSpace = oled_rotation_width - (nextIndex % oled_rotation_width); + + // Do we have enough space on the current line for the next character + if (remainingSpace < OLED_FONT_WIDTH) { + nextIndex += remainingSpace; + } + + // Did we go out of bounds + if (nextIndex >= OLED_MATRIX_SIZE) { + nextIndex = 0; + } + + // Update cursor position + oled_cursor = &oled_buffer[nextIndex]; +} + +// Main handler that writes character data to the display buffer +void oled_write_char(const char data, bool invert) { + // Advance to the next line if newline + if (data == '\n') { + // Old source wrote ' ' until end of line... + oled_advance_page(true); + return; + } + + if (data == '\r') { + oled_advance_page(false); + return; + } + + // copy the current render buffer to check for dirty after + static uint8_t oled_temp_buffer[OLED_FONT_WIDTH]; + memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH); + + _Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array"); + + // set the reder buffer data + uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index + if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) { + memset(oled_cursor, 0x00, OLED_FONT_WIDTH); + } else { + const uint8_t *glyph = &font[(cast_data - OLED_FONT_START) * OLED_FONT_WIDTH]; + memcpy_P(oled_cursor, glyph, OLED_FONT_WIDTH); + } + + // Invert if needed + if (invert) { + InvertCharacter(oled_cursor); + } + + // Dirty check + if (memcmp(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH)) { + uint16_t index = oled_cursor - &oled_buffer[0]; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (index / OLED_BLOCK_SIZE)); + // Edgecase check if the written data spans the 2 chunks + oled_dirty |= ((OLED_BLOCK_TYPE)1 << ((index + OLED_FONT_WIDTH - 1) / OLED_BLOCK_SIZE)); + } + + // Finally move to the next char + oled_advance_char(); +} + +void oled_write(const char *data, bool invert) { + const char *end = data + strlen(data); + while (data < end) { + oled_write_char(*data, invert); + data++; + } +} + +void oled_write_ln(const char *data, bool invert) { + oled_write(data, invert); + oled_advance_page(true); +} + +void oled_pan(bool left) { + uint16_t i = 0; + for (uint16_t y = 0; y < OLED_DISPLAY_HEIGHT / 8; y++) { + if (left) { + for (uint16_t x = 0; x < OLED_DISPLAY_WIDTH - 1; x++) { + i = y * OLED_DISPLAY_WIDTH + x; + oled_buffer[i] = oled_buffer[i + 1]; + } + } else { + for (uint16_t x = OLED_DISPLAY_WIDTH - 1; x > 0; x--) { + i = y * OLED_DISPLAY_WIDTH + x; + oled_buffer[i] = oled_buffer[i - 1]; + } + } + } + oled_dirty = OLED_ALL_BLOCKS_MASK; +} + +oled_buffer_reader_t oled_read_raw(uint16_t start_index) { + if (start_index > OLED_MATRIX_SIZE) start_index = OLED_MATRIX_SIZE; + oled_buffer_reader_t ret_reader; + ret_reader.current_element = &oled_buffer[start_index]; + ret_reader.remaining_element_count = OLED_MATRIX_SIZE - start_index; + return ret_reader; +} + +void oled_write_raw_byte(const char data, uint16_t index) { + if (index > OLED_MATRIX_SIZE) index = OLED_MATRIX_SIZE; + if (oled_buffer[index] == data) return; + oled_buffer[index] = data; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (index / OLED_BLOCK_SIZE)); +} + +void oled_write_raw(const char *data, uint16_t size) { + uint16_t cursor_start_index = oled_cursor - &oled_buffer[0]; + if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index; + for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) { + uint8_t c = *data++; + if (oled_buffer[i] == c) continue; + oled_buffer[i] = c; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); + } +} + +void oled_write_pixel(uint8_t x, uint8_t y, bool on) { + if (x >= oled_rotation_width) { + return; + } + uint16_t index = x + (y / 8) * oled_rotation_width; + if (index >= OLED_MATRIX_SIZE) { + return; + } + uint8_t data = oled_buffer[index]; + if (on) { + data |= (1 << (y % 8)); + } else { + data &= ~(1 << (y % 8)); + } + if (oled_buffer[index] != data) { + oled_buffer[index] = data; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (index / OLED_BLOCK_SIZE)); + } +} + +#if defined(__AVR__) +void oled_write_P(const char *data, bool invert) { + uint8_t c = pgm_read_byte(data); + while (c != 0) { + oled_write_char(c, invert); + c = pgm_read_byte(++data); + } +} + +void oled_write_ln_P(const char *data, bool invert) { + oled_write_P(data, invert); + oled_advance_page(true); +} + +void oled_write_raw_P(const char *data, uint16_t size) { + uint16_t cursor_start_index = oled_cursor - &oled_buffer[0]; + if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index; + for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) { + uint8_t c = pgm_read_byte(data++); + if (oled_buffer[i] == c) continue; + oled_buffer[i] = c; + oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); + } +} +#endif // defined(__AVR__) + +bool oled_on(void) { + if (!oled_initialized) { + return oled_active; + } + +#if OLED_TIMEOUT > 0 + oled_timeout = timer_read32() + OLED_TIMEOUT; +#endif + + static const uint8_t PROGMEM display_on[] = +#ifdef OLED_FADE_OUT + {FADE_BLINK, 0x00}; +#else + {DISPLAY_ON}; +#endif + + if (!oled_active) { + if (!oled_cmd_p(display_on, ARRAY_SIZE(display_on))) { + print("oled_on cmd failed\n"); + return oled_active; + } + oled_active = true; + } + return oled_active; +} + +bool oled_off(void) { + if (!oled_initialized) { + return !oled_active; + } + + static const uint8_t PROGMEM display_off[] = +#ifdef OLED_FADE_OUT + {FADE_BLINK, ENABLE_FADE | OLED_FADE_OUT_INTERVAL}; +#else + {DISPLAY_OFF}; +#endif + + if (oled_active) { + if (!oled_cmd_p(display_off, ARRAY_SIZE(display_off))) { + print("oled_off cmd failed\n"); + return oled_active; + } + oled_active = false; + } + return !oled_active; +} + +bool is_oled_on(void) { + return oled_active; +} + +uint8_t oled_set_brightness(uint8_t level) { + if (!oled_initialized) { + return oled_brightness; + } + + uint8_t set_contrast[] = { CONTRAST, level}; + if (oled_brightness != level) { + if (!oled_cmd(set_contrast, ARRAY_SIZE(set_contrast))) { + print("set_brightness cmd failed\n"); + return oled_brightness; + } + oled_brightness = level; + } + return oled_brightness; +} + +uint8_t oled_get_brightness(void) { + return oled_brightness; +} + +// Set the specific 8 lines rows of the screen to scroll. +// 0 is the default for start, and 7 for end, which is the entire +// height of the screen. For 128x32 screens, rows 4-7 are not used. +void oled_scroll_set_area(uint8_t start_line, uint8_t end_line) { + oled_scroll_start = start_line; + oled_scroll_end = end_line; +} + +void oled_scroll_set_speed(uint8_t speed) { + // Sets the speed for scrolling... does not take effect + // until scrolling is either started or restarted + // the ssd1306 supports 8 speeds + // FrameRate2 speed = 7 + // FrameRate3 speed = 4 + // FrameRate4 speed = 5 + // FrameRate5 speed = 0 + // FrameRate25 speed = 6 + // FrameRate64 speed = 1 + // FrameRate128 speed = 2 + // FrameRate256 speed = 3 + // for ease of use these are remaped here to be in order + static const uint8_t scroll_remap[8] = {7, 4, 5, 0, 6, 1, 2, 3}; + oled_scroll_speed = scroll_remap[speed]; +} + +bool oled_scroll_right(void) { + if (!oled_initialized) { + return oled_scrolling; + } + + // Dont enable scrolling if we need to update the display + // This prevents scrolling of bad data from starting the scroll too early after init + if (!oled_dirty && !oled_scrolling) { + uint8_t display_scroll_right[] = {SCROLL_RIGHT, 0x00, oled_scroll_start, oled_scroll_speed, oled_scroll_end, 0x00, 0xFF, ACTIVATE_SCROLL}; + if (!oled_cmd(display_scroll_right, ARRAY_SIZE(display_scroll_right))) { + print("oled_scroll_right cmd failed\n"); + return oled_scrolling; + } + oled_scrolling = true; + } + return oled_scrolling; +} + +bool oled_scroll_left(void) { + if (!oled_initialized) { + return oled_scrolling; + } + + // Dont enable scrolling if we need to update the display + // This prevents scrolling of bad data from starting the scroll too early after init + if (!oled_dirty && !oled_scrolling) { + uint8_t display_scroll_left[] = {SCROLL_LEFT, 0x00, oled_scroll_start, oled_scroll_speed, oled_scroll_end, 0x00, 0xFF, ACTIVATE_SCROLL}; + if (!oled_cmd(display_scroll_left, ARRAY_SIZE(display_scroll_left))) { + print("oled_scroll_left cmd failed\n"); + return oled_scrolling; + } + oled_scrolling = true; + } + return oled_scrolling; +} + +bool oled_scroll_off(void) { + if (!oled_initialized) { + return !oled_scrolling; + } + + if (oled_scrolling) { + static const uint8_t PROGMEM display_scroll_off[] = {DEACTIVATE_SCROLL}; + if (!oled_cmd_p(display_scroll_off, ARRAY_SIZE(display_scroll_off))) { + print("oled_scroll_off cmd failed\n"); + return oled_scrolling; + } + oled_scrolling = false; + oled_dirty = OLED_ALL_BLOCKS_MASK; + } + return !oled_scrolling; +} + +bool is_oled_scrolling(void) { + return oled_scrolling; +} + +bool oled_invert(bool invert) { + if (!oled_initialized) { + return oled_inverted; + } + + if (invert && !oled_inverted) { + static const uint8_t PROGMEM display_inverted[] = {INVERT_DISPLAY}; + if (!oled_cmd_p(display_inverted, ARRAY_SIZE(display_inverted))) { + print("oled_invert cmd failed\n"); + return oled_inverted; + } + oled_inverted = true; + } else if (!invert && oled_inverted) { + static const uint8_t PROGMEM display_normal[] = {NORMAL_DISPLAY}; + if (!oled_cmd_p(display_normal, ARRAY_SIZE(display_normal))) { + print("oled_invert cmd failed\n"); + return oled_inverted; + } + oled_inverted = false; + } + + return oled_inverted; +} + +uint8_t oled_max_chars(void) { + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + return OLED_DISPLAY_WIDTH / OLED_FONT_WIDTH; + } + return OLED_DISPLAY_HEIGHT / OLED_FONT_WIDTH; +} + +uint8_t oled_max_lines(void) { + if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { + return OLED_DISPLAY_HEIGHT / OLED_FONT_HEIGHT; + } + return OLED_DISPLAY_WIDTH / OLED_FONT_HEIGHT; +} + +void oled_task(void) { + if (!oled_initialized) { + return; + } + +#if OLED_UPDATE_INTERVAL > 0 + if (timer_elapsed(oled_update_timeout) >= OLED_UPDATE_INTERVAL) { + oled_update_timeout = timer_read(); + oled_set_cursor(0, 0); + oled_task_kb(); + } +#else + oled_set_cursor(0, 0); + oled_task_kb(); +#endif + +#if OLED_SCROLL_TIMEOUT > 0 + if (oled_dirty && oled_scrolling) { + oled_scroll_timeout = timer_read32() + OLED_SCROLL_TIMEOUT; + oled_scroll_off(); + } +#endif + + // Smart render system, no need to check for dirty + oled_render(); + + // Display timeout check +#if OLED_TIMEOUT > 0 + if (oled_active && timer_expired32(timer_read32(), oled_timeout)) { + oled_off(); + } +#endif + +#if OLED_SCROLL_TIMEOUT > 0 + if (!oled_scrolling && timer_expired32(timer_read32(), oled_scroll_timeout)) { +# ifdef OLED_SCROLL_TIMEOUT_RIGHT + oled_scroll_right(); +# else + oled_scroll_left(); +# endif + } +#endif +} + +__attribute__((weak)) bool oled_task_kb(void) { + return oled_task_user(); +} +__attribute__((weak)) bool oled_task_user(void) { + return true; +} diff --git a/keyboards/ciaanh/kanagawa2040/macropad.c b/keyboards/ciaanh/kanagawa2040/macropad.c new file mode 100644 index 00000000000..a82a2dabb1f --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/macropad.c @@ -0,0 +1,56 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 . + */ + +#include "macropad.h" + +#ifdef RGB_MATRIX_ENABLE + +#define NA NO_LED + +/* RGB Positioning */ +led_config_t g_led_config = { { + { NA, NA, NA }, + { 0, 1, 2 }, + { 3, 4, 5 }, + { 6, 7, 8 }, + { 9, 10, 11 } +}, { + { 0, 0 }, { 112, 0 }, { 224, 0}, + { 0, 21 }, { 112, 21 }, { 224, 21}, + { 0, 42 }, { 112, 42 }, { 224, 42}, + { 0, 64 }, { 112, 64 }, { 224, 64} +}, { + 4, 4, 4, + 4, 4, 4, + 4, 4, 4, + 4, 4, 4 +} }; + +#endif + +#ifdef ENCODER_ENABLE +bool encoder_update_kb(uint8_t index, bool clockwise) { + if (!encoder_update_user(index, clockwise)) { return false; } + if (index == 0) { + if (clockwise) { + tap_code_delay(KC_VOLU, 10); + } else { + tap_code_delay(KC_VOLD, 10); + } + } + return true; +} +#endif diff --git a/keyboards/ciaanh/kanagawa2040/macropad.h b/keyboards/ciaanh/kanagawa2040/macropad.h new file mode 100644 index 00000000000..6e2e3524b7d --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/macropad.h @@ -0,0 +1,38 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 + +#include "quantum.h" + +#define ___ KC_NO + +// clang-format off + #define LAYOUT( \ + K02, \ + K10, K11, K12, \ + K20, K21, K22, \ + K30, K31, K32, \ + K40, K41, K42 \ + ) \ + { \ + { ___, ___, K02 }, \ + { K10, K11, K12 }, \ + { K20, K21, K22 }, \ + { K30, K31, K32 }, \ + { K40, K41, K42 } \ + } +// clang-format on diff --git a/keyboards/ciaanh/kanagawa2040/mcuconf.h b/keyboards/ciaanh/kanagawa2040/mcuconf.h new file mode 100644 index 00000000000..198a2eea697 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/mcuconf.h @@ -0,0 +1,22 @@ +/* Copyright 2022 Jose Pablo Ramirez + * + * 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 + +#include_next + +#undef RP_SPI_USE_SPI1 +#define RP_SPI_USE_SPI1 TRUE diff --git a/keyboards/ciaanh/kanagawa2040/readme.md b/keyboards/ciaanh/kanagawa2040/readme.md new file mode 100644 index 00000000000..46b3f5ddb72 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/readme.md @@ -0,0 +1,42 @@ +https://learn.adafruit.com/using-qmk-on-rp2040-microcontrollers/adafruit-macropad-with-qmk + +qmk compile -kb ciaanh/kanagawa2040 -km default + +# Adafruit MacroPad RP2040 + +![AdafruitMacropad](https://i.imgur.com/dSBSwcJh.jpeg) + +A RP2040-powered Macropad with a 3x4 layout. + +- Keyboard Maintainer: [Jpe230](https://github.com/jpe230/) +- Hardware Supported: Adafruit MacroPad RP2040 +- Hardware Availability: [Barebones kit](https://www.adafruit.com/product/5100) [Starter Kit](https://www.adafruit.com/product/5128) + +Make example for this board (after setting up your build environment): + +```sh +qmk compile -kb adafruit/macropad -km default +``` + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +## Features + +- Raspberry Pi RP2040 Chip + 8MB Flash memory - Dual-core Cortex M0+ at ~130MHz with 264KB of RAM. +- 3x4 Mechanical key switch sockets - accepts any Cherry MX-compatible switches. Individually tied to GPIO pins (not matrix wired) +- One NeoPixel RGB LED per switch, on north side. +- Rotary encoder, 20 detents per rotation, with push-switch on GPIO pin. Push switch is also used for entering bootloader mode when held down on power-up or reset. +- 128x64 SH1106 Monochrome OLED display - On high-speed hardware SPI port for quick updates. +- 8mm Speaker/Buzzer - With Class D amplifier and RC filter, can be used to make simple beeps and sounds effects. (Unsupported for now) +- STEMMA QT Connector - Allows adding any I2C sensors/displays/devices with plug-and-play cables. +- Reset button - On the side, for quick restarting, press it twice to enter bootloader. +- Four M3 mounting bosses - Make custom enclosures easily. + +## Bootloader + +Enter the bootloader in 4 ways: + +* **Bootmagic reset**: Hold down the key just bellow the rotary encoder push-button on power-up. +* **Physical reset button**: Press twice the button on the side while the board is connected. +* **BOOT button** Hold down the rotary encoder push-button on power-up or reset. +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available. diff --git a/keyboards/ciaanh/kanagawa2040/rules.mk b/keyboards/ciaanh/kanagawa2040/rules.mk new file mode 100644 index 00000000000..3636424a714 --- /dev/null +++ b/keyboards/ciaanh/kanagawa2040/rules.mk @@ -0,0 +1,26 @@ +# MCU name +MCU = RP2040 +# Bootloader selection +BOOTLOADER = rp2040 +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +# AUDIO_DRIVER = pwm_software +ENCODER_ENABLE = yes +RGB_MATRIX_ENABLE = yes +RGB_MATRIX_DRIVER = WS2812 +WS2812_DRIVER = vendor +OLED_ENABLE = yes +OLED_DRIVER = custom +# Project specific files +SRC += lib/ssd1306_sh1106.c +QUANTUM_LIB_SRC += spi_master.c diff --git a/keyboards/ciaanh/pallas/config.h b/keyboards/ciaanh/pallas/config.h new file mode 100644 index 00000000000..e465a5b4f21 --- /dev/null +++ b/keyboards/ciaanh/pallas/config.h @@ -0,0 +1,3 @@ +#pragma once + +#include "config_common.h" \ No newline at end of file diff --git a/keyboards/ciaanh/pallas/lib/oledfont.c b/keyboards/ciaanh/pallas/lib/oledfont.c new file mode 100644 index 00000000000..bc10ba86aa4 --- /dev/null +++ b/keyboards/ciaanh/pallas/lib/oledfont.c @@ -0,0 +1,282 @@ +#include "progmem.h" + + + + + + + + +const unsigned char font[] PROGMEM = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 000 => + 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00, // 0x01 001 => sad + 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00, // 0x02 002 => smile + 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00, // 0x03 003 => heart + 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00, // 0x04 004 => diamond + 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00, // 0x05 005 => clover + 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, // 0x06 006 => spade + 0x00, 0x18, 0x3C, 0x18, 0x00, 0x00, // 0x07 007 => + 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, // 0x08 008 => + 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, // 0x09 009 => + 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00, // 0x0A 010 => + 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00, // 0x0B 011 => male symbol + 0x26, 0x29, 0x79, 0x29, 0x26, 0x00, // 0x0C 012 => female symbol + 0x40, 0x7F, 0x05, 0x05, 0x07, 0x00, // 0x0D 013 => + 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00, // 0x0E 014 => + 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00, // 0x0F 015 => + + 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00, // 0x10 016 => right + 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00, // 0x11 017 => left + 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, // 0x12 018 => + 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00, // 0x13 019 => !! + 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, // 0x14 020 => + 0x00, 0x66, 0x89, 0x95, 0x6A, 0x00, // 0x15 021 => + 0x60, 0x60, 0x60, 0x60, 0x60, 0x00, // 0x16 022 => + 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00, // 0x17 023 => + 0x08, 0x04, 0x7E, 0x04, 0x08, 0x00, // 0x18 024 => + 0x10, 0x20, 0x7E, 0x20, 0x10, 0x00, // 0x19 025 => + 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00, // 0x1A 026 => + 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00, // 0x1B 027 => + 0x1E, 0x10, 0x10, 0x10, 0x10, 0x00, // 0x1C 028 => + 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00, // 0x1D 029 => + 0x30, 0x38, 0x3E, 0x38, 0x30, 0x00, // 0x1E 030 => + 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, // 0x1F 031 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x20 032 => sp + 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, // 0x21 033 => ! + 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, // 0x22 034 => " + 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00, // 0x23 035 => # + 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00, // 0x24 036 => $ + 0x23, 0x13, 0x08, 0x64, 0x62, 0x00, // 0x25 037 => % + 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, // 0x26 038 => & + 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, // 0x27 039 => ' + 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, // 0x28 040 => ( + 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00, // 0x29 041 => ) + 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00, // 0x2A 042 => * + 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, // 0x2B 043 => + + 0x00, 0x80, 0x70, 0x30, 0x00, 0x00, // 0x2C 044 => , + 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, // 0x2D 045 => - + 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, // 0x2E 046 => . + 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, // 0x2F 047 => / + + 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, // 0x30 048 => 0 + 0x00, 0x42, 0x7F, 0x40, 0x00, 0x00, // 0x31 049 => 1 + 0x72, 0x49, 0x49, 0x49, 0x46, 0x00, // 0x32 050 => 2 + 0x21, 0x41, 0x49, 0x4D, 0x33, 0x00, // 0x33 051 => 3 + 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00, // 0x34 052 => 4 + 0x27, 0x45, 0x45, 0x45, 0x39, 0x00, // 0x35 053 => 5 + 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00, // 0x36 054 => 6 + 0x41, 0x21, 0x11, 0x09, 0x07, 0x00, // 0x37 055 => 7 + 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, // 0x38 056 => 8 + 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, // 0x39 057 => 9 + 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, // 0x3A 058 => : + 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, // 0x3B 059 => ; + 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, // 0x3C 060 => < + 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, // 0x3D 061 => = + 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, // 0x3E 062 => > + 0x02, 0x01, 0x59, 0x09, 0x06, 0x00, // 0x3F 063 => ? + + 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00, // 0x40 064 => @ + 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00, // 0x41 065 => A + 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00, // 0x42 066 => B + 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00, // 0x43 067 => C + 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00, // 0x44 068 => D + 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00, // 0x45 069 => E + 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00, // 0x46 070 => F + 0x3E, 0x41, 0x41, 0x51, 0x73, 0x00, // 0x47 071 => G + 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, // 0x48 072 => H + 0x00, 0x41, 0x7F, 0x41, 0x00, 0x00, // 0x49 073 => I + 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00, // 0x4A 074 => J + 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00, // 0x4B 075 => K + 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00, // 0x4C 076 => L + 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00, // 0x4D 077 => M + 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00, // 0x4E 078 => N + 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00, // 0x4F 079 => O + + 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00, // 0x50 080 => P + 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00, // 0x51 081 => Q + 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00, // 0x52 082 => R + 0x26, 0x49, 0x49, 0x49, 0x32, 0x00, // 0x53 083 => S + 0x03, 0x01, 0x7F, 0x01, 0x03, 0x00, // 0x54 084 => T + 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00, // 0x55 085 => U + 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00, // 0x56 086 => V + 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00, // 0x57 087 => W + 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, // 0x58 088 => X + 0x03, 0x04, 0x78, 0x04, 0x03, 0x00, // 0x59 089 => Y + 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, // 0x5A 090 => Z + 0x00, 0x7F, 0x41, 0x41, 0x41, 0x00, // 0x5B 091 => [ + 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, // 0x5C 092 => '\' + 0x00, 0x41, 0x41, 0x41, 0x7F, 0x00, // 0x5D 093 => ] + 0x04, 0x02, 0x01, 0x02, 0x04, 0x00, // 0x5E 094 => ^ + 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, // 0x5F 095 => _ + + 0x00, 0x03, 0x07, 0x08, 0x00, 0x00, // 0x60 096 => ` + 0x20, 0x54, 0x54, 0x78, 0x40, 0x00, // 0x61 097 => a + 0x7F, 0x28, 0x44, 0x44, 0x38, 0x00, // 0x62 098 => b + 0x38, 0x44, 0x44, 0x44, 0x28, 0x00, // 0x63 099 => c + 0x38, 0x44, 0x44, 0x28, 0x7F, 0x00, // 0x64 100 => d + 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, // 0x65 101 => e + 0x00, 0x08, 0x7E, 0x09, 0x02, 0x00, // 0x66 102 => f + 0x18, 0x24, 0x24, 0x1C, 0x78, 0x00, // 0x67 103 => g + 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, // 0x68 104 => h + 0x00, 0x44, 0x7D, 0x40, 0x00, 0x00, // 0x69 105 => i + 0x20, 0x40, 0x40, 0x3D, 0x00, 0x00, // 0x6A 106 => j + 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, // 0x6B 107 => k + 0x00, 0x41, 0x7F, 0x40, 0x00, 0x00, // 0x6C 108 => l + 0x7C, 0x04, 0x78, 0x04, 0x78, 0x00, // 0x6D 109 => m + 0x7C, 0x08, 0x04, 0x04, 0x78, 0x00, // 0x6E 110 => n + 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, // 0x6F 111 => o + + 0x7C, 0x18, 0x24, 0x24, 0x18, 0x00, // 0x70 112 => p + 0x18, 0x24, 0x24, 0x18, 0x7C, 0x00, // 0x71 113 => q + 0x7C, 0x08, 0x04, 0x04, 0x08, 0x00, // 0x72 114 => r + 0x48, 0x54, 0x54, 0x54, 0x24, 0x00, // 0x73 115 => s + 0x04, 0x04, 0x3F, 0x44, 0x24, 0x00, // 0x74 116 => t + 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00, // 0x75 117 => u + 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00, // 0x76 118 => v + 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00, // 0x77 119 => w + 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, // 0x78 120 => x + 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00, // 0x79 121 => y + 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, // 0x7A 122 => z + 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, // 0x7B 123 => { + 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, // 0x7C 124 => | + 0x00, 0x41, 0x36, 0x08, 0x00, 0x00, // 0x7D 125 => } + 0x02, 0x01, 0x02, 0x04, 0x02, 0x00, // 0x7E 126 => ~ + 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00, // 0x7F 127 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x80 128 => ============================= LOGOS =============================== + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x81 129 => + 0x80, 0xC0, 0xC0, 0xC0, 0xE0, 0xF0, // 0x82 130 => + 0xF0, 0xF0, 0xF8, 0xF8, 0xFF, 0xFF, // 0x83 131 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, // 0x84 132 => + 0xF8, 0xF8, 0xE0, 0x00, 0x00, 0x00, // 0x85 133 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x86 134 => + 0xE0, 0xF0, 0xF8, 0xF8, 0xF0, 0xE0, // 0x87 135 => + 0xE0, 0xC0, 0xC0, 0x80, 0x00, 0x00, // 0x88 136 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x89 137 => + 0x00, 0x80, 0xE0, 0xF0, 0xE0, 0xE0, // 0x8A 138 => + 0xE0, 0x00, 0x00, 0x00, 0xC0, 0xC0, // 0x8B 139 => + 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, // 0x8C 140 => + 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, // 0x8D 141 => + 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, // 0x8E 142 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, // 0x8F 143 => + + 0xC0, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, // 0x90 144 => + 0x40, 0x00, 0x00, 0x00, 0x80, 0x80, // 0x91 145 => + 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, // 0x92 146 => + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0x00, // 0x93 147 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x94 148 => + 0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC, // 0x95 149 => + 0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00, // 0x96 150 => + 0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E, // 0x97 151 => + 0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00, // 0x98 152 => + 0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B, // 0x99 153 => + 0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00, // 0x9A 154 => + 0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE, // 0x9B 155 => + 0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00, // 0x9C 156 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x9D 157 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x9E 158 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x9F 159 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA0 160 => + 0x00, 0x0C, 0x0E, 0x8E, 0xCE, 0xFF, // 0xA1 161 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA2 162 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA3 163 => + 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA4 164 => + 0x7F, 0x1F, 0x0F, 0x00, 0x00, 0x00, // 0xA5 165 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xA6 166 => + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xA7 167 => + 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7E, // 0xA8 168 => + 0x3E, 0x3C, 0xDC, 0xE8, 0xF8, 0xFC, // 0xA9 169 => + 0xFE, 0xFF, 0xFF, 0x7F, 0x7F, 0xFF, // 0xAA 170 => + 0xFE, 0xFC, 0xF0, 0xE0, 0xFF, 0xFF, // 0xAB 171 => + 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, // 0xAC 172 => + 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, // 0xAD 173 => + 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, // 0xAE 174 => + 0x80, 0xE0, 0xF0, 0xF8, 0xFE, 0xFF, // 0xAF 175 => + + 0xFF, 0xFF, 0x7F, 0x7F, 0xFF, 0xFF, // 0xB0 176 => + 0xFC, 0xF0, 0xE0, 0x83, 0x0F, 0x0F, // 0xB1 177 => + 0x1F, 0x3F, 0x7F, 0x7F, 0xFF, 0xFF, // 0xB2 178 => + 0xF9, 0xF1, 0xF1, 0xE1, 0xC1, 0xC0, // 0xB3 179 => + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xB4 180 => + 0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F, // 0xB5 181 => + 0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00, // 0xB6 182 => + 0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F, // 0xB7 183 => + 0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00, // 0xB8 184 => + 0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20, // 0xB9 185 => + 0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00, // 0xBA 186 => + 0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F, // 0xBB 187 => + 0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00, // 0xBC 188 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xBD 189 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xBE 190 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xBF 191 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC0 192 => + 0x00, 0x00, 0x00, 0x01, 0x03, 0x0F, // 0xC1 193 => + 0x0F, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, // 0xC2 194 => + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 0xC3 195 => + 0x7F, 0x7F, 0x7F, 0x3F, 0x1F, 0x1C, // 0xC4 196 => + 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, // 0xC5 197 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xC6 198 => + 0x03, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, // 0xC7 199 => + 0x1F, 0x03, 0x01, 0x00, 0x00, 0x00, // 0xC8 200 => + 0x00, 0x00, 0x01, 0x1F, 0x1F, 0x1F, // 0xC9 201 => + 0x1F, 0x1F, 0x1E, 0x1E, 0x0E, 0x0F, // 0xCA 202 => + 0x0F, 0x1F, 0x1F, 0x01, 0x0F, 0x0F, // 0xCB 203 => + 0x0F, 0x1F, 0x1F, 0x1F, 0x0F, 0x1F, // 0xCC 204 => + 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x1F, // 0xCD 205 => + 0x1F, 0x1F, 0x0F, 0x0F, 0x0F, 0x0F, // 0xCE 206 => + 0x0F, 0x01, 0x1F, 0x1F, 0x1F, 0x1F, // 0xCF 207 => + + 0x1E, 0x1E, 0x1E, 0x0E, 0x0F, 0x0F, // 0xD0 208 => + 0x1F, 0x1F, 0x0F, 0x01, 0x00, 0x0E, // 0xD1 209 => + 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, // 0xD2 210 => + 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, // 0xD3 211 => + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD4 212 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD5 213 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD6 214 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD7 215 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD8 216 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xD9 217 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDA 218 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDB 219 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDC 220 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDD 221 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDE 222 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xDF 223 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE0 224 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE1 225 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE2 226 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE3 227 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE4 228 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE5 229 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE6 230 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE7 231 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE8 232 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xE9 233 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEA 234 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEB 235 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEC 236 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xED 237 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEE 238 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xEF 239 => + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF0 240 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF1 241 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF2 242 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF3 243 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF4 244 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF5 245 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF6 246 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF7 247 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF8 248 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xF9 249 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFA 250 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFB 251 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFC 252 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFD 253 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0xFE 254 => + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // 0xFF 255 => +}; diff --git a/keyboards/ciaanh/pallas/pallas.c b/keyboards/ciaanh/pallas/pallas.c new file mode 100644 index 00000000000..a1b7c5e68a4 --- /dev/null +++ b/keyboards/ciaanh/pallas/pallas.c @@ -0,0 +1 @@ +#include "pallas.h" diff --git a/keyboards/ciaanh/pallas/pallas.h b/keyboards/ciaanh/pallas/pallas.h new file mode 100644 index 00000000000..e292e5ee745 --- /dev/null +++ b/keyboards/ciaanh/pallas/pallas.h @@ -0,0 +1,7 @@ +#pragma once + +#include "quantum.h" + +#ifdef KEYBOARD_ciaanh_pallas_rev1 +# include "rev1.h" +#endif diff --git a/keyboards/ciaanh/pallas/readme.md b/keyboards/ciaanh/pallas/readme.md new file mode 100644 index 00000000000..79b85c79e8a --- /dev/null +++ b/keyboards/ciaanh/pallas/readme.md @@ -0,0 +1,16 @@ +# Pallas + +A 75 key variant of the Alice keyboard designed for Elite-C + + Keyboard Maintainer : Ciaanh + + Hardware Supported : Pallas PCB + + Hardware Availability : https://github.com/Ciaanh/keyboards/tree/main/Pallas + + +Make example for this keyboard (after setting up your build environment): + + qmk compile -kb ciaanh/pallas -km default + +Driver issues https://docs.qmk.fm/#/faq_build?id=unknown-device-for-dfu-bootloader diff --git a/keyboards/ciaanh/pallas/rev1/config.h b/keyboards/ciaanh/pallas/rev1/config.h new file mode 100644 index 00000000000..ea3f9742bfc --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/config.h @@ -0,0 +1,56 @@ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ + +#define VENDOR_ID 0xC1E0 +#define PRODUCT_ID 0x0001 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Ciaanh +#define PRODUCT Pallas +#define DESCRIPTION Extended Alice + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +// wiring of each half +#define MATRIX_ROW_PINS { B7, D5, C7, F1, F0 } +#define MATRIX_COL_PINS { D3, D2, D4, C6, D7, E6, B4, B6, B2, B3, B1, F7, F6, F5, F4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#ifdef OLED_ENABLE + #define OLED_DISPLAY_128X64 + #define OLED_FONT_H "lib/oledfont.c" + #define OLED_FONT_END 255 +#endif + +#ifdef BACKLIGHT_ENABLE + #define BACKLIGHT_PIN B5 + #define BACKLIGHT_LEVELS 4 +#endif + +#ifdef RGBLIGHT_ENABLE + /* ws2812 RGB LED */ + #define RGB_DI_PIN B0 + #define RGBLED_NUM 4 + #define RGBLIGHT_LED_MAP { 0, 1, 2, 3} + + #define RGBLIGHT_ANIMATIONS + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE diff --git a/keyboards/ciaanh/pallas/rev1/info.json b/keyboards/ciaanh/pallas/rev1/info.json new file mode 100644 index 00000000000..0cf50600121 --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/info.json @@ -0,0 +1,89 @@ +{ + "keyboard_name": "Pallas rev 0", + "url": "", + "maintainer": "ciaanh", + "width": 25.25, + "height": 10.2, + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "0.2", "x": 3.75, "y": 0.89 }, + { "label": "0.11", "x": 20.25, "y": 0.89 }, + { "label": "0.14", "x": 23.5, "y": 0.89 }, + { "label": "0.0", "x": 1.75, "y": 1 }, + { "label": "0.1", "x": 2.75, "y": 1 }, + { "label": "0.12", "x": 21.25, "y": 1 }, + { "label": "0.13", "x": 22.25, "y": 1 }, + { "label": "1.0", "x": 1.5, "y": 2, "w": 1.5 }, + { "label": "1.1", "x": 3, "y": 2 }, + { "label": "1.12", "x": 21, "y": 2 }, + { "label": "1.13", "x": 22, "y": 2 }, + { "label": "1.14", "x": 23, "y": 2 }, + { "label": "2.0", "x": 1.25, "y": 3, "w": 1.75 }, + { "label": "2.1", "x": 3, "y": 3 }, + { "label": "2.12", "x": 21, "y": 3 }, + { "label": "2.13", "x": 22, "y": 3 }, + { "label": "2.14", "x": 23, "y": 3, "w": 2.25 }, + { "label": "2.14", "x": 23.5, "y": 3, "w": 1.25, "h": 2 }, + { "label": "1.6", "x": 11, "y": 3.25 }, + { "label": "1.7", "x": 12, "y": 3.25 }, + { "label": "3.8", "x": 13, "y": 3.25 }, + { "label": "3,0", "x": 1, "y": 4, "w": 2.25 }, + { "label": "3.1", "x": 3.25, "y": 4 }, + { "label": "3.13", "x": 20.75, "y": 4 }, + { "label": "3.14", "x": 21.75, "y": 4, "w": 1.75 }, + { "label": "2.6", "x": 11, "y": 4.25 }, + { "label": "2.7", "x": 12, "y": 4.25 }, + { "label": "4.8", "x": 13, "y": 4.25 }, + { "label": "4.1", "x": 2.5, "y": 5, "w": 1.25 }, + { "label": "4.0", "x": 1, "y": 5.25, "w": 1.25 }, + { "label": "3.6", "x": 11, "y": 5.25 }, + { "label": "3.7", "x": 12, "y": 5.25 }, + { "label": "4.9", "x": 13, "y": 5.25 }, + { "label": "4.14", "x": 22.75, "y": 5.25, "w": 1.25 }, + { "label": "4.6", "x": 11, "y": 6.25 }, + { "label": "4.7", "x": 12, "y": 6.25 }, + { "label": "4.10", "x": 13, "y": 6.25 }, + { "label": "0.3", "x": 5.1, "y": 0 }, + { "label": "0.4", "x": 6.1, "y": 0 }, + { "label": "0.5", "x": 7.1, "y": 0 }, + { "label": "0.6", "x": 8.1, "y": 0 }, + { "label": "1.2", "x": 4.55, "y": 1 }, + { "label": "1.3", "x": 5.55, "y": 1 }, + { "label": "1.4", "x": 6.55, "y": 1 }, + { "label": "1.5", "x": 7.55, "y": 1 }, + { "label": "2.2", "x": 4.75, "y": 2 }, + { "label": "2.3", "x": 5.75, "y": 2 }, + { "label": "2.4", "x": 6.75, "y": 2 }, + { "label": "2.5", "x": 7.75, "y": 2 }, + { "label": "3.2", "x": 5.22, "y": 3 }, + { "label": "3.3", "x": 6.22, "y": 3 }, + { "label": "3.4", "x": 7.22, "y": 3 }, + { "label": "3.5", "x": 8.22, "y": 3 }, + { "label": "4.3", "x": 6.5, "y": 4 }, + { "label": "4.4", "x": 7.75, "y": 4, "w": 2 }, + { "label": "4.2", "x": 5, "y": 4.1, "w": 1.25 }, + { "label": "4.5", "x": 0.25, "y": 4.1, "w": 1.25 }, + { "label": "4.11", "x": -1.5, "y": 4.1, "w": 1.25 }, + { "label": "0.7", "x": -9.1, "y": 5.1 }, + { "label": "0.8", "x": -8.1, "y": 5.1 }, + { "label": "0.9", "x": -7.1, "y": 5.1 }, + { "label": "0.10", "x": -6.1, "y": 5.1 }, + { "label": "1.8", "x": -8.55, "y": 6.1 }, + { "label": "1.9", "x": -7.550000000000001, "y": 6.1 }, + { "label": "1.10", "x": -6.550000000000001, "y": 6.1 }, + { "label": "1.11", "x": -5.550000000000001, "y": 6.1 }, + { "label": "2.8", "x": -8.75, "y": 7.1 }, + { "label": "2.9", "x": -7.75, "y": 7.1 }, + { "label": "2.10", "x": -6.75, "y": 7.1 }, + { "label": "2.11", "x": -5.75, "y": 7.1 }, + { "label": "3.9", "x": -9.22, "y": 8.1 }, + { "label": "3.10", "x": -8.22, "y": 8.1 }, + { "label": "3.11", "x": -7.220000000000001, "y": 8.1 }, + { "label": "3.12", "x": -6.220000000000001, "y": 8.1 }, + { "label": "4.12", "x": -9.75, "y": 9.1, "w": 2.75 }, + { "label": "4.13", "x": -6.25, "y": 9.2, "w": 1.25 } + ] + } + } +} diff --git a/keyboards/ciaanh/pallas/rev1/keymaps/default/config.h b/keyboards/ciaanh/pallas/rev1/keymaps/default/config.h new file mode 100644 index 00000000000..271f48d0011 --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/keymaps/default/config.h @@ -0,0 +1,3 @@ +#pragma once + +// place overrides here diff --git a/keyboards/ciaanh/pallas/rev1/keymaps/default/keycodes.h b/keyboards/ciaanh/pallas/rev1/keymaps/default/keycodes.h new file mode 100644 index 00000000000..6951774fd53 --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/keymaps/default/keycodes.h @@ -0,0 +1,46 @@ +#pragma once + +enum layers +{ + _BASE, + _FN, + _VS, + _CODE, + _TOOLS, + _LEFT, + _RIGHT +}; + +enum custom_keycodes +{ + VS_FRM = SAFE_RANGE, + COMM, + UNCOMM, + NEW_SAFE_RANGE, +}; + + +#define _SAVE LCTL(KC_S) + +#define VSC_FRM LSFT(LALT(KC_F)) +#define VSC_TRM LCTL(KC_GRV) +#define VSC_COM LCTL(KC_P) + +#define VS_INT LCTL(KC_J) +#define VS_QW LSFT(KC_F9) +#define VS_PEEK LALT(KC_F12) +#define VS_GREF LCTL(KC_F12) + +#define SC_SF12 LSFT(KC_F12) + +#define TO_BASE TO(_BASE) +#define TO_FN TG(_FN) +#define TO_VS TG(_VS) +#define TO_CODE TG(_CODE) + +#define L_TOOLS MO(_TOOLS) + +#define L_LFT MO(_LEFT) +#define L_RGT MO(_RIGHT) + +#define _SCREENSHOT LSFT(LGUI(KC_S)) diff --git a/keyboards/ciaanh/pallas/rev1/keymaps/default/keymap.c b/keyboards/ciaanh/pallas/rev1/keymaps/default/keymap.c new file mode 100644 index 00000000000..8f013a15f6c --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/keymaps/default/keymap.c @@ -0,0 +1,327 @@ +#include QMK_KEYBOARD_H +#include "keycodes.h" + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* Keymap: BASE + * + * ,---------------------------------------------------- ------------------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | \ | ` | + * |--------+-------+------+------+------+------+------+ ,-------+-------+-------. +------+------+------+------+------+------+--------+--------| + * | Tab | Q | W | E | R | T | | Pad_7 | Pad_8 | Pad_9 | | Y | U | I | O | P | [ | ] | + * |--------+-------+------+------+------+------+ +-------+-------+-------+ +------+------+------+------+------+--------+--------| + * | CapsL | A | S | D | F | G | | Pad_4 | Pad_5 | Pad_6 | | H | J | K | L | ; | ' | | + * |--------+-------+------+------+------+------+ +-------+-------+-------+ +------+------+------+------+------+--------+ Enter | + * | LShift | Z | X | C | V | B | | Pad_1 | Pad_2 | Pad_3 | | N | M | , | . | / | RShift | | + * |--------+-------+------+------+------+------+------+ +-------+-------+-------+ +------+------+------+------+------+------+--------+--------| + * | LCtrl | GUI | LAlt | RAlt | Del | | L_LFT| |KC_NLCK| Pad_0 |KC_PDOT| | L_RGT| | Space| | TO_FN| | _TOOLS | + * `-------------------------------------' `------' `-----------------------' `------' `------' `------' `--------' + * + */ + + [_BASE] = LAYOUT_Pallas( \ + KC_ESC , KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV , \ + KC_TAB , KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_RALT, KC_BSPC, L_LFT, KC_NLCK, KC_P0,KC_PDOT, L_RGT, KC_SPC, TO_FN, L_TOOLS \ + ), + + + /* Keymap: FN + * + * ,---------------------------------------------------- ------------------------------------------------------------. + * | | | | | | | | | | | | | | | | | + * |--------+-------+------+------+------+------+------+ ,------+------+------. +------+------+------+------+------+------+--------+--------| + * | | | | | | | |KC_F10|KC_F11|KC_F12| | | | | | | | | + * |--------+-------+------+------+------+------+ +------+------+------+ +------+------+------+------+------+--------+--------| + * | | | | | | | |KC_F7 |KC_F8 |KC_F9 | | | | | | | | | + * |--------+-------+------+------+------+------+ +------+------+------+ +------+------+------+------+------+--------+ | + * | | | | | | | |KC_F4 |KC_F5 |KC_F6 | | | | | | | | | + * |--------+-------+------+------+------+------+-----+ +------+------+------+ +-----+------+------+------+------+------+--------+--------| + * | | | | | | | | |KC_F1 |KC_F2 |KC_F3 | | | | | | TO_VS| | | + * `-------------------------------------' `-----' `--------------------' `-----' `------' `------' `--------' + * + */ + + [_FN] = LAYOUT_Pallas( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, KC_F7, KC_F8, KC_F9, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, KC_F4, KC_F5, KC_F6, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, _______, _______, TO_VS, _______ \ + ), + + + + /* Keymap: VS + + Visual Studio + KC_F9 => add breakpoint + VS_QW => quick view + VS_PEEK => peek definition + VS_GREF => go to implementation + VS_INT => force show intellisense + VS_FRM => format code CTL+K,D CTL+K,E + + KC_F12 => go to definition + SC_SF12 => find references + + _SAVE => save CTL+S + + * + * ,------------------------------------------------------ -------------------------------------------------------------. + * | | | | | | | | | | | | | | | | | + * |--------+-------+------+------+------+------+--------+ ,------+------+-------. +------+------+------+------+-------+------+--------+--------| + * | | | | | | | | KC_F5|KC_F10| KC_F11| | | | | | | | | + * |--------+-------+------+------+------+------+ +------+------+-------+ +------+------+------+-------+------+--------+--------| + * | | | | | | | | KC_F9| VS_QW|SC_SF12| | | | | | | | | + * |--------+-------+------+------+------+------+ +------+------+-------+ +------+------+------+-------+------+--------+ | + * | | | | | | | |VS_INT| | KC_F12| | | | | | | | | + * |--------+-------+------+------+------+------+-------+ +------+------+-------+ +------+------+------+------+-------+------+--------+--------| + * | | | | | | | | |VS_FRM| _SAVE|VS_GREF| | | | | |TO_CODE| | | + * `-------------------------------------' `-------' `---------------------' `------' `------' `-------' `--------' + * + */ + [_VS] = LAYOUT_Pallas( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, KC_F5, KC_F10, KC_F11, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, KC_F9, VS_QW, SC_SF12, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, VS_INT, XXXXXXX, KC_F12, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, VS_FRM, _SAVE, VS_GREF, _______, _______, TO_CODE, _______ \ + ), + + + + + + /* Keymap: CODE + + VS Code + VSC_COM => Command palette + VSC_FRM => format code ALT+SHIFT+F + VSC_TRM => open terminal + + KC_F12 => go to definition + SC_SF12 => find references + + _SAVE => save CTL+S + + * + * ,----------------------------------------------------- --------------------------------------------------------------. + * | | | | | | | | | | | | | | | | | + * |--------+-------+------+------+------+------+-------+ ,-------+------+-------. +-------+------+------+------+-------+------+--------+--------| + * | | | | | | | |VSC_TRM| |VSC_COM| | | | | | | | | + * |--------+-------+------+------+------+------+ +-------+------+-------+ +------+------+------+-------+------+--------+--------| + * | | | | | | | | | |SC_SF12| | | | | | | | | + * |--------+-------+------+------+------+------+ +-------+------+-------+ +------+------+------+-------+------+--------+ | + * | | | | | | | | | | KC_F12| | | | | | | | | + * |--------+-------+------+------+------+------+-------+ +-------+------+-------+ +------+------+------+------+-------+------+--------+--------| + * | | | | | | | | |VSC_FRM| _SAVE| | | | | | |TO_BASE| | | + * `-------------------------------------' `-------' `----------------------' `------' `------' `-------' `--------' + * + */ + [_CODE] = LAYOUT_Pallas( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, VSC_TRM, XXXXXXX, VSC_COM, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, SC_SF12, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, XXXXXXX, XXXXXXX, KC_F12, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, VSC_FRM, _SAVE, XXXXXXX, _______, _______, TO_BASE, _______ \ + ), + + + + + /* Keymap: TOOLS + * + * ,---------------------------------------------------- -----------------------------------------------------------------. + * | | | | | | | | |TD_PSCR| | | |BLToggle|RGBToggl| RGB_MOD| | + * |--------+-------+------+------+------+------+------+ ,------+------+------. +-------+------+------+------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | Step |Hue Inc |Hue Dec | | + * |--------+-------+------+------+------+------+ +------+------+------+ +------+------+------+--------+--------+--------+--------| + * | | | | | | | | | | | | | | | Inc |Sat Inc |Sat Dec | | + * |--------+-------+------+------+------+------+ +------+------+------+ +------+------+------+--------+--------+--------+ | + * | | | | | | | | | | | | | | | Dec |Bright +|Bright -| | + * |--------+-------+------+------+------+------+-------+ +------+------+------+ +------+------+------+------+--------+--------+--------+--------| + * | | | |_TOOLS| | | | | | | | | | | | | Britg | | | + * `-------------------------------------' `-------' `--------------------' `------' `------' `--------' `--------' + * + */ + [_TOOLS] = LAYOUT_Pallas( + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BL_TOGG, RGB_TOG, RGB_MOD, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BL_STEP, RGB_HUI, RGB_HUD, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BL_INC, RGB_SAI, RGB_SAD, XXXXXXX, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BL_DEC, RGB_VAI, RGB_SPD, \ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BL_BRTG, L_TOOLS \ + ), + + + + + /* Keymap: LEFT + * + * ,------------------------------------------------------ ------------------------------------------------------------. + * | | | | | | | | | | | | | | | | | + * |--------+-------+------+-------+------+-------+------+ ,------+------+------. +------+------+------+------+------+------+--------+--------| + * | | | UP | | |KC_HOME| | | | | | | | | | | | | + * |--------+-------+------+-------+------+-------+ +------+------+------+ +------+------+------+------+------+--------+--------| + * | | LEFT | DOWN | RIGHT | | KC_END| | | | | | | | | | | | | + * |--------+-------+------+-------+------+-------+ +------+------+------+ +------+------+------+------+------+--------+ | + * | | < > | | | | | | | | | | | | | | | | | + * |--------+-------+------+-------+------+-------+-----+ +------+------+------+ +-----+------+------+------+------+------+--------+--------| + * | | | COMM| UNCOMM| F DEL| | | | | | | | | | | | | | | + * `--------------------------------------' `-----' `--------------------' `-----' `------' `------' `--------' + * + */ + + [_LEFT] = LAYOUT_Pallas( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, KC_UP , _______, _______, KC_HOME, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, KC_LEFT, KC_DOWN,KC_RIGHT, _______, KC_END, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, KC_NUBS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, COMM, UNCOMM, KC_DEL, L_LFT, _______, _______, _______, L_RGT, _______, _______, _______ \ + ), + + + + /* Keymap: RIGHT + * + * ,---------------------------------------------------- ---------------------------------------------------------------. + * | | | | | | | | | | PREV | Play | NEXT | | |KC_PSCR| _SCREENSHOT| + * |--------+-------+------+------+------+------+------+ ,------+------+------. +------+------+------+------+------+------+--------+-----------| + * | | | | | | | | | | | |VOL DW| MUTE |VOL UP| | | | | + * |--------+-------+------+------+------+------+ +------+------+------+ +------+------+------+------+------+--------+-----------| + * | | | | | | | | | | | | | | | | | | | + * |--------+-------+------+------+------+------+ +------+------+------+ +------+------+------+------+------+--------+ | + * | | | | | | | | | | | | | | | | | | | + * |--------+-------+------+------+------+------+-----+ +------+------+------+ +-----+------+------+------+------+------+--------+-----------| + * | | | | | | | | | | | | | | | | | | | | + * `-------------------------------------' `-----' `--------------------' `-----' `------' `------' `-----------' + * + */ + + [_RIGHT] = LAYOUT_Pallas( + _______, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, KC_PSCR,_SCREENSHOT, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, L_LFT, _______, _______, _______, L_RGT, _______, _______, _______ \ + ) +}; + + + +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case VS_FRM: + if (record->event.pressed) { + SEND_STRING(SS_LCTL("kdke")); + } else { + } + break; + + case COMM: + if (record->event.pressed) { + SEND_STRING(SS_LCTL("kc")); + } else { + } + break; + + case UNCOMM: + if (record->event.pressed) { + SEND_STRING(SS_LCTL("ku")); + } else { + } + break; + } + return true; +} + + + +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ +/*****************************************************************************************************/ + +#ifdef OLED_ENABLE + +oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return OLED_ROTATION_180; +} + + +static void render_status(void) { + // 21 characters per line + // 16 cols / 8 rows + + oled_write_P(PSTR(" Pallas rev 0.3 "), false); + + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + switch (get_highest_layer(layer_state)) { + case _BASE: + oled_write_P(PSTR("Default\n"), false); + break; + case _FN: + oled_write_P(PSTR("[F]\n"), false); + break; + case _VS: + oled_write_P(PSTR("Visual Studio\n"), false); + break; + case _CODE: + oled_write_P(PSTR("VS Code\n"), false); + break; + default: + oled_write_P(PSTR("Undefined\n"), false); + } + + // Host Keyboard LED Status + led_t led_state = host_keyboard_led_state(); + oled_write_P(PSTR(" "), false); + oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false); + oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false); + oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false); + + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); + oled_write_ln("", false); +} + +static void render_pallas_logo(void) { + oled_set_cursor(0, 5); + + static const char PROGMEM pallas_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 + }; + + oled_write_P(pallas_logo, false); +} + + +bool oled_task_user(void) { + switch (get_highest_layer(layer_state)) { + case _TOOLS: + render_pallas_logo(); + break; + default: + render_status(); + } + + return false; +} +#endif diff --git a/keyboards/ciaanh/pallas/rev1/keymaps/default/rules.mk b/keyboards/ciaanh/pallas/rev1/keymaps/default/rules.mk new file mode 100644 index 00000000000..e41cb07da6d --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/keymaps/default/rules.mk @@ -0,0 +1,3 @@ +BACKLIGHT_ENABLE = yes +RGBLIGHT_ENABLE = yes +OLED_ENABLE = yes diff --git a/keyboards/ciaanh/pallas/rev1/rev1.c b/keyboards/ciaanh/pallas/rev1/rev1.c new file mode 100644 index 00000000000..e1dc05329e5 --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/rev1.c @@ -0,0 +1,17 @@ +#include "pallas.h" + + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + matrix_init_user(); +}; + +void shutdown_user(void) { + +} diff --git a/keyboards/ciaanh/pallas/rev1/rev1.h b/keyboards/ciaanh/pallas/rev1/rev1.h new file mode 100644 index 00000000000..7f462616476 --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/rev1.h @@ -0,0 +1,24 @@ +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. +* +* The first section contains all of the arguments representing the physical +* layout of the board and position of the keys. +* +* The second converts the arguments into a two-dimensional array which +* represents the switch matrix. +*/ +#define LAYOUT_Pallas( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \ + k10, k11, k12, k13, k14, k15, k16, k17, k38, k18, k19, k1a, k1b, k1c, k1d, k1e, \ + k20, k21, k22, k23, k24, k25, k26, k27, k48, k28, k29, k2a, k2b, k2c, k2d, k2e, \ + k30, k31, k32, k33, k34, k35, k36, k37, k49, k39, k3a, k3b, k3c, k3d, k3e, \ + k40, k41, k42, k43, k44, k45, k46, k47, k4a, k4b, k4c, k4d, k4e \ +) \ +{ \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, k2e }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e }, \ + { k40, k41, k42, k43, k44, k45, k46, k47, k48, k49, k4a, k4b, k4c, k4d, k4e } \ +} diff --git a/keyboards/ciaanh/pallas/rev1/rules.mk b/keyboards/ciaanh/pallas/rev1/rules.mk new file mode 100644 index 00000000000..03c4a826250 --- /dev/null +++ b/keyboards/ciaanh/pallas/rev1/rules.mk @@ -0,0 +1,5 @@ +BACKLIGHT_ENABLE = no +RGBLIGHT_ENABLE = no +OLED_ENABLE = no + + diff --git a/keyboards/ciaanh/pallas/rules.mk b/keyboards/ciaanh/pallas/rules.mk new file mode 100644 index 00000000000..c926ee2fb93 --- /dev/null +++ b/keyboards/ciaanh/pallas/rules.mk @@ -0,0 +1,32 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp +BOOTLOADER = qmk-dfu + +# 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 +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = no # 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 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +DEFAULT_FOLDER = ciaanh/pallas/rev1