From 1cb6f879c19aab17672f84a84b34d0daf867cde7 Mon Sep 17 00:00:00 2001 From: rookiebwoy <81021475+rookiebwoy@users.noreply.github.com> Date: Sun, 18 Apr 2021 11:51:45 +0200 Subject: [PATCH 1/6] add neopad macropad --- keyboards/neopad/config.h | 34 ++++ keyboards/neopad/readme.md | 23 +++ keyboards/neopad/rev1/config.h | 41 +++++ keyboards/neopad/rev1/info.json | 16 ++ .../neopad/rev1/keymaps/default/keymap.c | 170 ++++++++++++++++++ keyboards/neopad/rev1/rev1.c | 59 ++++++ keyboards/neopad/rev1/rev1.h | 26 +++ keyboards/neopad/rev1/rules.mk | 25 +++ keyboards/neopad/rules.mk | 1 + 9 files changed, 395 insertions(+) create mode 100755 keyboards/neopad/config.h create mode 100644 keyboards/neopad/readme.md create mode 100755 keyboards/neopad/rev1/config.h create mode 100755 keyboards/neopad/rev1/info.json create mode 100755 keyboards/neopad/rev1/keymaps/default/keymap.c create mode 100755 keyboards/neopad/rev1/rev1.c create mode 100755 keyboards/neopad/rev1/rev1.h create mode 100755 keyboards/neopad/rev1/rules.mk create mode 100755 keyboards/neopad/rules.mk diff --git a/keyboards/neopad/config.h b/keyboards/neopad/config.h new file mode 100755 index 000000000000..79798b1d66c1 --- /dev/null +++ b/keyboards/neopad/config.h @@ -0,0 +1,34 @@ +/* +Copyright 2021 rookiebwoy + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0913 +#define MANUFACTURER rookiebwoy +#define PRODUCT neopad + +/* Column/Row IO definitions */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* Reduce tapdance required taps from 5 to 2 */ +#define TAPPING_TOGGLE 2 diff --git a/keyboards/neopad/readme.md b/keyboards/neopad/readme.md new file mode 100644 index 000000000000..56d2f5d05f0f --- /dev/null +++ b/keyboards/neopad/readme.md @@ -0,0 +1,23 @@ +# Neopad + +Neopad is a little macro pad with four switches and two rotary encoders, made by through hole components only. +_Actually the number of switches is six, because even the encoder are allowed to click._ + +![Neopad](https://i.imgur.com/TgOkj2F.jpg "Neopad first proto") + +The Neopad in the photo above is the first prototype. See the project repository for revision 1 update and KiCad files. + +* Keyboard maintainer: [rookiebwoy](https://github.com/rookiebwoy) +* Hardware supported: ProMicro, _Elite-C (not tested)_ +* Project repository: [Neopad on github](https://github.com/rookiebwoy/neopad) + +Make example for Neopad (after setting up your build environment): + + make neopad/rev1:default + +Install examples: + + make neopad/rev1:default:avrdude + +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 [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + diff --git a/keyboards/neopad/rev1/config.h b/keyboards/neopad/rev1/config.h new file mode 100755 index 000000000000..92d3392715f7 --- /dev/null +++ b/keyboards/neopad/rev1/config.h @@ -0,0 +1,41 @@ +/* +Copyright 2021 rookiebwoy + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define DEVICE_VER 0x0010 + +/* Column/Row IO definitions */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 3 +#define MATRIX_ROW_PINS { F4, F5 } +#define MATRIX_COL_PINS { B3, B2, B6 } +#define UNUSED_PINS + +/* Dual rotary encoders */ +#define ENCODERS_PAD_A { D1, D4 } +#define ENCODERS_PAD_B { D0, C6 } + +/* Onboard LEDs */ +#define LED_00 F6 +#define LED_01 F7 + +/* Bootmagic - hold down rotary encoder pushbutton while plugging in to enter bootloader */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/neopad/rev1/info.json b/keyboards/neopad/rev1/info.json new file mode 100755 index 000000000000..44d5babe440d --- /dev/null +++ b/keyboards/neopad/rev1/info.json @@ -0,0 +1,16 @@ +{ + "keyboard_name": "neopad", + "keyboard_folder": "neopad/rev1", + "url": "https://github.com/rookiebwoy/neopad)", + "maintainer": "rookiebwoy", + "width": 3, + "height": 2, + "layouts": { + "LAYOUT": { + "layout": [ + {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, + {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1} + ] + } + } +} diff --git a/keyboards/neopad/rev1/keymaps/default/keymap.c b/keyboards/neopad/rev1/keymaps/default/keymap.c new file mode 100755 index 000000000000..8d7db7560888 --- /dev/null +++ b/keyboards/neopad/rev1/keymaps/default/keymap.c @@ -0,0 +1,170 @@ +/* Copyright 2021 rookiebwoy + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + LAYER 0 - MUSIC + /-----------------------------` + | TO(1) | stop | mute | L ENC: prev/next song + |---------|---------|---------| + | prev | play | next | R ENC: vol up/down + \-----------------------------' + */ + [0] = LAYOUT( + TO(1), KC_MSTP, KC_MUTE, + KC_MPRV, KC_MPLY, KC_MNXT + ), + + /* + LAYER 1 - MOVEMENT IN WINDOWS + /---------------------------------------` + | TO(2) | maximize | show desktop | L ENC: change desktop + |-------------|----------|--------------| + | move window | minimize | move window | R ENC: change browser tab + change explorer window + \---------------------------------------' + */ + [1] = LAYOUT( + TO(2), LGUI(KC_UP), LGUI(KC_D), + LGUI(KC_LEFT), LGUI(KC_DOWN), LGUI(KC_RIGHT) + ), + + /* + LAYER 2 - SHORTCUT + /------------------------------` + | TO(3) | esc | task man | L ENC: redo/undo + |---------|---------|----------| + | cut | copy | paste | R ENC: mouse wheel up/down + \------------------------------' + */ + [2] = LAYOUT( + TO(3), KC_ESC, LCTL(LSFT(KC_ESC)), + LCTL(KC_X), LCTL(KC_C), LCTL(KC_V) + ), + + /* + LAYER 3 - AUDACITY + /-----------------------------` + | TO(0) | REC | canc | L ENC: pan right/left + |---------|---------|---------| + | ctrl | play | pause | R ENC: mouse wheel up/down + \-----------------------------' + */ + [3] = LAYOUT( + TO(0), LSFT(KC_R), KC_DEL, + KC_LCTL, KC_SPC, KC_P + ), + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // If console is enabled, it will print the matrix position and status of each key pressed +/* +#ifdef CONSOLE_ENABLE + uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); +#endif +*/ + return true; +} + +void keyboard_post_init_user(void) { + // Customise these values to desired behaviour + // debug_enable = true; + // debug_matrix = true; + // debug_keyboard = true; + // debug_mouse = true; +} + +void encoder_update_user(uint8_t index, bool clockwise) { + if (index == 0) { /* LEFT ENCODER */ + switch (get_highest_layer(layer_state)) { + case 0: + // layer 0 - next song (CW) and previous (CCW) + if (clockwise) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } + break; + + case 1: + // layer 1 - change desktop right (CW) and left (CCW) + if (clockwise) { + tap_code16(LCTL(LGUI(KC_RIGHT))); + } else { + tap_code16(LCTL(LGUI(KC_LEFT))); + } + break; + + case 2: + // layer 2 - redo (CW) and undo (CCW) + if (clockwise) { + tap_code16(LCTL(KC_Y)); + } else { + tap_code16(LCTL(KC_Z)); + } + break; + + case 3: + // layer 3 - pan right (CW) and left (CCW) + if (clockwise) { + tap_code(KC_WH_R); + } else { + tap_code(KC_WH_L); + } + break; + } + + } else if (index == 1) { /* RIGHT ENCODER */ + switch (get_highest_layer(layer_state)) { + case 0: + // layer 0 - volume up (CW) and down (CCW) + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + break; + + case 1: + // layer 1 - change browser tab (CW) and change explorer window (CCW) + if (clockwise) { + tap_code16(LCTL(KC_TAB)); + } else { + tap_code16(LALT(LSFT(KC_TAB))); + } + break; + + case 2: + // layer 2 - wheel up (CW) and down (CCW) + if (clockwise) { + tap_code(KC_WH_U); + } else { + tap_code(KC_WH_D); + } + break; + + case 3: + // layer 3 - wheel up (CW) and down (CCW) + if (clockwise) { + tap_code(KC_WH_U); + } else { + tap_code(KC_WH_D); + } + break; + } + } +} diff --git a/keyboards/neopad/rev1/rev1.c b/keyboards/neopad/rev1/rev1.c new file mode 100755 index 000000000000..fca9508d2fc8 --- /dev/null +++ b/keyboards/neopad/rev1/rev1.c @@ -0,0 +1,59 @@ +/* Copyright 2021 rookiebwoy + * + * 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 "rev1.h" + +void keyboard_pre_init_kb(void) { + // Set LED IO as outputs + setPinOutput(LED_00); + setPinOutput(LED_01); + keyboard_pre_init_user(); +} + +void shutdown_user() { + // Shutdown LEDs + writePinLow(LED_00); + writePinLow(LED_01); +} + +layer_state_t layer_state_set_kb(layer_state_t state) { + // Layer LEDs act as binary indication of current layer + uint8_t layer = get_highest_layer(state); + writePin(LED_00, layer & 0b1); + writePin(LED_01, (layer >> 1) & 0b1); + return layer_state_set_user(state); +} + +// Optional override functions below. +// You can leave any or all of these undefined. +// These are only required if you want to perform custom actions. + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + uint8_t led_delay_ms = 80; + for (int i = 0; i < 2; i++) { + writePinHigh(LED_00); + writePinHigh(LED_01); + wait_ms(led_delay_ms); + writePinLow(LED_00); + writePinLow(LED_01); + if (i < 1) { + wait_ms(led_delay_ms); + } + } + + matrix_init_user(); +} diff --git a/keyboards/neopad/rev1/rev1.h b/keyboards/neopad/rev1/rev1.h new file mode 100755 index 000000000000..87b9405bb160 --- /dev/null +++ b/keyboards/neopad/rev1/rev1.h @@ -0,0 +1,26 @@ +/* Copyright 2021 rookiebwoy + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once +#include "quantum.h" + +#define LAYOUT( \ + k00, k01, k02, \ + k10, k11, k12 \ +) \ +{ \ + { k00, k01, k02 }, \ + { k10, k11, k12 } \ +} diff --git a/keyboards/neopad/rev1/rules.mk b/keyboards/neopad/rev1/rules.mk new file mode 100755 index 000000000000..309e3d48c047 --- /dev/null +++ b/keyboards/neopad/rev1/rules.mk @@ -0,0 +1,25 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +BLUETOOTH_ENABLE = no # Enable Bluetooth +AUDIO_ENABLE = no # Audio output + +ENCODER_ENABLE = yes +KEY_LOCK_ENABLE = yes diff --git a/keyboards/neopad/rules.mk b/keyboards/neopad/rules.mk new file mode 100755 index 000000000000..8fc1afe955a5 --- /dev/null +++ b/keyboards/neopad/rules.mk @@ -0,0 +1 @@ +DEFAULT_FOLDER = neopad/rev1 From bb4c9a98c7be9468c238b9663fae916dbe7a7f7b Mon Sep 17 00:00:00 2001 From: rookiebwoy <81021475+rookiebwoy@users.noreply.github.com> Date: Sun, 18 Apr 2021 22:14:14 +0200 Subject: [PATCH 2/6] added readme inside rev1 folder --- keyboards/neopad/rev1/readme.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 keyboards/neopad/rev1/readme.md diff --git a/keyboards/neopad/rev1/readme.md b/keyboards/neopad/rev1/readme.md new file mode 100644 index 000000000000..12659227224c --- /dev/null +++ b/keyboards/neopad/rev1/readme.md @@ -0,0 +1,5 @@ +# Neopad rev1 + +Final revision of the Neopad macropad. For in depth look please go to [project repository](https://github.com/rookiebwoy/neopad). + + From 1bb18169205ffd5dab15df97c0c7e505e6af86fe Mon Sep 17 00:00:00 2001 From: rookiebwoy <81021475+rookiebwoy@users.noreply.github.com> Date: Tue, 20 Apr 2021 19:01:54 +0200 Subject: [PATCH 3/6] added reset instructions and cleaned rev1.c led code --- keyboards/neopad/readme.md | 2 ++ keyboards/neopad/rev1/rev1.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/keyboards/neopad/readme.md b/keyboards/neopad/readme.md index 56d2f5d05f0f..2d1d8e0cde9e 100644 --- a/keyboards/neopad/readme.md +++ b/keyboards/neopad/readme.md @@ -19,5 +19,7 @@ Install examples: make neopad/rev1:default:avrdude +When asked by the terminal, press the dedicated `RESET` button (the one above the 2 LEDs) to enter the bootloader and let the OS detects the device. + 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 [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). diff --git a/keyboards/neopad/rev1/rev1.c b/keyboards/neopad/rev1/rev1.c index fca9508d2fc8..20e2c4d0555a 100755 --- a/keyboards/neopad/rev1/rev1.c +++ b/keyboards/neopad/rev1/rev1.c @@ -29,11 +29,13 @@ void shutdown_user() { } layer_state_t layer_state_set_kb(layer_state_t state) { + state = layer_state_set_user(state); + // Layer LEDs act as binary indication of current layer uint8_t layer = get_highest_layer(state); writePin(LED_00, layer & 0b1); writePin(LED_01, (layer >> 1) & 0b1); - return layer_state_set_user(state); + return state; } // Optional override functions below. From 2ea6d961d625b65a83f703f5e64832f9bb1fb14b Mon Sep 17 00:00:00 2001 From: rookiebwoy <81021475+rookiebwoy@users.noreply.github.com> Date: Wed, 28 Apr 2021 05:53:12 +0200 Subject: [PATCH 4/6] resized image thumbnail --- keyboards/neopad/readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keyboards/neopad/readme.md b/keyboards/neopad/readme.md index 2d1d8e0cde9e..e68e224d6dee 100644 --- a/keyboards/neopad/readme.md +++ b/keyboards/neopad/readme.md @@ -1,9 +1,9 @@ # Neopad -Neopad is a little macro pad with four switches and two rotary encoders, made by through hole components only. +Neopad is a little macropad with four switches and two rotary encoders, made by through hole components only. _Actually the number of switches is six, because even the encoder are allowed to click._ -![Neopad](https://i.imgur.com/TgOkj2F.jpg "Neopad first proto") +![Neopad](https://i.imgur.com/TgOkj2Fh.jpg "Neopad first proto") The Neopad in the photo above is the first prototype. See the project repository for revision 1 update and KiCad files. From 554a96c5964e3fddeea7fadd72faa015466fe54c Mon Sep 17 00:00:00 2001 From: rookiebwoy <81021475+rookiebwoy@users.noreply.github.com> Date: Wed, 28 Apr 2021 05:54:26 +0200 Subject: [PATCH 5/6] removed coomented code for debugging --- keyboards/neopad/rev1/keymaps/default/keymap.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/keyboards/neopad/rev1/keymaps/default/keymap.c b/keyboards/neopad/rev1/keymaps/default/keymap.c index 8d7db7560888..061e26d43eea 100755 --- a/keyboards/neopad/rev1/keymaps/default/keymap.c +++ b/keyboards/neopad/rev1/keymaps/default/keymap.c @@ -70,23 +70,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - // If console is enabled, it will print the matrix position and status of each key pressed -/* -#ifdef CONSOLE_ENABLE - uprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed); -#endif -*/ - return true; -} - -void keyboard_post_init_user(void) { - // Customise these values to desired behaviour - // debug_enable = true; - // debug_matrix = true; - // debug_keyboard = true; - // debug_mouse = true; -} void encoder_update_user(uint8_t index, bool clockwise) { if (index == 0) { /* LEFT ENCODER */ From 1bf10c027d0082465cbfc14dac1cab6599758918 Mon Sep 17 00:00:00 2001 From: rookiebwoy <81021475+rookiebwoy@users.noreply.github.com> Date: Thu, 29 Apr 2021 22:48:31 +0200 Subject: [PATCH 6/6] reviewed readme firmware flash command --- keyboards/neopad/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keyboards/neopad/readme.md b/keyboards/neopad/readme.md index e68e224d6dee..9e83e9bb6d10 100644 --- a/keyboards/neopad/readme.md +++ b/keyboards/neopad/readme.md @@ -11,13 +11,13 @@ The Neopad in the photo above is the first prototype. See the project repository * Hardware supported: ProMicro, _Elite-C (not tested)_ * Project repository: [Neopad on github](https://github.com/rookiebwoy/neopad) -Make example for Neopad (after setting up your build environment): +Make example for this keyboard (after setting up your build environment): make neopad/rev1:default -Install examples: +Flashing example for this keyboard: - make neopad/rev1:default:avrdude + make neopad/rev1:default:flash When asked by the terminal, press the dedicated `RESET` button (the one above the 2 LEDs) to enter the bootloader and let the OS detects the device.