diff options
author | フィルターペーパー <76888457+filterpaper@users.noreply.github.com> | 2023-12-27 12:28:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-26 20:28:06 -0800 |
commit | 594d03f4aaa01ea016f368aa74f5ed275635fc0d (patch) | |
tree | 68df39b17f769908ad78389a39e7d7489b4381f0 /keyboards/joshajohnson | |
parent | 2a048fbb650a24fcd9f2135c2dedec73c948589c (diff) |
Refactor: group hub keyboards (#22762)
Diffstat (limited to 'keyboards/joshajohnson')
24 files changed, 1412 insertions, 0 deletions
diff --git a/keyboards/joshajohnson/hub16/config.h b/keyboards/joshajohnson/hub16/config.h new file mode 100755 index 0000000000..68576635a8 --- /dev/null +++ b/keyboards/joshajohnson/hub16/config.h @@ -0,0 +1,32 @@ +/* +Copyright 2019 Josh Johnson + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + + +#define MATRIX_ROW_PINS \ + { F0, C7, C6, B6, E6} +#define MATRIX_COL_PINS \ + { F4, F1, D5, D3 } + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW + +/* 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/joshajohnson/hub16/info.json b/keyboards/joshajohnson/hub16/info.json new file mode 100644 index 0000000000..920b42feec --- /dev/null +++ b/keyboards/joshajohnson/hub16/info.json @@ -0,0 +1,69 @@ +{ + "keyboard_name": "Hub16", + "manufacturer": "Josh Johnson", + "url": "https://joshajohnson.com/hub16-keyboard/", + "maintainer": "Josh Johnson", + "usb": { + "vid": "0x6A6A", + "pid": "0x4810", + "device_version": "0.0.1" + }, + "encoder": { + "rotary": [ + {"pin_a": "F5", "pin_b": "F6"}, + {"pin_a": "B5", "pin_b": "B4"} + ] + }, + "rgblight": { + "saturation_steps": 8, + "brightness_steps": 8, + "led_count": 11, + "sleep": true, + "animations": { + "breathing": true, + "rainbow_mood": true, + "rainbow_swirl": true, + "snake": true, + "knight": true, + "christmas": true, + "static_gradient": true, + "rgb_test": true, + "alternating": true, + "twinkle": true + } + }, + "ws2812": { + "pin": "D1" + }, + "processor": "atmega32u4", + "bootloader": "caterina", + "debounce": 20, + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix": [4, 0], "x": 0.5, "y": 0}, + {"matrix": [4, 1], "x": 2.5, "y": 0}, + + {"matrix": [0, 0], "x": 0, "y": 1}, + {"matrix": [0, 1], "x": 1, "y": 1}, + {"matrix": [0, 2], "x": 2, "y": 1}, + {"matrix": [0, 3], "x": 3, "y": 1}, + + {"matrix": [1, 0], "x": 0, "y": 2}, + {"matrix": [1, 1], "x": 1, "y": 2}, + {"matrix": [1, 2], "x": 2, "y": 2}, + {"matrix": [1, 3], "x": 3, "y": 2}, + + {"matrix": [2, 0], "x": 0, "y": 3}, + {"matrix": [2, 1], "x": 1, "y": 3}, + {"matrix": [2, 2], "x": 2, "y": 3}, + {"matrix": [2, 3], "x": 3, "y": 3}, + + {"matrix": [3, 0], "x": 0, "y": 4}, + {"matrix": [3, 1], "x": 1, "y": 4}, + {"matrix": [3, 2], "x": 2, "y": 4}, + {"matrix": [3, 3], "x": 3, "y": 4} + ] + } + } +} diff --git a/keyboards/joshajohnson/hub16/keymaps/default/keymap.c b/keyboards/joshajohnson/hub16/keymaps/default/keymap.c new file mode 100755 index 0000000000..efe10d3743 --- /dev/null +++ b/keyboards/joshajohnson/hub16/keymaps/default/keymap.c @@ -0,0 +1,51 @@ +/* Copyright 2019 Josh Johnson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( /* Base */ + KC_MUTE, KC_MPLY, + KC_7, KC_8, KC_9, KC_PAST, + KC_4, KC_5, KC_6, KC_PMNS, + KC_1, KC_2, KC_3, KC_PPLS, + MO(1), KC_0, KC_PDOT,KC_PENT + ), + + [1] = LAYOUT( /* LED Control */ + _______, _______, + _______, RGB_MOD, RGB_RMOD, RGB_TOG, + RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, + RGB_SAD, RGB_SAI, _______, _______, + _______, _______, QK_BOOT, _______ + ), +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* Left Encoder */ + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + } else if (index == 1) { /* Right Encoder */ + if (clockwise) { + tap_code(KC_MPRV); + } else { + tap_code(KC_MNXT); + } + } + return true; +} diff --git a/keyboards/joshajohnson/hub16/keymaps/peepeetee/config.h b/keyboards/joshajohnson/hub16/keymaps/peepeetee/config.h new file mode 100644 index 0000000000..62b0df937b --- /dev/null +++ b/keyboards/joshajohnson/hub16/keymaps/peepeetee/config.h @@ -0,0 +1,45 @@ +/* +Copyright 2019 Josh Johnson + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +// /*== customize breathing effect ==*/ +// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +// /*==== use exp() and sin() ====*/ +// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 +// #endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 20 + +// Time out one shot layers after 3 seconds +#define ONESHOT_TIMEOUT 3000 + +// Undef and redefine default brightness to half of 255 +#undef RGBLIGHT_LIMIT_VAL +#define RGBLIGHT_LIMIT_VAL 255 + +//Define a preview timeout for RGB reviews +#define PREVIEW_TIMEOUT 5000 + +// Enable Light Layers implementation +#define RGBLIGHT_LAYERS +// Allow Light Layers to override RGB off configuration +#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF diff --git a/keyboards/joshajohnson/hub16/keymaps/peepeetee/keymap.c b/keyboards/joshajohnson/hub16/keymaps/peepeetee/keymap.c new file mode 100644 index 0000000000..dac88c8482 --- /dev/null +++ b/keyboards/joshajohnson/hub16/keymaps/peepeetee/keymap.c @@ -0,0 +1,209 @@ +/* +Copyright 2019 Josh Johnson 2021 peepeetee + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include QMK_KEYBOARD_H + +#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) +static uint32_t rgb_preview_timer = 0; +#endif + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + + // Layer 0 - Base Layer (F13 to F24, and One Shot Layer 1,2,3 or Toggle Layer 4) + [0] = LAYOUT( + KC_MPLY, KC_MUTE, + TG(3), TG(2), TG(1), TG(0), + KC_PSCR, KC_SCRL, KC_PAUS, A(KC_F4), + KC_INS, KC_HOME, KC_PGUP, KC_F12, //Transparent to let you go between layers + KC_DEL, A(KC_F4), KC_PGDN, KC_CALCULATOR + + ), + + [1] = LAYOUT( + KC_MPLY, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_F7, KC_F8, KC_F9, KC_F10, + KC_F4, KC_F5, KC_F6, KC_F11, + KC_F1, KC_F2, KC_F3, KC_F12 //Transparent to let you go between layers + ), + + + //Layer 5 - Keyboard Lights, Programming and Special Functions + [2] = LAYOUT( + KC_MPLY, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, //Transparent to let you go between layers + RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, + RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, + RGB_TOG, EE_CLR, QK_BOOT, KC_TRNS + ), + + [3] = LAYOUT( + KC_MPLY, KC_MUTE, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, //Transparent to let you go between layers + RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, + RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, + RGB_TOG, EE_CLR, QK_BOOT, KC_TRNS + ) + + + //Layer 0 - Base Layer (F13 to F24, and One Shot Layer 1,2,3 or Toggle Layer 4) + // [0] = LAYOUT( + // KC_MPLY, KC_MUTE, + // KC_F13, KC_F14, KC_F15, KC_F16, + // KC_F17, KC_F18, KC_F19, KC_F20, + // KC_F21, KC_F22, KC_F23, KC_F24, + // OSL(1), OSL(2), OSL(3), TG(4) //Transparent to let you go between layers + // ), + + // [1] = LAYOUT( + // KC_MPLY, KC_MUTE, + // LALT(KC_F13), LALT(KC_F14), LALT(KC_F15), LALT(KC_F16), + // LALT(KC_F17), LALT(KC_F18), LALT(KC_F19), LALT(KC_F20), + // LALT(KC_F21), LALT(KC_F22), LALT(KC_F23), LALT(KC_F24), + // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers + // ), + + //Layer 2 - Shift + Function Key Layer + // [2] = LAYOUT( + // KC_MPLY, KC_MUTE, + // LSFT(KC_F13), LSFT(KC_F14), LSFT(KC_F15), LSFT(KC_F16), + // LSFT(KC_F17), LSFT(KC_F18), LSFT(KC_F19), LSFT(KC_F20), + // LSFT(KC_F21), LSFT(KC_F22), LSFT(KC_F23), LSFT(KC_F24), + // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers + // ), + + // //Layer 3 - Control + Function Key + // [3] = LAYOUT( + // KC_MPLY, KC_MUTE, + // LCTL(KC_F13), LCTL(KC_F14), LCTL(KC_F15), LCTL(KC_F16), + // LCTL(KC_F17), LCTL(KC_F18), LCTL(KC_F19), LCTL(KC_F20), + // LCTL(KC_F21), LCTL(KC_F22), LCTL(KC_F23), LCTL(KC_F24), + // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers + // ), + + // //Layer 4 - Multimedia + // [4] = LAYOUT( + // KC_MPLY, KC_MUTE, + // KC_MPRV, KC_MPLY, KC_U, KC_K, + // KC_NO, KC_NO, KC_ENT, KC_X, + // KC_NO, QK_BOOT, LSFT(KC_HASH), KC_J, + // TG(5), KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers + // ), + + // //Layer 5 - Keyboard Lights, Programming and Special Functions + // [5] = LAYOUT( + // KC_MPLY, KC_MUTE, + // RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, + // RGB_RMOD, RGB_HUD, RGB_SAD, RGB_VAD, + // RGB_TOG, EE_CLR, QK_BOOT, KC_LSFT, + // KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS //Transparent to let you go between layers + // ), +}; + +const rgblight_segment_t PROGMEM my_layer0_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0,16,HSV_WHITE} + ); +const rgblight_segment_t PROGMEM my_layer1_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0,16,HSV_ORANGE} + ); + const rgblight_segment_t PROGMEM my_layer2_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0,16,HSV_RED} + ); + const rgblight_segment_t PROGMEM my_layer3_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0,16,HSV_BLUE} + ); +// const rgblight_segment_t PROGMEM my_layer4_layer[] = RGBLIGHT_LAYER_SEGMENTS( +// {0,16,HSV_WHITE} +// ); +// const rgblight_segment_t PROGMEM my_layer5_layer[] = RGBLIGHT_LAYER_SEGMENTS( +// {0,16,HSV_TEAL} +// ); +const rgblight_segment_t* const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + my_layer0_layer, + my_layer1_layer, + my_layer2_layer, + my_layer3_layer//, + // my_layer4_layer, + // my_layer5_layer + ); + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* Left Encoder */ + if (clockwise) { + tap_code(KC_MPRV); + } else { + tap_code(KC_MNXT); + } + } else if (index == 1) { /* Right Encoder */ + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + } + return true; +} +void post_process_record_user(uint16_t keycode, keyrecord_t *record) { + // Allow for a preview of changes when modifying RGB +# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) + switch (keycode) { + case RGB_TOG ... QK_VELOCIKEY_TOGGLE: + for (uint8_t i = 0; i < RGBLIGHT_MAX_LAYERS; i++) { + rgblight_set_layer_state(i, false); + } + rgb_preview_timer = timer_read32(); + break; + } +# endif + return; +} + +//Set the appropriate layer color +layer_state_t layer_state_set_user(layer_state_t state) { + rgblight_set_layer_state(0, false); + rgblight_set_layer_state(1, layer_state_cmp(state, 1)); + rgblight_set_layer_state(2, layer_state_cmp(state, 2)); + rgblight_set_layer_state(3, layer_state_cmp(state, 3)); + // rgblight_set_layer_state(4, layer_state_cmp(state, 4)); + // rgblight_set_layer_state(5, layer_state_cmp(state, 5)); + return state; +} + +void keyboard_post_init_user(void) { + //Enable the LED layers + rgblight_layers = my_rgb_layers; + layer_state_set_user(layer_state); +} + +void matrix_scan_user(void) { +# if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_LAYERS) + // Allow preview for + if (rgb_preview_timer && TIMER_DIFF_32(timer_read32(), rgb_preview_timer) > PREVIEW_TIMEOUT) { + rgb_preview_timer = 0; + default_layer_state_set_user(default_layer_state); + layer_state_set_user(layer_state); + led_update_user((led_t) host_keyboard_leds()); + } +# endif +} + +//EEPROM Reset Function +void eeconfig_init_user(void) { + rgblight_enable(); // Enable RGB by default + rgblight_sethsv(HSV_ORANGE); // Set it to orange by default +} diff --git a/keyboards/joshajohnson/hub16/keymaps/peepeetee/rules.mk b/keyboards/joshajohnson/hub16/keymaps/peepeetee/rules.mk new file mode 100644 index 0000000000..f6737b8e4a --- /dev/null +++ b/keyboards/joshajohnson/hub16/keymaps/peepeetee/rules.mk @@ -0,0 +1 @@ +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
\ No newline at end of file diff --git a/keyboards/joshajohnson/hub16/keymaps/via/keymap.c b/keyboards/joshajohnson/hub16/keymaps/via/keymap.c new file mode 100755 index 0000000000..1f5a4d4b12 --- /dev/null +++ b/keyboards/joshajohnson/hub16/keymaps/via/keymap.c @@ -0,0 +1,67 @@ +/* Copyright 2019 Josh Johnson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( /* Base */ + KC_MUTE, KC_MPLY, + KC_7, KC_8, KC_9, KC_PAST, + KC_4, KC_5, KC_6, KC_PMNS, + KC_1, KC_2, KC_3, KC_PPLS, + MO(1), KC_0, KC_PDOT, KC_PENT + ), + + [1] = LAYOUT( /* LED Control */ + _______, _______, + _______, RGB_MOD, RGB_RMOD, RGB_TOG, + RGB_VAD, RGB_VAI, RGB_HUD, RGB_HUI, + RGB_SAD, RGB_SAI, _______, _______, + _______, _______, QK_BOOT, _______ + ), + + [2] = LAYOUT( + _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ), + + [3] = LAYOUT( + _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ + ), +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* Left Encoder */ + if (clockwise) { + tap_code(KC_VOLD); + } else { + tap_code(KC_VOLU); + } + } else if (index == 1) { /* Right Encoder */ + if (clockwise) { + tap_code(KC_MPRV); + } else { + tap_code(KC_MNXT); + } + } + return true; +} diff --git a/keyboards/joshajohnson/hub16/keymaps/via/rules.mk b/keyboards/joshajohnson/hub16/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/joshajohnson/hub16/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/joshajohnson/hub16/matrix.c b/keyboards/joshajohnson/hub16/matrix.c new file mode 100644 index 0000000000..4f32070e66 --- /dev/null +++ b/keyboards/joshajohnson/hub16/matrix.c @@ -0,0 +1,128 @@ +/* +Copyright 2012-2018 Jun Wako, Jack Humbert, Yiancar + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#include <stdint.h> +#include <stdbool.h> +#include "wait.h" +#include "util.h" +#include "matrix.h" +#include "quantum.h" + +// Encoder things +#define SWITCH_1 F7 +#define SWITCH_2 D7 +static bool read_encoder_switches(matrix_row_t current_matrix[], uint8_t current_row); + +static const pin_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const pin_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values +extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values + +static void select_row(uint8_t row) { + setPinOutput(row_pins[row]); + writePinLow(row_pins[row]); +} + +static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); } + +static void unselect_rows(void) { + for (uint8_t x = 0; x < MATRIX_ROWS; x++) { + setPinInputHigh(row_pins[x]); + } +} + +static void init_pins(void) { + unselect_rows(); + for (uint8_t x = 0; x < MATRIX_COLS; x++) { + setPinInputHigh(col_pins[x]); + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + wait_us(30); + + // For each col... + for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + // Select the col pin to read (active low) + uint8_t pin_state = readPin(col_pins[col_index]); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + + +void matrix_init_custom(void) { + // initialize key pins + setPinInput(SWITCH_1); + setPinInput(SWITCH_2); + init_pins(); +} + +bool matrix_scan_custom(void) { + bool changed = false; + + // Set row, read cols + for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { + changed |= read_cols_on_row(raw_matrix, current_row); + } + + // Read encoder switches, already debounced + changed |= read_encoder_switches(matrix, 4); + + return changed; +} + +static bool read_encoder_switches(matrix_row_t current_matrix[], uint8_t current_row) { + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Debounce the encoder buttons using a shift register + static uint8_t btn_1_array; + static uint8_t btn_2_array; + bool btn_1_rise = 0; + bool btn_2_rise = 0; + btn_1_array <<= 1; + btn_2_array <<= 1; + btn_1_array |= readPin(SWITCH_1); + btn_2_array |= readPin(SWITCH_2); + (btn_1_array == 0b01111111) ? (btn_1_rise = 1) : (btn_1_rise = 0); + (btn_2_array == 0b01111111) ? (btn_2_rise = 1) : (btn_2_rise = 0); + + // Populate the matrix row with the state of the encoder + current_matrix[current_row] |= btn_1_rise ? (1 << 0) : 0; + current_matrix[current_row] |= btn_2_rise ? (1 << 1) : 0; + + return (last_row_value != current_matrix[current_row]); +} diff --git a/keyboards/joshajohnson/hub16/readme.md b/keyboards/joshajohnson/hub16/readme.md new file mode 100755 index 0000000000..9735079e24 --- /dev/null +++ b/keyboards/joshajohnson/hub16/readme.md @@ -0,0 +1,24 @@ +# Hub16 + +Hub16 is a 16 Key Macro Pad with an inbuilt USB 2.0 hub and dual rotary encoders. + +For more information regarding the keyboard, please visit the [Hub16 Website](https://www.joshajohnson.com/hub16-keyboard/) or [GitHub Repo](https://github.com/joshajohnson/Hub16). + +* Keyboard Maintainer: [Josh Johnson](https://github.com/joshajohnson) +* Hardware Supported: Hub16 PCB (atmega32u4) +* Hardware Availability: [Josh Johnson](https://www.joshajohnson.com/hub16-keyboard/) + +Make example for this keyboard (after setting up your build environment): + + make joshajohnson/hub16:default + +Flashing example for this keyboard: + + make joshajohnson/hub16:default:flash + +To reset the board into bootloader mode, do one of the following: + +* Press the reset switch between the center two USB-C ports while the board is plugged in +* Hold the top left key while connecting the USB cable (also erases persistent settings) + +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). diff --git a/keyboards/joshajohnson/hub16/rules.mk b/keyboards/joshajohnson/hub16/rules.mk new file mode 100755 index 0000000000..51fa8f6ee6 --- /dev/null +++ b/keyboards/joshajohnson/hub16/rules.mk @@ -0,0 +1,16 @@ +# Build Options +# change yes to no to disable +# +CUSTOM_MATRIX = lite # Custom scanning of matrix +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # 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 # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +ENCODER_ENABLE = yes # Rotary Encoder support + +SRC = matrix.c diff --git a/keyboards/joshajohnson/hub20/chconf.h b/keyboards/joshajohnson/hub20/chconf.h new file mode 100644 index 0000000000..3ac1345068 --- /dev/null +++ b/keyboards/joshajohnson/hub20/chconf.h @@ -0,0 +1,41 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/hub20/chconf.h -r platforms/chibios/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_FREQUENCY 10000 + +#define CH_CFG_OPTIMIZE_SPEED FALSE + +#define CH_CFG_USE_REGISTRY TRUE + +#define CH_CFG_USE_WAITEXIT TRUE + +#define CH_CFG_USE_CONDVARS TRUE + +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE + +#define CH_CFG_USE_MESSAGES TRUE + +#define CH_CFG_USE_MAILBOXES TRUE + +#include_next <chconf.h> + diff --git a/keyboards/joshajohnson/hub20/config.h b/keyboards/joshajohnson/hub20/config.h new file mode 100644 index 0000000000..a72b1389ad --- /dev/null +++ b/keyboards/joshajohnson/hub20/config.h @@ -0,0 +1,78 @@ +/* +Copyright 2020 joshajohnson +Copyright 2021 peepeetee + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#define RGB_MATRIX_LED_COUNT 27 + +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +#define RGB_MATRIX_KEYPRESSES + +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +// #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 +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined +#define ENABLE_RGB_MATRIX_TYPING_HEATMAP +#define ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined +#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 + +/* 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/joshajohnson/hub20/halconf.h b/keyboards/joshajohnson/hub20/halconf.h new file mode 100644 index 0000000000..80669d6dc6 --- /dev/null +++ b/keyboards/joshajohnson/hub20/halconf.h @@ -0,0 +1,31 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/hub20/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_I2C TRUE + +#define HAL_USE_PWM TRUE + +#define HAL_USE_SPI TRUE + +#include_next <halconf.h> + diff --git a/keyboards/joshajohnson/hub20/hub20.c b/keyboards/joshajohnson/hub20/hub20.c new file mode 100644 index 0000000000..8b1c58e1f7 --- /dev/null +++ b/keyboards/joshajohnson/hub20/hub20.c @@ -0,0 +1,171 @@ +/* Copyright 2020 joshajohnson 2021 peepeetee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "quantum.h" + + +#ifdef RGB_MATRIX_ENABLE +led_config_t g_led_config = { { + // Key Matrix to LED Index + {NO_LED,NO_LED,NO_LED,NO_LED}, + { 7, 8, 9, 10}, + { 11, 12, 13, 14}, + { 15, 16, 17, 18}, + { 19, 20, 21, 22}, + { 23, 24, 25, 26} + //todo: assign leds to keys differently for the different layouts +}, { + // LED Index to Physical Position + { 190, 50}, { 111, 50}, { 35, 50}, {38, 0}, {38, 35}, {186, 35}, {186, 0}, // UNDERGLOW + //todo: underglow location needs to be recalculated. The top row is above row 4, and for now they have the same y value 0 + { 0, 0}, {75, 0}, {150, 0}, {225, 0}, // row 4 + { 0, 16}, {75, 16}, {150, 16}, {225, 16}, // row 3 + { 0, 32}, {75, 32}, {150, 32}, {225, 32}, // row 2 + { 0, 48}, {75, 48}, {150, 48}, {225, 48}, // row 1 + { 0, 64}, {75, 64}, {150, 64}, {225, 64} // row 0 + +}, { + // LED Index to Flag + LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, // UNDERGLOW + LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // row 4 + LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // row 3 + LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // row 2 + LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, // row 1 + LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT // row 0 + +} }; +#endif + + + +// #if LED_MERGE_NUMPAD_LEFT_HANDED_ENTER && LED_MERGE_NUMPAD_RIGHT_HANDED_ZERO +// #error lower left enter conflicts with lower left zero +// #endif + +// #if LED_MERGE_NUMPAD_RIGHT_HANDED_ENTER && LED_MERGE_NUMPAD_LEFT_HANDED_ZERO +// #error lower right enter conflicts with lower right zero +// #endif + +// /* LAYOUT_left_handed + + +// * ┌───┬───┐ +// * │01 │02 │ +// * ┌───┼───┼───┼───┐ +// * │10 │11 │12 │13 │ +// * ├───┼───┼───┼───┤ +// * │ │21 │22 │23 │ +// * │20 ├───┼───┼───┤ +// * │ │31 │32 │33 │ +// * ├───┼───┼───┼───┤ +// * │ │41 │42 │43 │ +// * │40 ├───┼───┴───┤ +// * │ │51 │ 52 │ +// * └───┴───┴───────┘ +// */ + +// #ifndef LED_MERGE_NUMPAD_LEFT_HANDED_PLUS //key 20 +// #define LED_MERGE_NUMPAD_LEFT_HANDED_PLUS FALSE +// #endif // LED_MERGE_NUMPAD_LEFT_HANDED_PLUS + +// #ifndef LED_MERGE_NUMPAD_LEFT_HANDED_ENTER //key 40 +// #define LED_MERGE_NUMPAD_LEFT_HANDED_ENTER FALSE +// #endif // LED_MERGE_NUMPAD_LEFT_HANDED_ENTER + +// #ifndef LED_MERGE_NUMPAD_LEFT_HANDED_ZERO //key 52 +// #define LED_MERGE_NUMPAD_LEFT_HANDED_ZERO FALSE +// #endif // LED_MERGE_NUMPAD_LEFT_HANDED_ZERO + + +// /* LAYOUT_right_handed + + +// * ┌───┬───┐ +// * │01 │02 │ +// * ┌───┼───┼───┼───┐ +// * │10 │11 │12 │13 │ +// * ├───┼───┼───┼───┤ +// * │20 │21 │22 │ │ +// * ├───┼───┼───┤23 │ +// * │30 │31 │32 │ │ +// * ├───┼───┼───┼───┤ +// * │40 │41 │42 │ │ +// * ├───┴───┼───┤43 │ +// * │ 50 │52 │ │ +// * └───────┴───┴───┘ +// */ +// //LOCATION OF bottom row 0 NOT TESTED, WAITING ENDORSEMENT FROM MANUFACTURER + +// #ifndef LED_MERGE_NUMPAD_RIGHT_HANDED_PLUS // key 23 +// #define LED_MERGE_NUMPAD_RIGHT_HANDED_PLUS FALSE +// #endif // LED_MERGE_NUMPAD_RIGHT_HANDED_PLUS + +// #ifndef LED_MERGE_NUMPAD_RIGHT_HANDED_ENTER // key 43 +// #define LED_MERGE_NUMPAD_RIGHT_HANDED_ENTER FALSE +// #endif // LED_MERGE_NUMPAD_RIGHT_HANDED_ENTER + +// #ifndef LED_MERGE_NUMPAD_RIGHT_HANDED_ZERO // key 50 (confirm with manufacturer) +// #define LED_MERGE_NUMPAD_RIGHT_HANDED_ZERO FALSE +// #endif // LED_MERGE_NUMPAD_RIGHT_HANDED_ZERO + +// uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { +// // Keys here have 2 leds. Here we add the led that is not bound to the key +// // and the default led would be added +// // by the default code that runs after this in rgb_matrix_map_row_column_to_led + +// uint8_t counter = 0; + +// #if LED_MERGE_NUMPAD_LEFT_HANDED_PLUS //key 20, leds 7 and 11, 7 already bound + +// if (row == 2 && column == 0) { +// led_i[counter] = 11; +// counter ++; +// } +// #endif +// #if LED_MERGE_NUMPAD_LEFT_HANDED_ENTER //key 40, leds 19 and 23, 23 already bound +// if (row == 4 && column == 0) { +// led_i[counter] = 23; +// counter ++; +// } +// #endif +// #if LED_MERGE_NUMPAD_LEFT_HANDED_ZERO //key 52, leds 25 and 26, 26 already bound +// if (row == 5 && column == 2) { +// led_i[counter] = 26; +// counter ++; +// } +// #endif + +// #if LED_MERGE_NUMPAD_RIGHT_HANDED_PLUS // key 23, led 14 and 18, 14 already bound +// if (row == 2 && column == 3) { +// led_i[counter] = 18; +// counter ++; +// } +// #endif +// #if LED_MERGE_NUMPAD_RIGHT_HANDED_ENTER // key 43, led 22 and 26, 22 already bound +// if (row == 4 && column == 3) { +// led_i[counter] = 26; +// counter ++; +// } +// #endif +// #if LED_MERGE_NUMPAD_RIGHT_HANDED_ZERO // key 50 (confirm with manufacturer) +// // LED 23 and 24, 23(?) already bound +// if (row == 5 && column == 0) { +// led_i[counter] = 24; +// counter ++; +// } +// #endif +// return counter; +// } diff --git a/keyboards/joshajohnson/hub20/info.json b/keyboards/joshajohnson/hub20/info.json new file mode 100644 index 0000000000..92aa3605a9 --- /dev/null +++ b/keyboards/joshajohnson/hub20/info.json @@ -0,0 +1,128 @@ +{ + "keyboard_name": "Hub20", + "manufacturer": "Josh Johnson", + "url": "https://github.com/joshajohnson/hub20", + "maintainer": "joshajohnson", + "usb": { + "vid": "0x6A6A", + "pid": "0x4414", + "device_version": "0.0.1" + }, + "rgb_matrix": { + "driver": "ws2812" + }, + "matrix_pins": { + "cols": ["A6", "A7", "B7", "B6"], + "rows": ["A13", "B14", "A10", "A0", "A2", "A1"] + }, + "diode_direction": "COL2ROW", + "encoder": { + "rotary": [ + {"pin_a": "B12", "pin_b": "B13"}, + {"pin_a": "A8", "pin_b": "A9"} + ] + }, + "qmk": { + "tap_keycode_delay": 10 + }, + "rgblight": { + "led_count": 27 + }, + "ws2812": { + "pin": "B15" + }, + "processor": "STM32F072", + "bootloader": "stm32-dfu", + "layouts": { + "LAYOUT_all": { + "layout": [ + {"matrix": [0, 1], "x": 0.5, "y": 0}, + + {"matrix": [0, 2], "x": 2.5, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + {"matrix": [2, 3], "x": 3, "y": 2}, + + {"matrix": [3, 0], "x": 0, "y": 3}, + {"matrix": [3, 1], "x": 1, "y": 3}, + {"matrix": [3, 2], "x": 2, "y": 3}, + {"matrix": [3, 3], "x": 3, "y": 3}, + + {"matrix": [4, 0], "x": 0, "y": 4}, + {"matrix": [4, 1], "x": 1, "y": 4}, + {"matrix": [4, 2], "x": 2, "y": 4}, + {"matrix": [4, 3], "x": 3, "y": 4}, + + {"matrix": [5, 0], "x": 0, "y": 5}, + {"matrix": [5, 1], "x": 1, "y": 5}, + {"matrix": [5, 2], "x": 2, "y": 5}, + {"matrix": [5, 3], "x": 3, "y": 5} + ] + }, + "LAYOUT_left_handed": { + "layout": [ + {"matrix": [0, 1], "x": 0.5, "y": 0}, + + {"matrix": [0, 2], "x": 2.5, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + {"matrix": [2, 3], "x": 3, "y": 2}, + + {"matrix": [2, 0], "x": 0, "y": 2, "h": 2}, + {"matrix": [3, 1], "x": 1, "y": 3}, + {"matrix": [3, 2], "x": 2, "y": 3}, + {"matrix": [3, 3], "x": 3, "y": 3}, + + {"matrix": [4, 1], "x": 0, "y": 4, "h": 2}, + {"matrix": [4, 2], "x": 1, "y": 4}, + {"matrix": [4, 3], "x": 2, "y": 4}, + {"matrix": [4, 0], "x": 3, "y": 4}, + + {"matrix": [5, 1], "x": 1, "y": 5}, + {"matrix": [5, 2], "x": 2, "y": 5, "w": 2} + ] + }, + "LAYOUT_right_handed": { + "layout": [ + {"matrix": [0, 1], "x": 0.5, "y": 0}, + + {"matrix": [0, 2], "x": 2.5, "y": 0}, + + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 1], "x": 1, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + + {"matrix": [3, 0], "x": 0, "y": 3}, + {"matrix": [3, 1], "x": 1, "y": 3}, + {"matrix": [3, 2], "x": 2, "y": 3}, + {"matrix": [2, 3], "x": 3, "y": 2, "h": 2}, + + {"matrix": [4, 0], "x": 0, "y": 4}, + {"matrix": [4, 1], "x": 1, "y": 4}, + {"matrix": [4, 2], "x": 2, "y": 4}, + + {"matrix": [5, 0], "x": 0, "y": 5, "w": 2}, + {"matrix": [5, 2], "x": 2, "y": 5}, + {"matrix": [4, 3], "x": 3, "y": 4, "h": 2} + ] + } + } +} diff --git a/keyboards/joshajohnson/hub20/keymaps/default/keymap.c b/keyboards/joshajohnson/hub20/keymaps/default/keymap.c new file mode 100644 index 0000000000..e943780258 --- /dev/null +++ b/keyboards/joshajohnson/hub20/keymaps/default/keymap.c @@ -0,0 +1,54 @@ +/* Copyright 2020 joshajohnson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +#define MO_NLCK LT(1, KC_NUM) // Numlock on tap, layer change on hold + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_MUTE, KC_MPLY, + KC_PMNS, KC_PAST, KC_PSLS, MO_NLCK, + KC_PPLS, KC_P7, KC_P8, KC_P9, + KC_PPLS, KC_P4, KC_P5, KC_P6, + KC_PENT, KC_P1, KC_P2, KC_P3, + KC_PENT, KC_PDOT, KC_P0, KC_P0 +), + [1] = LAYOUT_all( + QK_BOOT, _______, + RGB_TOG, RGB_RMOD, RGB_MOD, _______, + _______, RGB_VAD, RGB_VAI, _______, + _______, RGB_HUD, RGB_HUI, _______, + _______, RGB_SAD, RGB_SAI, _______, + _______, _______, _______, _______ +) +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* Left Encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } else if (index == 1) { /* Right Encoder */ + if (clockwise) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } + } + return true; +} diff --git a/keyboards/joshajohnson/hub20/keymaps/left_hand_numpad/keymap.c b/keyboards/joshajohnson/hub20/keymaps/left_hand_numpad/keymap.c new file mode 100644 index 0000000000..fe848d7c33 --- /dev/null +++ b/keyboards/joshajohnson/hub20/keymaps/left_hand_numpad/keymap.c @@ -0,0 +1,60 @@ +/* Copyright 2020 joshajohnson 2021 peepeetee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +// #define LED_MERGE_NUMPAD_LEFT_HANDED_PLUS TRUE +// #define LED_MERGE_NUMPAD_LEFT_HANDED_ENTER TRUE +// #define LED_MERGE_NUMPAD_LEFT_HANDED_ZERO TRUE + +#define MO_NLCK LT(1, KC_NUM) // Numlock on tap, layer change on hold + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_left_handed( + KC_MUTE, KC_MPLY, + KC_PMNS, KC_PAST, KC_PSLS, MO_NLCK, + KC_P7, KC_P8, KC_P9, + KC_PPLS, KC_P4, KC_P5, KC_P6, + KC_P1, KC_P2, KC_P3, + KC_PENT, KC_PDOT, KC_P0 +), + [1] = LAYOUT_left_handed( + QK_BOOT, _______, + RGB_TOG, RGB_RMOD, RGB_MOD, _______, + _______, RGB_VAD, RGB_VAI, _______, + RGB_HUD, RGB_HUI, _______, + _______, RGB_SAD, RGB_SAI, _______, + _______, _______ +) +}; +// clang-format of + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* Left Encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } else if (index == 1) { /* Right Encoder */ + if (clockwise) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } + } + return true; +} diff --git a/keyboards/joshajohnson/hub20/keymaps/right_hand_numpad/keymap.c b/keyboards/joshajohnson/hub20/keymaps/right_hand_numpad/keymap.c new file mode 100644 index 0000000000..71168069fb --- /dev/null +++ b/keyboards/joshajohnson/hub20/keymaps/right_hand_numpad/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2021 peepeetee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +// #define LED_MERGE_NUMPAD_RIGHT_HANDED_PLUS TRUE +// #define LED_MERGE_NUMPAD_RIGHT_HANDED_ENTER TRUE +// #define LED_MERGE_NUMPAD_RIGHT_HANDED_ZERO TRUE + +#define MO_NLCK LT(1, KC_NUM) // Numlock on tap, layer change on hold + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +//NOT TESTED, WAITING ENDORSEMENT FROM MANUFACTURER + [0] = LAYOUT_right_handed( + KC_MUTE, KC_MPLY, + MO_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_P0, KC_PDOT, KC_PENT +), + [1] = LAYOUT_right_handed( + QK_BOOT, _______, + RGB_TOG, RGB_RMOD, RGB_MOD, _______, + _______, RGB_VAD, RGB_VAI, + _______, RGB_HUD, RGB_HUI, _______, + _______, RGB_SAD, RGB_SAI, + _______, _______, _______ +) +}; +// clang-format on + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* Left Encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } else if (index == 1) { /* Right Encoder */ + if (clockwise) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } + } + return true; +} diff --git a/keyboards/joshajohnson/hub20/keymaps/via/keymap.c b/keyboards/joshajohnson/hub20/keymaps/via/keymap.c new file mode 100644 index 0000000000..b8d7e6fdc8 --- /dev/null +++ b/keyboards/joshajohnson/hub20/keymaps/via/keymap.c @@ -0,0 +1,70 @@ +/* Copyright 2020 joshajohnson + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +#include QMK_KEYBOARD_H + +#define MO_NLCK LT(1, KC_NUM) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_all( + KC_MUTE, KC_MPLY, + KC_PMNS, KC_PAST, KC_PSLS, MO_NLCK, + KC_PPLS, KC_P7, KC_P8, KC_P9, + KC_PPLS, KC_P4, KC_P5, KC_P6, + KC_PENT, KC_P1, KC_P2, KC_P3, + KC_PENT, KC_PDOT, KC_P0, KC_P0 +), + [1] = LAYOUT_all( + QK_BOOT, _______, + RGB_TOG, RGB_RMOD, RGB_MOD, _______, + _______, RGB_VAD, RGB_VAI, _______, + _______, RGB_HUD, RGB_HUI, _______, + _______, RGB_SAD, RGB_SAI, _______, + _______, _______, _______, _______ +), + [2] = LAYOUT_all( + _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ +), + [3] = LAYOUT_all( + _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, _______ +) +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* Left Encoder */ + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } else if (index == 1) { /* Right Encoder */ + if (clockwise) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } + } + return true; +} diff --git a/keyboards/joshajohnson/hub20/keymaps/via/rules.mk b/keyboards/joshajohnson/hub20/keymaps/via/rules.mk new file mode 100644 index 0000000000..1e5b99807c --- /dev/null +++ b/keyboards/joshajohnson/hub20/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/joshajohnson/hub20/mcuconf.h b/keyboards/joshajohnson/hub20/mcuconf.h new file mode 100644 index 0000000000..f783c39b1d --- /dev/null +++ b/keyboards/joshajohnson/hub20/mcuconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/hub20/mcuconf.h -r platforms/chibios/GENERIC_STM32_F072XB/configs/mcuconf.h` + */ + +#pragma once + +#include_next <mcuconf.h> + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +#undef STM32_PWM_USE_TIM3 +#define STM32_PWM_USE_TIM3 TRUE + +#undef STM32_SPI_USE_SPI2 +#define STM32_SPI_USE_SPI2 TRUE + diff --git a/keyboards/joshajohnson/hub20/readme.md b/keyboards/joshajohnson/hub20/readme.md new file mode 100755 index 0000000000..a3b5aba641 --- /dev/null +++ b/keyboards/joshajohnson/hub20/readme.md @@ -0,0 +1,24 @@ +# Hub20 + +Hub20 is a 20 key macro pad with an inbuilt USB 2.0 hub and dual rotary encoders. It can be configured to be a left / right hand numberpad, along with a 4x5 1u layout. + +For more information regarding the keyboard, please visit the [Hub20 Website](https://www.joshajohnson.com/hub20) or [GitHub Repo](https://github.com/joshajohnson/Hub20). + +* Keyboard Maintainer: [Josh Johnson](https://github.com/joshajohnson) +* Hardware Supported: Hub20 PCB (STM32F072) +* Hardware Availability: [Josh Johnson](https://www.joshajohnson.com/hub20) + +Make example for this keyboard (after setting up your build environment): + + make joshajohnson/hub20:default + +Flashing example for this keyboard: + + make joshajohnson/hub20:default:flash + +To reset the board into bootloader mode, do one of the following: + +* Press the reset switch between the center two USB-C ports while the board is plugged in +* Hold the top left key while connecting the USB cable (also erases persistent settings) + +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). diff --git a/keyboards/joshajohnson/hub20/rules.mk b/keyboards/joshajohnson/hub20/rules.mk new file mode 100644 index 0000000000..f559246b9e --- /dev/null +++ b/keyboards/joshajohnson/hub20/rules.mk @@ -0,0 +1,15 @@ +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +MOUSEKEY_ENABLE = yes # 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 +RGB_MATRIX_ENABLE = yes +ENCODER_ENABLE = yes + |