diff --git a/keyboards/chimera_ergo_42/chimera_ergo_42.c b/keyboards/chimera_ergo_42/chimera_ergo_42.c new file mode 100644 index 000000000000..86902efa27ab --- /dev/null +++ b/keyboards/chimera_ergo_42/chimera_ergo_42.c @@ -0,0 +1,31 @@ +#include "chimera_ergo_42.h" + +void uart_init(void) { + SERIAL_UART_INIT(); +} + +void led_init(void) { + DDRD |= (1<<1); + PORTD |= (1<<1); + DDRF |= (1<<4) | (1<<5); + PORTF |= (1<<4) | (1<<5); +} + + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + matrix_init_user(); + uart_init(); + led_init(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + matrix_scan_user(); +} + +void led_set_kb(uint8_t usb_led) { + +} diff --git a/keyboards/chimera_ergo_42/chimera_ergo_42.h b/keyboards/chimera_ergo_42/chimera_ergo_42.h new file mode 100644 index 000000000000..a03a57424461 --- /dev/null +++ b/keyboards/chimera_ergo_42/chimera_ergo_42.h @@ -0,0 +1,81 @@ +#ifndef CHIMERA_ERGO_42_H +#define CHIMERA_ERGO_42_H + +#include "quantum.h" +#include "matrix.h" +//#include "backlight.h" +#include + +#define red_led_off PORTF |= (1 << 5) +#define red_led_on PORTF &= ~(1 << 5) +#define blu_led_off PORTF |= (1 << 4) +#define blu_led_on PORTF &= ~(1 << 4) +#define grn_led_off PORTD |= (1 << 1) +#define grn_led_on PORTD &= ~(1 << 1) + +#define set_led_off \ + red_led_off; \ + grn_led_off; \ + blu_led_off +#define set_led_red \ + red_led_on; \ + grn_led_off; \ + blu_led_off +#define set_led_blue \ + red_led_off; \ + grn_led_off; \ + blu_led_on +#define set_led_green \ + red_led_off; \ + grn_led_on; \ + blu_led_off +#define set_led_yellow \ + red_led_on; \ + grn_led_on; \ + blu_led_off +#define set_led_magenta \ + red_led_on; \ + grn_led_off; \ + blu_led_on +#define set_led_cyan \ + red_led_off; \ + grn_led_on; \ + blu_led_on +#define set_led_white \ + red_led_on; \ + grn_led_on; \ + blu_led_on + +/* +#define LED_B 5 +#define LED_R 6 +#define LED_G 7 + +#define all_leds_off PORTF &= ~(1< + +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 . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER unknown +#define PRODUCT Chimera Ergo fortytwo +#define DESCRIPTION q.m.k. keyboard firmware for Chimera Ergo fortytwo + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 12 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +//#define BACKLIGHT_LEVELS 3 + +#define ONESHOT_TIMEOUT 500 + + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +#define PREVENT_STUCK_MODIFIERS + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +//UART settings for communication with the RF microcontroller +#define SERIAL_UART_BAUD 1000000 +#define SERIAL_UART_DATA UDR1 +#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1) +#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1)) +#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1)) +#define SERIAL_UART_INIT() do { \ + /* baud rate */ \ + UBRR1L = SERIAL_UART_UBRR; \ + /* baud rate */ \ + UBRR1H = SERIAL_UART_UBRR >> 8; \ + /* enable TX and RX */ \ + UCSR1B = _BV(TXEN1) | _BV(RXEN1); \ + /* 8-bit data */ \ + UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \ + } while(0) + +#endif diff --git a/keyboards/chimera_ergo_42/info.json b/keyboards/chimera_ergo_42/info.json new file mode 100644 index 000000000000..2125c8ddfa8e --- /dev/null +++ b/keyboards/chimera_ergo_42/info.json @@ -0,0 +1,67 @@ +{ + "keyboard_name": "Chimera Ergo", + "url": "", + "maintainer": "qmk", + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "k00", "x": 0, "y": 1 }, + { "label": "k01", "x": 1, "y": 0.75 }, + { "label": "k02", "x": 2, "y": 0.25 }, + { "label": "k03", "x": 3, "y": 0 }, + { "label": "k04", "x": 4, "y": 0.25 }, + { "label": "k05", "x": 5, "y": 0.5 }, + { "label": "k06", "x": 9, "y": 0.5 }, + { "label": "k07", "x": 10, "y": 0.25 }, + { "label": "k08", "x": 11, "y": 0 }, + { "label": "k09", "x": 12, "y": 0.25 }, + { "label": "k10", "x": 13, "y": 0.75 }, + { "label": "k11", "x": 14, "y": 1 }, + { "label": "k12", "x": 0, "y": 2 }, + { "label": "k13", "x": 1, "y": 1.75 }, + { "label": "k14", "x": 2, "y": 1.25 }, + { "label": "k15", "x": 3, "y": 1 }, + { "label": "k16", "x": 4, "y": 1.25 }, + { "label": "k17", "x": 5, "y": 1.5 }, + { "label": "k18", "x": 9, "y": 1.5 }, + { "label": "k19", "x": 10, "y": 1.25 }, + { "label": "k20", "x": 11, "y": 1 }, + { "label": "k21", "x": 12, "y": 1.25 }, + { "label": "k22", "x": 13, "y": 1.75 }, + { "label": "k23", "x": 14, "y": 2 }, + { "label": "k24", "x": 0, "y": 3 }, + { "label": "k25", "x": 1, "y": 2.75 }, + { "label": "k26", "x": 2, "y": 2.25 }, + { "label": "k27", "x": 3, "y": 2 }, + { "label": "k28", "x": 4, "y": 2.25 }, + { "label": "k29", "x": 5, "y": 2.5 }, + { "label": "k30", "x": 9, "y": 2.5 }, + { "label": "k31", "x": 10, "y": 2.25 }, + { "label": "k32", "x": 11, "y": 2 }, + { "label": "k33", "x": 12, "y": 2.25 }, + { "label": "k34", "x": 13, "y": 2.75 }, + { "label": "k35", "x": 14, "y": 3 }, + { "label": "k36", "x": 0, "y": 4 }, + { "label": "k37", "x": 1, "y": 3.75 }, + { "label": "k38", "x": 2, "y": 3.25 }, + { "label": "k39", "x": 3, "y": 3 }, + { "label": "k40", "x": 4, "y": 3.25 }, + { "label": "k41", "x": 5, "y": 3.5 }, + { "label": "k42", "x": 9, "y": 3.5 }, + { "label": "k43", "x": 10, "y": 3.25 }, + { "label": "k44", "x": 11, "y": 3 }, + { "label": "k45", "x": 12, "y": 3.25 }, + { "label": "k46", "x": 13, "y": 3.75 }, + { "label": "k47", "x": 14, "y": 4 }, + + { "label": "k48", "x": 4, "y": 4.75 }, + { "label": "k49", "x": 5, "y": 5 }, + { "label": "k49", "x": 6, "y": 5.25 }, + + { "label": "k49", "x": 8, "y": 5.25 }, + { "label": "k50", "x": 9, "y": 5 }, + { "label": "k51", "x": 10, "y": 4.75 } + ] + } + } +} diff --git a/keyboards/chimera_ergo_42/keymaps/cbancroft/config.h b/keyboards/chimera_ergo_42/keymaps/cbancroft/config.h new file mode 100644 index 000000000000..a590773e73d6 --- /dev/null +++ b/keyboards/chimera_ergo_42/keymaps/cbancroft/config.h @@ -0,0 +1,45 @@ +#pragma once + +//** Config Options + +// this makes it possible to do rolling combos (zx) with keys that +// convert to other keys on hold (z becomes ctrl when you hold it, +// and when this option isn't enabled, z rapidly followed by x +// actually sends Ctrl-x. That's bad.) +#define IGNORE_MOD_TAP_INTERRUPT +#undef PERMISSIVE_HOLD +#define PREVENT_STUCK_MODIFIERS +#define TAPPING_TERM_PER_KEY +// #define TAPPING_FORCE_HOLD +//#define RETRO_TAPPING + +#define FORCE_NKRO + +#ifdef TAPPING_TERM +# undef TAPPING_TERM +#endif // TAPPING_TERM +#define TAPPING_TERM 190 + +/* Use I2C or Serial, not both */ + +/* Mouse Control Settings */ +#define MOUSEKEY_INTERVAL 20 +#define MOUSEKEY_DELAY 0 +#define MOUSEKEY_TIME_TO_MAX 60 +#define MOUSEKEY_MAX_SPEED 7 + +#define MOUSEKEY_WHEEL_DELAY 0 +#define MOUSEKEY_WHEEL_MAX_SPEED 8 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 40 + +// Disable action_get_macro and fn_actions, since we don't use these +// and it saves on space in the firmware. +#ifndef NO_DEBUG +# define NO_DEBUG +#endif // !NO_DEBUG + +#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE) +# define NO_PRINT +#endif // !NO_PRINT + +#define MACRO_TIMER 5 diff --git a/keyboards/chimera_ergo_42/keymaps/cbancroft/keymap.c b/keyboards/chimera_ergo_42/keymaps/cbancroft/keymap.c new file mode 100644 index 000000000000..e17722020c89 --- /dev/null +++ b/keyboards/chimera_ergo_42/keymaps/cbancroft/keymap.c @@ -0,0 +1,409 @@ +#include "eeconfig.h" +#include "chimera_ergo_42.h" + +enum cbancroft_ergo_42_layers { + _QWERTY, + _COLEMAK, + _SYMBOL, + _MOUSE, + _RAISE, + _FN = _RAISE, + _GAME, + // From chimera ergo42 default + _NUM, + _MEDIA, + _CAPS, + _NUMPAD, + _MACROS, + _NAV, + _SYMBOLS, + _OVER, + _ADJUST, +}; + +enum custom_keycodes { + KC_QTY = SAFE_RANGE, + KC_CMK, + KC_SYM, + KC_RSE, + KC_ADJ, + KC_OVER, +}; + +#define KC_THML1 LT(_MOUSE, KC_ESC) +#define KC_THML2 LT(_NAV, KC_SPC) +#define KC_THML3 LT(_MEDIA, KC_TAB) +#define KC_THMR1 LT(_FN, KC_ENT) +#define KC_THMR2 LT(_NUM, KC_BSPC) +#define KC_THMR3 LT(_SYMBOL, KC_DEL) + +#define KC_CLMS LT(_MOUSE, KC_ESC) // Mouse layer on hold, A on tap +#define KC_CLTL CTL_T(KC_R) // Ctrl on hold, R on tap +#define KC_CLLT LALT_T(KC_S) // Alt on hold, S on tap +#define KC_LCUI GUI_T(KC_T) // Gui on hold, T on tap + +#define KC_RCUI GUI_T(KC_N) // Gui on hold, N on tap +#define KC_CRLT LALT_T(KC_E) // Alt on hold, E on tap +#define KC_CRTL CTL_T(KC_I) // Ctrl on hold, I on tap +#define KC_CRMS LT(_MOUSE, KC_O) // Mouse layer on hold, O on tap +#define KC_RST RESET +#define KC_MTAB LT(_MEDIA, KC_TAB) +#define KC_FENT LT(_FN, KC_ENT) + +#define KC_NMPD TG(_NUMPAD) +#define KC_SYMB TG(_SYMBOLS) +#define KC_GAME TG(_GAME) +#define KC_NTAB LT(_NAV, KC_TAB) +#define KC_MESC LT(_MACROS, KC_ESC) +#define KC_INCL M(0) +#define KC_PULL M(1) +#define KC_PUSH M(2) +#define KC_SCAP M(3) +#define KC_SCOF M(4) +#define KC_LGHT M(5) +#define KC_CAD LALT(LCTL(KC_DEL)) + +//** /Config Options +// Fillers to make layering more clear +//#define _______ KC_TRNS +#define XXXXXXX KC_NO +#define KC_ KC_TRNS +#define KC_XXXX KC_TRNS + +#define _____QWERTY_L1_____ KC_Q, KC_W, KC_E, KC_R, KC_T +#define _____QWERTY_L2_____ KC_A, KC_S, KC_D, KC_F, KC_G +#define _____QWERTY_L3_____ KC_Z, KC_X, KC_C, KC_V, KC_B + +#define _____QWERTY_R1_____ KC_Y, KC_U, KC_I, KC_O, KC_P +#define _____QWERTY_R2_____ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define _____QWERTY_R3_____ KC_N, KC_H, KC_COMM, KC_DOT, KC_SLSH + +#define _____COLEMAKDH_L1_____ KC_Q, KC_W, KC_F, KC_P, KC_B +#define _____COLEMAKDH_L2_____ LALT_T(KC_A), LCTL_T(KC_R), GUI_T(KC_S), LSFT_T(KC_T), KC_G +#define _____COLEMAKDH_L3_____ KC_Z, KC_X, KC_C, KC_D, KC_V + +#define _____COLEMAKDH_R1_____ KC_J, KC_L, KC_U, KC_Y, KC_SCLN +#define _____COLEMAKDH_R2_____ KC_M, LSFT_T(KC_N), GUI_T(KC_E), LCTL_T(KC_I), LALT_T(KC_O) +#define _____COLEMAKDH_R3_____ KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH + +#define _____THUMBS_____L_____ LT(_MOUSE, KC_ESC), LT(_NAV, KC_SPC), LT(_MEDIA, KC_TAB) +#define _____THUMBS_____R_____ LT(_FN, KC_ENT), LT(_NUM, KC_BSPC), LT(_SYMBOL, KC_DEL) + +#define _____SYM_______L1_____ KC_SLSH, KC_MINS, KC_EQL, KC_EXLM, KC_LABK +#define _____SYM_______L2_____ KC_DQUO, KC_LBRC, KC_LCBR, KC_AT, KC_LPRN +#define _____SYM_______L3_____ KC_PERC, KC_HASH, KC_DLR, KC_GRV, KC_CIRC + +#define _____SYM_______R1_____ KC_RABK, KC_AMPR, KC_ASTR, KC_PLUS, KC_BSLS +#define _____SYM_______R2_____ KC_RPRN, KC_UNDS, KC_RCBR, KC_RBRC, KC_QUOT +#define _____SYM_______R3_____ KC_TRNS, KC_PIPE, KC_TILD, KC_QUES, KC_SLSH + +#define _____NUM_______L1_____ KC_RBRC, KC_7, KC_8, KC_9, KC_LBRC +#define _____NUM_______L2_____ KC_SCLN, KC_4, KC_5, KC_6, KC_EQL +#define _____NUM_______L3_____ KC_GRV, KC_1, KC_2, KC_3, KC_BSLS +#define _____NUM_______LT_____ KC_DOT, KC_0, KC_MINS + +#define _____FN________L1_____ KC_F12, KC_F7, KC_F8, KC_F9, KC_TRNS +#define _____FN________L2_____ KC_F11, KC_F4, KC_F5, KC_F6, KC_TRNS +#define _____FN________L3_____ KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUSE +#define _____FN_________T_____ KC_MENU, KC_SPC, KC_TAB + +#define _____INACTIVE__L1_____ KC_XXXX, KC_XXXX, KC_XXXX, KC_XXXX, KC_LOCK +#define _____INACTIVE__L2_____ KC_LALT, KC_LCTL, KC_LGUI, KC_LSFT, KC_XXXX +#define _____INACTIVE__L3_____ KC_XXXX, KC_RALT, KC_LEFT, KC_RGHT, KC_XXXX + +#define _____INACTIVE__R1_____ KC_LOCK, KC_XXXX, KC_XXXX, KC_XXXX, KC_RST +#define _____INACTIVE__R2_____ KC_XXXX, KC_LSFT, KC_LGUI, KC_LCTL, KC_LALT +#define _____INACTIVE__R3_____ KC_XXXX, KC_XXXX, KC_XXXX, KC_RALT, KC_XXXX +#define _____INACTIVE__TH_____ KC_XXXX, KC_XXXX, KC_XXXX + +#define _____MEDIA_____R1_____ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +#define _____MEDIA_____R2_____ KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, KC_TRNS +#define _____MEDIA_____R3_____ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS +#define _____MEDIA______T_____ KC_MSTP, KC_MPLY, KC_MUTE + +#define _____MOUSE_____R1_____ KC_XXXX, KC_XXXX, KC_XXXX, KC_XXXX, KC_XXXX +#define _____MOUSE_____R2_____ KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_XXXX +#define _____MOUSE_____R3_____ KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, KC_XXXX +#define _____MOUSE______T_____ KC_BTN1, KC_BTN3, KC_BTN2 + +#define _____NAV_______R1_____ KC_UNDO, KC_CUT, KC_COPY, KC_PSTE, KC_AGIN +#define _____NAV_______R2_____ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_CAPS +#define _____NAV_______R3_____ KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_INS +#define _____NAV________T_____ KC_ENT, KC_BSPC, KC_DEL +/* Blank + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , + // \------------------+----+----/ \---+----+----+--------------/ + +*/ +#define KEYMAP_chimera(...) KEYMAP(__VA_ARGS__) +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + // clang-format off + + [_QWERTY] = KEYMAP_chimera( + KC_ESC, _____QWERTY_L1_____, _____QWERTY_R1_____, KC_BSPC, + KC_NTAB, _____QWERTY_L2_____, _____QWERTY_R2_____, KC_ADJ, + KC_LSPO, _____QWERTY_L3_____, _____QWERTY_R3_____, KC_ENT, + _____THUMBS_____L_____, _____THUMBS_____R_____ + ), + + [_COLEMAK] = KEYMAP_chimera( + KC_NTAB, _____COLEMAKDH_L1_____, _____COLEMAKDH_R1_____, KC_MESC, + KC_BSPC, _____COLEMAKDH_L2_____, _____COLEMAKDH_R2_____, KC_ADJ, + KC_MTAB, _____COLEMAKDH_L3_____, _____COLEMAKDH_R3_____, KC_FENT, + _____THUMBS_____L_____, _____THUMBS_____R_____ + ), + + [_GAME] = KEYMAP_chimera( + KC_ESC , _____QWERTY_L1_____, _____QWERTY_R1_____, KC_BSLS, + CTL_T(KC_BSPC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, _____QWERTY_L3_____, _____QWERTY_R3_____, KC_ADJ, + _____THUMBS_____L_____, _____THUMBS_____R_____ + ), + + [_SYMBOL] = KEYMAP_chimera( + KC_TRNS, _____SYM_______L1_____, _____SYM_______R1_____, KC_TRNS, + KC_TRNS, _____SYM_______L2_____, _____SYM_______R2_____, KC_TRNS, + KC_TRNS, _____SYM_______L3_____, _____SYM_______R3_____, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS + ), + [_NUM] = KEYMAP_chimera( + KC_TRNS, _____NUM_______L1_____, _____INACTIVE__R1_____, KC_TRNS, + KC_TRNS, _____NUM_______L2_____, _____INACTIVE__R2_____, KC_TRNS, + KC_TRNS, _____NUM_______L3_____, _____INACTIVE__R3_____, KC_TRNS, + _____NUM_______LT_____, _____INACTIVE__TH_____ + ), + + [_MOUSE] = KEYMAP_chimera( + KC_TRNS, _____INACTIVE__L1_____, _____MOUSE_____R1_____, KC_TRNS, + KC_TRNS, _____INACTIVE__L2_____, _____MOUSE_____R2_____, KC_TRNS, + KC_TRNS, _____INACTIVE__L3_____, _____MOUSE_____R3_____, KC_TRNS, + _____INACTIVE__TH_____, _____MOUSE______T_____ + ), + + [_FN] = KEYMAP_chimera( + KC_TRNS, _____FN________L1_____, _____INACTIVE__R1_____, KC_TRNS, + KC_TRNS, _____FN________L2_____, _____INACTIVE__R2_____, KC_TRNS, + KC_TRNS, _____FN________L3_____, _____INACTIVE__R3_____, KC_TRNS, + _____FN_________T_____, _____INACTIVE__TH_____ + ), + + [_MEDIA] = KEYMAP_chimera( + KC_TRNS, _____INACTIVE__L1_____, _____MEDIA_____R1_____, KC_TRNS, + KC_TRNS, _____INACTIVE__L2_____, _____MEDIA_____R2_____, KC_TRNS, + KC_TRNS, _____INACTIVE__L3_____, _____MEDIA_____R3_____, KC_TRNS, + _____INACTIVE__TH_____, _____MEDIA______T_____ + ), + [_ADJUST] = KEYMAP_chimera( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + KC_TRNS, KC_RST,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_RST, KC_DEL, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + KC_TRNS,KC_TRNS,KC_TRNS,KC_GAME,KC_GAME,KC_TRNS, KC_TRNS, KC_QTY, KC_CMK,KC_TRNS,KC_TRNS,KC_TRNS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS + // \------------------+----+----/ \---+----+----+--------------/ + ), + + [_NAV] = KEYMAP_chimera( + KC_TRNS, _____INACTIVE__L1_____, _____NAV_______R1_____, KC_TRNS, + KC_TRNS, _____INACTIVE__L2_____, _____NAV_______R2_____, KC_TRNS, + KC_TRNS, _____INACTIVE__L3_____, _____NAV_______R3_____, KC_TRNS, + _____INACTIVE__TH_____, _____NAV________T_____ + ), +/* + [_SYMBOLS] = KEYMAP_chimera( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + CMK, EXLM, AT, HASH, DLR, PERC, CIRC, AMPR, ASTR, LPRN, RPRN, BSLS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + F1, F2, F3, F4, F5, F6, TILD, EQL, UNDS, LCBR, RCBR, XXXX, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + F7, F8, F9, F10, F11, F12, GRV, PLUS, MINS, LBRC, RBRC, XXXX + //|----+----+----+----+----+----| |----+----+----+----+----+----| + XXXX, PIPE, XXXX, XXXX, XXXX,XXXX + // \------------------+----+----/ \---+----+----+--------------/ + ), + + [_MACROS] = KEYMAP_chimera( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , , , , , , , , INCL, , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , CAD, , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + SCAP, , , , , , , , PULL, PUSH, , SCAP, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , + // \------------------+----+----/ \---+----+----+--------------/ + ), +*/ + // clang-format on +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch (id) { + /* include some kind of library or header */ + case 0: + if (record->event.pressed) { + SEND_STRING("#include <>"); + return MACRO(T(LEFT), END); + } + break; + case 1: + if (record->event.pressed) { + SEND_STRING("git pull"); + return MACRO(T(ENT), END); + } + break; + case 2: + if (record->event.pressed) { + SEND_STRING("git push"); + return MACRO(T(ENT), END); + } + break; + case 3: + if (record->event.pressed) { + layer_on(_CAPS); + register_code(KC_CAPSLOCK); + unregister_code(KC_CAPSLOCK); + } + break; + case 4: + if (record->event.pressed) { + layer_off(_CAPS); + register_code(KC_CAPSLOCK); + unregister_code(KC_CAPSLOCK); + } + break; + case 5: + if (record->event.pressed) { + set_led_green; + } + break; + } + return MACRO_NONE; +}; + +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); + uint8_t default_layer = eeconfig_read_default_layer(); + switch (layer) { + case _RAISE: + set_led_magenta; + break; + case _SYMBOL: + set_led_cyan; + break; + case _ADJUST: + set_led_off; + break; + case _CAPS: + set_led_white; + break; + case _NUMPAD: + set_led_blue; + break; + case _SYMBOLS: + set_led_red; + break; + case _NAV: + set_led_magenta; + break; + case _MACROS: + set_led_cyan; + break; + + case _GAME: + set_led_magenta; + break; + + default: + if (default_layer & (1UL << _COLEMAK)) { + set_led_white; + } else { + set_led_green; + } + break; + } +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_QTY: + if (record->event.pressed) { +#ifdef AUDIO_ENABLE + PLAY_SONG(song_qwerty); +#endif + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case KC_CMK: + if (record->event.pressed) { +#ifdef AUDIO_ENABLE + PLAY_SONG(song_colemak); +#endif + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case KC_SYM: + if (record->event.pressed) { + layer_on(_SYMBOL); + update_tri_layer(_SYMBOL, _RAISE, _ADJUST); + } else { + layer_off(_SYMBOL); + update_tri_layer(_SYMBOL, _RAISE, _ADJUST); + } + return false; + break; + case KC_RSE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_SYMBOL, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_SYMBOL, _RAISE, _ADJUST); + } + return false; + break; + case KC_ADJ: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} + +bool music_mask_user(uint16_t keycode) { + switch (keycode) { + case KC_RSE: + case KC_SYM: + return false; + default: + return true; + } +} + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LT(_FN, KC_ENT): + return TAPPING_TERM + 200; + default: + return TAPPING_TERM; + } +} diff --git a/keyboards/chimera_ergo_42/keymaps/default/keymap.c b/keyboards/chimera_ergo_42/keymaps/default/keymap.c new file mode 100644 index 000000000000..65a5dc26d473 --- /dev/null +++ b/keyboards/chimera_ergo_42/keymaps/default/keymap.c @@ -0,0 +1,194 @@ +// this is the style you want to emulate. +// This is the canonical layout file for the Quantum project. If you want to add another keyboard, + +#include "chimera_ergo_42.h" + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +enum chimera_ergo_42_layers +{ + _QWERTY, + _CAPS, + _NUMPAD, + _SYMBOLS, + _MACROS, + _NAV +}; + +#define KC_NMPD TG(_NUMPAD) +#define KC_SYMB TG(_SYMBOLS) +#define KC_NTAB LT(_NAV,KC_TAB) +#define KC_MESC LT(_MACROS, KC_ESC) +#define KC_INCL M(0) +#define KC_PULL M(1) +#define KC_PUSH M(2) +#define KC_SCAP M(3) +#define KC_SCOF M(4) +#define KC_LGHT M(5) +#define KC_CAD LALT(LCTL(KC_DEL)) + +#define LONGPRESS_DELAY 5000 +#define LAYER_TOGGLE_DELAY 5000 + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +#define KC_ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + MESC, Q , W , E , R , T , Y , U , I , O , P ,QUOT, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + NTAB, A , S , D , F , G , H , J , K , L ,SCLN,ENT , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LSPO, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH,RSPC, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + NMPD,BSPC,LALT, LCTL,SPC ,SYMB + // \------------------+----+----/ \---+----+----+--------------/ + ), + + [_CAPS] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , ,COLN, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + SCOF, , , , , , , , , , ,SCOF, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , + // \------------------+----+----/ \---+----+----+--------------/ + ), + + [_NUMPAD] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , ,COLN, , , , , 7 , 8 , 9 ,ASTR, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , ,DOT , , , , , 4 , 5 , 6 ,PLUS, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , 1 , 2 , 3 ,SLSH, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , 0 , + // \------------------+----+----/ \---+----+----+--------------/ + ), + + [_SYMBOLS] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSLS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + F1 , F2 , F3 , F4 , F5 , F6 , TILD,EQL ,UNDS,LCBR,RCBR, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + F7 , F8 , F9 ,F10 ,F11 ,F12 , GRV ,PLUS,MINS,LBRC,RBRC, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,PIPE, , , , + // \------------------+----+----/ \---+----+----+--------------/ + ), + + [_MACROS] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , , , , , , , ,INCL, , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , ,CAD , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + SCAP, , , , , , , ,PULL,PUSH, ,SCAP, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , + // \------------------+----+----/ \---+----+----+--------------/ + ), + + [_NAV] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + , , , , , , ,PGUP, UP ,PGDN,PSCR, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , ,LEFT,DOWN,RGHT, , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , ,DEL , , , + // \------------------+----+----/ \---+----+----+--------------/ + ), + + +}; + + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch(id) { + /* include some kind of library or header */ + case 0: + if (record->event.pressed) { + SEND_STRING("#include <>"); + return MACRO( T(LEFT), END); + } + break; + case 1: + if (record->event.pressed) { + SEND_STRING("git pull"); + return MACRO( T(ENT), END ); + } + break; + case 2: + if (record->event.pressed){ + SEND_STRING("git push"); + return MACRO( T(ENT), END ); + } + break; + case 3: + if (record->event.pressed){ + layer_on(_CAPS); + register_code(KC_CAPSLOCK); + unregister_code(KC_CAPSLOCK); + } + break; + case 4: + if (record->event.pressed){ + layer_off(_CAPS); + register_code(KC_CAPSLOCK); + unregister_code(KC_CAPSLOCK); + } + break; + case 5: + if (record->event.pressed){ + set_led_green; + } + break; + } + return MACRO_NONE; +}; + + +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); + + switch (layer) { + case _QWERTY: + set_led_green; + break; + case _CAPS: + set_led_white; + break; + case _NUMPAD: + set_led_blue; + break; + case _SYMBOLS: + set_led_red; + break; + case _NAV: + set_led_magenta; + break; + case _MACROS: + set_led_cyan; + break; + default: + set_led_green; + break; + } +}; diff --git a/keyboards/chimera_ergo_42/matrix.c b/keyboards/chimera_ergo_42/matrix.c new file mode 100644 index 000000000000..a253c14218c0 --- /dev/null +++ b/keyboards/chimera_ergo_42/matrix.c @@ -0,0 +1,127 @@ +/* +Copyright 2012 Jun Wako +Copyright 2014 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include +#include +#if defined(__AVR__) +# include +#endif +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "timer.h" + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#elif (MATRIX_COLS <= 16) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop16(matrix[i]) +# define ROW_SHIFTER ((uint16_t)1) +#elif (MATRIX_COLS <= 32) +# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n") +# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop32(matrix[i]) +# define ROW_SHIFTER ((uint32_t)1) +#endif + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; + +__attribute__((weak)) void matrix_init_quantum(void) { matrix_init_kb(); } + +__attribute__((weak)) void matrix_scan_quantum(void) { matrix_scan_kb(); } + +__attribute__((weak)) void matrix_init_kb(void) { matrix_init_user(); } + +__attribute__((weak)) void matrix_scan_kb(void) { matrix_scan_user(); } + +__attribute__((weak)) void matrix_init_user(void) {} + +__attribute__((weak)) void matrix_scan_user(void) {} + +inline uint8_t matrix_rows(void) { return MATRIX_ROWS; } + +inline uint8_t matrix_cols(void) { return MATRIX_COLS; } + +void matrix_init(void) { matrix_init_quantum(); } + +uint8_t matrix_scan(void) { + SERIAL_UART_INIT(); + + uint32_t timeout = 0; + + // the s character requests the RF slave to send the matrix + SERIAL_UART_DATA = 's'; + + // trust the external keystates entirely, erase the last data + uint8_t uart_data[14] = {0}; + + // there are 10 bytes corresponding to 10 columns, and an end byte + for (uint8_t i = 0; i < 14; i++) { + // wait for the serial data, timeout if it's been too long + // this only happened in testing with a loose wire, but does no + // harm to leave it in here + while (!SERIAL_UART_RXD_PRESENT) { + timeout++; + if (timeout > 10000) { + break; + } + } + uart_data[i] = SERIAL_UART_DATA; + } + + // check for the end packet, the key state bytes use the LSBs, so 0xE0 + // will only show up here if the correct bytes were recieved + if (uart_data[10] == 0xE0) { + // shifting and transferring the keystates to the QMK matrix variable + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + matrix[i] = (uint16_t)uart_data[i * 2] | (uint16_t)uart_data[i * 2 + 1] << 6; + } + } + + matrix_scan_quantum(); + return 1; +} + +inline bool matrix_is_on(uint8_t row, uint8_t col) { return (matrix[row] & ((matrix_row_t)1 < col)); } + +inline matrix_row_t matrix_get_row(uint8_t row) { return matrix[row]; } + +void matrix_print(void) { + print_matrix_header(); + + for (uint8_t row = 0; row < MATRIX_ROWS; row++) { + print_hex8(row); + print(": "); + print_matrix_row(row); + print("\n"); + } +} + +uint8_t matrix_key_count(void) { + uint8_t count = 0; + for (uint8_t i = 0; i < MATRIX_ROWS; i++) { + count += matrix_bitpop(i); + } + return count; +} diff --git a/keyboards/chimera_ergo_42/readme.md b/keyboards/chimera_ergo_42/readme.md new file mode 100644 index 000000000000..7208019e9a1d --- /dev/null +++ b/keyboards/chimera_ergo_42/readme.md @@ -0,0 +1,19 @@ +# Chimera Ergo 42 + +![Chimera Ergo 42](https://imgur.com/Yasp0s6) + +A split wireless 40% ergonomic keyboard + +Keyboard Maintainer: [William Wilson](https://github.com/GlenPickle) + + +Hardware Supported: Chimera Ergo PCB, WaveShare core nRF51822 + +Hardware Availability: [Gerbers](https://github.com/GlenPickle/Chimera/tree/master/ergo/gerbers) + +Make example for this keyboard (after setting up your build environment): + + make chimera_ergo:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. + diff --git a/keyboards/chimera_ergo_42/rules.mk b/keyboards/chimera_ergo_42/rules.mk new file mode 100644 index 000000000000..5d676eca4e0e --- /dev/null +++ b/keyboards/chimera_ergo_42/rules.mk @@ -0,0 +1,82 @@ + +OPT_DEFS += -DCHIMERA_ERGO_PROMICRO +CHIMERA_ERGO_UPLOAD_COMMAND = while [ ! -r $(USB) ]; do sleep 1; done; \ + avrdude -p $(MCU) -c avr109 -U flash:w:$(TARGET).hex -P $(USB) + +# # project specific files +SRC = matrix.c + + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Bootloader +# This definition is optional, and if your keyboard supports multiple bootloaders of +# different sizes, comment this out, and the correct address will be loaded +# automatically (+60). See bootloader.mk for all options. +BOOTLOADER = caterina + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +#BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +# COMMAND_ENABLE = yes # Commands for debug and configuration +CUSTOM_MATRIX = yes # Remote matrix from the wireless bridge +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA +# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +# MIDI_ENABLE = YES # MIDI controls +UNICODE_ENABLE = YES # Unicode +# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID + +USB = /dev/ttyACM0