diff options
Diffstat (limited to 'keyboards/dumbpad/v0x_dualencoder')
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/config.h | 40 | ||||
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/info.json | 18 | ||||
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/keymaps/default/keymap.c | 134 | ||||
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/readme.md | 15 | ||||
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/rules.mk | 25 | ||||
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/templates/keymap.c | 43 | ||||
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c | 59 | ||||
| -rw-r--r-- | keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.h | 30 |
8 files changed, 364 insertions, 0 deletions
diff --git a/keyboards/dumbpad/v0x_dualencoder/config.h b/keyboards/dumbpad/v0x_dualencoder/config.h new file mode 100644 index 000000000..586e55056 --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/config.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 imchipwood | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include "config_common.h" | ||
| 20 | |||
| 21 | /* USB Device descriptor parameter */ | ||
| 22 | #define DEVICE_VER 0x0006 | ||
| 23 | |||
| 24 | /* Column/Row IO definitions - dualencoder version is true 4x4 */ | ||
| 25 | #define MATRIX_ROWS 4 | ||
| 26 | #define MATRIX_COLS 4 | ||
| 27 | #define MATRIX_ROW_PINS { F4, F5, F6, F7 } | ||
| 28 | #define MATRIX_COL_PINS { D7, E6, B4, B5 } | ||
| 29 | |||
| 30 | /* Dual rotary encoders */ | ||
| 31 | #define ENCODERS_PAD_A { C6, D0 } | ||
| 32 | #define ENCODERS_PAD_B { D4, D1 } | ||
| 33 | |||
| 34 | /* Onboard LEDs */ | ||
| 35 | #define LED_00 B3 | ||
| 36 | #define LED_01 B1 | ||
| 37 | |||
| 38 | /* Bootmagic - hold down rotary encoder pushbutton while plugging in to enter bootloader */ | ||
| 39 | #define BOOTMAGIC_LITE_ROW 3 | ||
| 40 | #define BOOTMAGIC_LITE_COLUMN 0 | ||
diff --git a/keyboards/dumbpad/v0x_dualencoder/info.json b/keyboards/dumbpad/v0x_dualencoder/info.json new file mode 100644 index 000000000..09a7d14b9 --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/info.json | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "dumbpad/v0x_dualencoder", | ||
| 3 | "keyboard_folder": "dumbpad/v0x_dualencoder", | ||
| 4 | "url": "https://www.github.com/imchipwood/dumbpad", | ||
| 5 | "maintainer": "imchipwood", | ||
| 6 | "width": 4, | ||
| 7 | "height": 4, | ||
| 8 | "layouts": { | ||
| 9 | "LAYOUT": { | ||
| 10 | "layout": [ | ||
| 11 | {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, | ||
| 12 | {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, | ||
| 13 | {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, | ||
| 14 | {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3} | ||
| 15 | ] | ||
| 16 | } | ||
| 17 | } | ||
| 18 | } | ||
diff --git a/keyboards/dumbpad/v0x_dualencoder/keymaps/default/keymap.c b/keyboards/dumbpad/v0x_dualencoder/keymaps/default/keymap.c new file mode 100644 index 000000000..59f36a1a9 --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/keymaps/default/keymap.c | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | /* Copyright 2020 imchipwood | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include QMK_KEYBOARD_H | ||
| 17 | |||
| 18 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 19 | /* | ||
| 20 | BASE LAYER | ||
| 21 | /---------------------------------------` | ||
| 22 | | 7 | 8 | 9 | Bkspc | | ||
| 23 | |---------|---------|---------|---------| | ||
| 24 | | 4 | 5 | 6 | Esc | | ||
| 25 | |---------|---------|---------|---------| | ||
| 26 | | 1 | 2 | 3 | Tab | | ||
| 27 | |---------|---------|---------|---------| | ||
| 28 | | TT(1) | 0 | . | Enter | | ||
| 29 | \---------------------------------------' | ||
| 30 | */ | ||
| 31 | [0] = LAYOUT( | ||
| 32 | KC_7, KC_8, KC_9, KC_BSPC, | ||
| 33 | KC_4, KC_5, KC_6, KC_ESC, | ||
| 34 | KC_1, KC_2, KC_3, KC_TAB, | ||
| 35 | TT(1), KC_0, KC_DOT, KC_ENTER | ||
| 36 | ), | ||
| 37 | /* | ||
| 38 | SUB LAYER | ||
| 39 | /---------------------------------------` | ||
| 40 | | | | | Reset | | ||
| 41 | |---------|---------|---------|---------| | ||
| 42 | | | | | + | | ||
| 43 | |---------|---------|---------|---------| | ||
| 44 | | | | | - | | ||
| 45 | |---------|---------|---------|---------| | ||
| 46 | | | | | = | | ||
| 47 | \---------------------------------------' | ||
| 48 | */ | ||
| 49 | [1] = LAYOUT( | ||
| 50 | _______, _______, _______, RESET, | ||
| 51 | _______, _______, _______, KC_KP_PLUS, | ||
| 52 | _______, _______, _______, KC_KP_MINUS, | ||
| 53 | _______, _______, _______, KC_EQL | ||
| 54 | ), | ||
| 55 | }; | ||
| 56 | |||
| 57 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 58 | // If console is enabled, it will print the matrix position and status of each key pressed | ||
| 59 | /* | ||
| 60 | #ifdef CONSOLE_ENABLE | ||
| 61 | uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); | ||
| 62 | #endif | ||
| 63 | */ | ||
| 64 | return true; | ||
| 65 | } | ||
| 66 | |||
| 67 | void keyboard_post_init_user(void) { | ||
| 68 | // Customise these values to desired behaviour | ||
| 69 | // debug_enable = true; | ||
| 70 | // debug_matrix = true; | ||
| 71 | // debug_keyboard = true; | ||
| 72 | // debug_mouse = true; | ||
| 73 | } | ||
| 74 | |||
| 75 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 76 | /* Custom encoder control - handles CW/CCW turning of encoder | ||
| 77 | * Default behavior: | ||
| 78 | * left encoder: | ||
| 79 | * main layer: | ||
| 80 | * CW: move mouse right | ||
| 81 | * CCW: move mouse left | ||
| 82 | * other layers: | ||
| 83 | * CW: = (equals/plus - increase slider in Adobe products) | ||
| 84 | * CCW: - (minus/underscore - decrease slider in adobe products) | ||
| 85 | * right encoder: | ||
| 86 | * main layer: | ||
| 87 | * CW: colume up | ||
| 88 | * CCW: volume down | ||
| 89 | * other layers: | ||
| 90 | * CW: right arrow | ||
| 91 | * CCW: left arrow | ||
| 92 | */ | ||
| 93 | if (index == 0) { | ||
| 94 | switch (get_highest_layer(layer_state)) { | ||
| 95 | case 0: | ||
| 96 | // main layer - move mouse right (CW) and left (CCW) | ||
| 97 | if (clockwise) { | ||
| 98 | tap_code(KC_MS_R); | ||
| 99 | } else { | ||
| 100 | tap_code(KC_MS_L); | ||
| 101 | } | ||
| 102 | break; | ||
| 103 | |||
| 104 | default: | ||
| 105 | // other layers - =/+ (quals/plus) (CW) and -/_ (minus/underscore) (CCW) | ||
| 106 | if (clockwise) { | ||
| 107 | tap_code(KC_EQL); | ||
| 108 | } else { | ||
| 109 | tap_code(KC_MINS); | ||
| 110 | } | ||
| 111 | break; | ||
| 112 | } | ||
| 113 | } else if (index == 1) { | ||
| 114 | switch (get_highest_layer(layer_state)) { | ||
| 115 | case 0: | ||
| 116 | // main layer - volume up (CW) and down (CCW) | ||
| 117 | if (clockwise) { | ||
| 118 | tap_code(KC_VOLU); | ||
| 119 | } else { | ||
| 120 | tap_code(KC_VOLD); | ||
| 121 | } | ||
| 122 | break; | ||
| 123 | |||
| 124 | default: | ||
| 125 | // other layers - right (CW) and left (CCW) | ||
| 126 | if (clockwise) { | ||
| 127 | tap_code(KC_RIGHT); | ||
| 128 | } else { | ||
| 129 | tap_code(KC_LEFT); | ||
| 130 | } | ||
| 131 | break; | ||
| 132 | } | ||
| 133 | } | ||
| 134 | } | ||
diff --git a/keyboards/dumbpad/v0x_dualencoder/readme.md b/keyboards/dumbpad/v0x_dualencoder/readme.md new file mode 100644 index 000000000..a4aedb582 --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/readme.md | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # dumbpad v0.x dual-encoder | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | A 4x4 numpad/macropad with two rotary encoders | ||
| 6 | |||
| 7 | * Keyboard Maintainer: [imchipwood](https://github.com/imchipwood) | ||
| 8 | * Hardware repository: [dumbpad on github](https://github.com/imchipwood/dumbpad) | ||
| 9 | * PCB Revisions Supported: v0.6_dualencoder, v0.6_dualencoder_top | ||
| 10 | |||
| 11 | Make example for this keyboard (after setting up your build environment): | ||
| 12 | |||
| 13 | make dumbpad/v0x_dualencoder:default | ||
| 14 | |||
| 15 | 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/dumbpad/v0x_dualencoder/rules.mk b/keyboards/dumbpad/v0x_dualencoder/rules.mk new file mode 100644 index 000000000..309e3d48c --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/rules.mk | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | # MCU name | ||
| 2 | MCU = atmega32u4 | ||
| 3 | |||
| 4 | # Bootloader selection | ||
| 5 | BOOTLOADER = caterina | ||
| 6 | |||
| 7 | # Build Options | ||
| 8 | # change yes to no to disable | ||
| 9 | # | ||
| 10 | BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration | ||
| 11 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 12 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 13 | CONSOLE_ENABLE = yes # Console for debug | ||
| 14 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 15 | # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE | ||
| 16 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 17 | # if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work | ||
| 18 | NKRO_ENABLE = no # USB Nkey Rollover | ||
| 19 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 20 | RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow | ||
| 21 | BLUETOOTH_ENABLE = no # Enable Bluetooth | ||
| 22 | AUDIO_ENABLE = no # Audio output | ||
| 23 | |||
| 24 | ENCODER_ENABLE = yes | ||
| 25 | KEY_LOCK_ENABLE = yes | ||
diff --git a/keyboards/dumbpad/v0x_dualencoder/templates/keymap.c b/keyboards/dumbpad/v0x_dualencoder/templates/keymap.c new file mode 100644 index 000000000..0c2be0aad --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/templates/keymap.c | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__}; | ||
| 3 | |||
| 4 | |||
| 5 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 6 | if (index == 0) { | ||
| 7 | switch (get_highest_layer(layer_state)) { | ||
| 8 | case 0: | ||
| 9 | if (clockwise) { | ||
| 10 | tap_code(KC_MS_R); | ||
| 11 | } else { | ||
| 12 | tap_code(KC_MS_L); | ||
| 13 | } | ||
| 14 | break; | ||
| 15 | |||
| 16 | default: | ||
| 17 | if (clockwise) { | ||
| 18 | tap_code(KC_EQL); | ||
| 19 | } else { | ||
| 20 | tap_code(KC_MINS); | ||
| 21 | } | ||
| 22 | break; | ||
| 23 | } | ||
| 24 | } else if (index == 1) { | ||
| 25 | switch (get_highest_layer(layer_state)) { | ||
| 26 | case 0: | ||
| 27 | if (clockwise) { | ||
| 28 | tap_code(KC_VOLU); | ||
| 29 | } else { | ||
| 30 | tap_code(KC_VOLD); | ||
| 31 | } | ||
| 32 | break; | ||
| 33 | |||
| 34 | default: | ||
| 35 | if (clockwise) { | ||
| 36 | tap_code(KC_RIGHT); | ||
| 37 | } else { | ||
| 38 | tap_code(KC_LEFT); | ||
| 39 | } | ||
| 40 | break; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | } | ||
diff --git a/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c new file mode 100644 index 000000000..9b2a2cd24 --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.c | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /* Copyright 2020 imchipwood | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #include "v0x_dualencoder.h" | ||
| 17 | |||
| 18 | void keyboard_pre_init_kb(void) { | ||
| 19 | // Set LED IO as outputs | ||
| 20 | setPinOutput(LED_00); | ||
| 21 | setPinOutput(LED_01); | ||
| 22 | keyboard_pre_init_user(); | ||
| 23 | } | ||
| 24 | |||
| 25 | void shutdown_user() { | ||
| 26 | // Shutdown LEDs | ||
| 27 | writePinLow(LED_00); | ||
| 28 | writePinLow(LED_01); | ||
| 29 | } | ||
| 30 | |||
| 31 | layer_state_t layer_state_set_kb(layer_state_t state) { | ||
| 32 | // Layer LEDs act as binary indication of current layer | ||
| 33 | uint8_t layer = get_highest_layer(state); | ||
| 34 | writePin(LED_00, layer & 0b1); | ||
| 35 | writePin(LED_01, (layer >> 1) & 0b1); | ||
| 36 | return layer_state_set_user(state); | ||
| 37 | } | ||
| 38 | |||
| 39 | // Optional override functions below. | ||
| 40 | // You can leave any or all of these undefined. | ||
| 41 | // These are only required if you want to perform custom actions. | ||
| 42 | |||
| 43 | void matrix_init_kb(void) { | ||
| 44 | // put your keyboard start-up code here | ||
| 45 | // runs once when the firmware starts up | ||
| 46 | uint8_t led_delay_ms = 80; | ||
| 47 | for (int i = 0; i < 2; i++) { | ||
| 48 | writePinHigh(LED_00); | ||
| 49 | writePinHigh(LED_01); | ||
| 50 | wait_ms(led_delay_ms); | ||
| 51 | writePinLow(LED_00); | ||
| 52 | writePinLow(LED_01); | ||
| 53 | if (i < 1) { | ||
| 54 | wait_ms(led_delay_ms); | ||
| 55 | } | ||
| 56 | } | ||
| 57 | |||
| 58 | matrix_init_user(); | ||
| 59 | } | ||
diff --git a/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.h b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.h new file mode 100644 index 000000000..f38d39885 --- /dev/null +++ b/keyboards/dumbpad/v0x_dualencoder/v0x_dualencoder.h | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | /* Copyright 2020 imchipwood | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | #pragma once | ||
| 17 | #include "quantum.h" | ||
| 18 | |||
| 19 | #define LAYOUT( \ | ||
| 20 | k00, k01, k02, k03, \ | ||
| 21 | k10, k11, k12, k13, \ | ||
| 22 | k20, k21, k22, k23, \ | ||
| 23 | k30, k31, k32, k33 \ | ||
| 24 | ) \ | ||
| 25 | { \ | ||
| 26 | { k00, k01, k02, k03 }, \ | ||
| 27 | { k10, k11, k12, k13 }, \ | ||
| 28 | { k20, k21, k22, k23 }, \ | ||
| 29 | { k30, k31, k32, k33 }, \ | ||
| 30 | } | ||
