diff options
| author | Jonathan Cameron <jmcameron@gmail.com> | 2019-09-09 22:03:33 -0700 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-09-09 22:03:33 -0700 |
| commit | 2e521b509ce0c853b2e62d1d16e0117b900ab9c2 (patch) | |
| tree | c795ea9e11322edaebdd7cde506fb6014cebb8cf | |
| parent | 00225b77e54fdc893f6c64768e1bffaa01df5849 (diff) | |
| download | qmk_firmware-2e521b509ce0c853b2e62d1d16e0117b900ab9c2.tar.gz qmk_firmware-2e521b509ce0c853b2e62d1d16e0117b900ab9c2.zip | |
[Keyboard] Added a simple 2x5 Keypad with 4 layers (#6699)
* Added new 2x5 Keypad with 3 LEDs to indicate the selected layer. By Jonathan Cameron.
* Minor refactor from suggestions from qmk team
* Added
* Moved to 'handwired' directory
* Update readme.md
* Update readme.md
* Update readme.md
* Update keyboards/handwired/2x5keypad/readme.md
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Switch to image offsite
* Moved image offsite
* Update keyboards/handwired/2x5keypad/keymaps/default/keymap.h
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Update keyboards/handwired/2x5keypad/2x5keypad.h
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Moved functions into .c file per suggestions
* Cosmetic
* Fixed function called, per suggestions.
* Update keyboards/handwired/2x5keypad/2x5keypad.h
Ok
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Moved LED functions to the top level since they can be used it various flavors
* Declare those moved LED functions!
* Update keyboards/handwired/2x5keypad/config.h
Co-Authored-By: Drashna Jaelre <drashna@live.com>
| -rw-r--r-- | keyboards/handwired/2x5keypad/2x5keypad.c | 25 | ||||
| -rw-r--r-- | keyboards/handwired/2x5keypad/2x5keypad.h | 21 | ||||
| -rw-r--r-- | keyboards/handwired/2x5keypad/config.h | 56 | ||||
| -rw-r--r-- | keyboards/handwired/2x5keypad/keymaps/default/keymap.c | 69 | ||||
| -rw-r--r-- | keyboards/handwired/2x5keypad/readme.md | 26 | ||||
| -rw-r--r-- | keyboards/handwired/2x5keypad/rules.mk | 13 |
6 files changed, 210 insertions, 0 deletions
diff --git a/keyboards/handwired/2x5keypad/2x5keypad.c b/keyboards/handwired/2x5keypad/2x5keypad.c new file mode 100644 index 000000000..873c579a1 --- /dev/null +++ b/keyboards/handwired/2x5keypad/2x5keypad.c | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #include "2x5keypad.h" | ||
| 2 | |||
| 3 | |||
| 4 | void matrix_init_kb(void) | ||
| 5 | { | ||
| 6 | matrix_init_user(); | ||
| 7 | |||
| 8 | setPinOutput(RED_LED); | ||
| 9 | setPinOutput(BLUE_LED); | ||
| 10 | setPinOutput(GREEN_LED); | ||
| 11 | } | ||
| 12 | |||
| 13 | |||
| 14 | |||
| 15 | void turn_off_leds(void) | ||
| 16 | { | ||
| 17 | writePinLow(RED_LED); | ||
| 18 | writePinLow(BLUE_LED); | ||
| 19 | writePinLow(GREEN_LED); | ||
| 20 | } | ||
| 21 | |||
| 22 | void turn_on_led(pin_t pin) | ||
| 23 | { | ||
| 24 | writePinHigh(pin); | ||
| 25 | } | ||
diff --git a/keyboards/handwired/2x5keypad/2x5keypad.h b/keyboards/handwired/2x5keypad/2x5keypad.h new file mode 100644 index 000000000..6284e83b7 --- /dev/null +++ b/keyboards/handwired/2x5keypad/2x5keypad.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | #define RED_LED D0 | ||
| 6 | #define BLUE_LED B5 | ||
| 7 | #define GREEN_LED B6 | ||
| 8 | |||
| 9 | |||
| 10 | #define LAYOUT( \ | ||
| 11 | K00, K01, K02, K03, K04, \ | ||
| 12 | K10, K11, K12, K13, K14 \ | ||
| 13 | ) { \ | ||
| 14 | { K00, K01, K02, K03, K04 }, \ | ||
| 15 | { K10, K11, K12, K13, K14 } \ | ||
| 16 | } | ||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | void turn_off_leds(void); | ||
| 21 | void turn_on_led(pin_t pin); | ||
diff --git a/keyboards/handwired/2x5keypad/config.h b/keyboards/handwired/2x5keypad/config.h new file mode 100644 index 000000000..6d09b5ed0 --- /dev/null +++ b/keyboards/handwired/2x5keypad/config.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "config_common.h" | ||
| 4 | |||
| 5 | /* USB Device descriptor parameter */ | ||
| 6 | #define VENDOR_ID 0xFEED | ||
| 7 | #define PRODUCT_ID 0x2020 | ||
| 8 | #define DEVICE_VER 0x0001 | ||
| 9 | #define MANUFACTURER Jonathan Cameron | ||
| 10 | #define PRODUCT 2x5keypad | ||
| 11 | #define DESCRIPTION 2x5 Keypad | ||
| 12 | |||
| 13 | /* key matrix size */ | ||
| 14 | #define MATRIX_ROWS 2 | ||
| 15 | #define MATRIX_COLS 5 | ||
| 16 | |||
| 17 | /* key matrix pins */ | ||
| 18 | #define MATRIX_ROW_PINS { B3, B2 } | ||
| 19 | #define MATRIX_COL_PINS { D4, C6, D7, E6, B4 } | ||
| 20 | #define UNUSED_PINS | ||
| 21 | |||
| 22 | /* COL2ROW or ROW2COL */ | ||
| 23 | #define DIODE_DIRECTION COL2ROW | ||
| 24 | |||
| 25 | /* number of backlight levels */ | ||
| 26 | |||
| 27 | #ifdef BACKLIGHT_PIN | ||
| 28 | #define BACKLIGHT_LEVELS 0 | ||
| 29 | #endif | ||
| 30 | |||
| 31 | /* Set 0 if debouncing isn't needed */ | ||
| 32 | #define DEBOUNCE 5 | ||
| 33 | |||
| 34 | /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ | ||
| 35 | #define LOCKING_SUPPORT_ENABLE | ||
| 36 | |||
| 37 | /* Locking resynchronize hack */ | ||
| 38 | #define LOCKING_RESYNC_ENABLE | ||
| 39 | |||
| 40 | /* key combination for command */ | ||
| 41 | /* DISABLED | ||
| 42 | #define IS_COMMAND() ( \ | ||
| 43 | get_mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ | ||
| 44 | ) | ||
| 45 | */ | ||
| 46 | |||
| 47 | /* prevent stuck modifiers */ | ||
| 48 | |||
| 49 | |||
| 50 | #ifdef RGB_DI_PIN | ||
| 51 | #define RGBLIGHT_ANIMATIONS | ||
| 52 | #define RGBLED_NUM 0 | ||
| 53 | #define RGBLIGHT_HUE_STEP 8 | ||
| 54 | #define RGBLIGHT_SAT_STEP 8 | ||
| 55 | #define RGBLIGHT_VAL_STEP 8 | ||
| 56 | #endif | ||
diff --git a/keyboards/handwired/2x5keypad/keymaps/default/keymap.c b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c new file mode 100644 index 000000000..808824f3a --- /dev/null +++ b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | #include QMK_KEYBOARD_H | ||
| 2 | |||
| 3 | #define WIN_TAB LGUI(KC_TAB) | ||
| 4 | #define WIN_LOCK LGUI(KC_L) | ||
| 5 | |||
| 6 | enum layers { | ||
| 7 | NORMAL_LAYER = 0, | ||
| 8 | MEDIA_LAYER, | ||
| 9 | TBD_LAYER2, | ||
| 10 | TBD_LAYER3 | ||
| 11 | }; | ||
| 12 | |||
| 13 | |||
| 14 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 15 | |||
| 16 | [NORMAL_LAYER]= | ||
| 17 | LAYOUT(TO(1), WIN_TAB, KC_HOME, KC_UP, KC_END, | ||
| 18 | WIN_LOCK, KC_MUTE, KC_LEFT, KC_DOWN, KC_RGHT), | ||
| 19 | |||
| 20 | [MEDIA_LAYER]= | ||
| 21 | LAYOUT(TO(2), KC_CALC, KC_MPRV, KC_MNXT, KC_VOLU, | ||
| 22 | KC_TRNS, KC_TRNS, KC_MSTP, KC_MPLY, KC_VOLD), | ||
| 23 | |||
| 24 | [TBD_LAYER2]= | ||
| 25 | LAYOUT(TO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 26 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
| 27 | |||
| 28 | [TBD_LAYER3]= | ||
| 29 | LAYOUT(TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | ||
| 30 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) | ||
| 31 | }; | ||
| 32 | |||
| 33 | |||
| 34 | /* DISABLED | ||
| 35 | void matrix_init_user(void) { | ||
| 36 | } | ||
| 37 | |||
| 38 | void matrix_scan_user(void) { | ||
| 39 | } | ||
| 40 | |||
| 41 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 42 | return true; | ||
| 43 | } | ||
| 44 | */ | ||
| 45 | |||
| 46 | |||
| 47 | layer_state_t layer_state_set_user(layer_state_t state) | ||
| 48 | { | ||
| 49 | turn_off_leds(); | ||
| 50 | |||
| 51 | switch (biton32(state)) | ||
| 52 | { | ||
| 53 | case NORMAL_LAYER: | ||
| 54 | break; | ||
| 55 | |||
| 56 | case MEDIA_LAYER: | ||
| 57 | turn_on_led(RED_LED); | ||
| 58 | break; | ||
| 59 | |||
| 60 | case TBD_LAYER2: | ||
| 61 | turn_on_led(BLUE_LED); | ||
| 62 | break; | ||
| 63 | |||
| 64 | case TBD_LAYER3: | ||
| 65 | turn_on_led(GREEN_LED); | ||
| 66 | break; | ||
| 67 | } | ||
| 68 | return state; | ||
| 69 | } | ||
diff --git a/keyboards/handwired/2x5keypad/readme.md b/keyboards/handwired/2x5keypad/readme.md new file mode 100644 index 000000000..d87a2e017 --- /dev/null +++ b/keyboards/handwired/2x5keypad/readme.md | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | # 2x5keypad | ||
| 2 | |||
| 3 |  | ||
| 4 | |||
| 5 | This Keypad has 2 rows x 5 columns of keys. It has the top/default layer that | ||
| 6 | has a few handy navigation keys as well as one dedicated key to cycle through | ||
| 7 | the layers. The second layer has some media keys. The third and fourth layers | ||
| 8 | are currently undefined (although I may use them for inserting accented French | ||
| 9 | characters). The keypad also includes three LEDs that show which layer is | ||
| 10 | active (no lit LEDs means the default layer). | ||
| 11 | |||
| 12 | Keyboard Maintainer: [Jonathan Cameron](https://github.com/jmcameron) | ||
| 13 | |||
| 14 | Hardware: | ||
| 15 | * Key switch holes cut in blank piece of copper-clad project board | ||
| 16 | * Uses Kailh Box White switches with relegendable keycaps | ||
| 17 | * Chassis is three layers of wood | ||
| 18 | * Handwired | ||
| 19 | * Uses a Pro Micro | ||
| 20 | * Includes a reset switch accessible by a hole on the bottom | ||
| 21 | |||
| 22 | Make example for this keyboard (after setting up your build environment): | ||
| 23 | |||
| 24 | make handwired/2x5keyapd:default | ||
| 25 | |||
| 26 | 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/handwired/2x5keypad/rules.mk b/keyboards/handwired/2x5keypad/rules.mk new file mode 100644 index 000000000..fd999de2c --- /dev/null +++ b/keyboards/handwired/2x5keypad/rules.mk | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | MCU = atmega32u4 | ||
| 2 | BOOTLOADER = caterina | ||
| 3 | |||
| 4 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration | ||
| 5 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
| 6 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
| 7 | CONSOLE_ENABLE= no # Console for debug | ||
| 8 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
| 9 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
| 10 | NKRO_ENABLE = yes # USB Nkey Rollover - | ||
| 11 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
| 12 | AUDIO_ENABLE = no | ||
| 13 | RGBLIGHT_ENABLE = no | ||
