From 2e521b509ce0c853b2e62d1d16e0117b900ab9c2 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Mon, 9 Sep 2019 22:03:33 -0700 Subject: [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 * Switch to image offsite * Moved image offsite * Update keyboards/handwired/2x5keypad/keymaps/default/keymap.h Co-Authored-By: fauxpark * Update keyboards/handwired/2x5keypad/2x5keypad.h Co-Authored-By: fauxpark * Moved functions into .c file per suggestions * Cosmetic * Fixed function called, per suggestions. * Update keyboards/handwired/2x5keypad/2x5keypad.h Ok Co-Authored-By: fauxpark * 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 --- keyboards/handwired/2x5keypad/2x5keypad.c | 25 ++++++++ keyboards/handwired/2x5keypad/2x5keypad.h | 21 +++++++ keyboards/handwired/2x5keypad/config.h | 56 ++++++++++++++++++ .../handwired/2x5keypad/keymaps/default/keymap.c | 69 ++++++++++++++++++++++ keyboards/handwired/2x5keypad/readme.md | 26 ++++++++ keyboards/handwired/2x5keypad/rules.mk | 13 ++++ 6 files changed, 210 insertions(+) create mode 100644 keyboards/handwired/2x5keypad/2x5keypad.c create mode 100644 keyboards/handwired/2x5keypad/2x5keypad.h create mode 100644 keyboards/handwired/2x5keypad/config.h create mode 100644 keyboards/handwired/2x5keypad/keymaps/default/keymap.c create mode 100644 keyboards/handwired/2x5keypad/readme.md create mode 100644 keyboards/handwired/2x5keypad/rules.mk (limited to 'keyboards/handwired/2x5keypad') diff --git a/keyboards/handwired/2x5keypad/2x5keypad.c b/keyboards/handwired/2x5keypad/2x5keypad.c new file mode 100644 index 0000000000..873c579a17 --- /dev/null +++ b/keyboards/handwired/2x5keypad/2x5keypad.c @@ -0,0 +1,25 @@ +#include "2x5keypad.h" + + +void matrix_init_kb(void) +{ + matrix_init_user(); + + setPinOutput(RED_LED); + setPinOutput(BLUE_LED); + setPinOutput(GREEN_LED); +} + + + +void turn_off_leds(void) +{ + writePinLow(RED_LED); + writePinLow(BLUE_LED); + writePinLow(GREEN_LED); +} + +void turn_on_led(pin_t pin) +{ + writePinHigh(pin); +} diff --git a/keyboards/handwired/2x5keypad/2x5keypad.h b/keyboards/handwired/2x5keypad/2x5keypad.h new file mode 100644 index 0000000000..6284e83b72 --- /dev/null +++ b/keyboards/handwired/2x5keypad/2x5keypad.h @@ -0,0 +1,21 @@ +#pragma once + +#include "quantum.h" + +#define RED_LED D0 +#define BLUE_LED B5 +#define GREEN_LED B6 + + +#define LAYOUT( \ + K00, K01, K02, K03, K04, \ + K10, K11, K12, K13, K14 \ +) { \ + { K00, K01, K02, K03, K04 }, \ + { K10, K11, K12, K13, K14 } \ +} + + + +void turn_off_leds(void); +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 0000000000..6d09b5ed00 --- /dev/null +++ b/keyboards/handwired/2x5keypad/config.h @@ -0,0 +1,56 @@ +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x2020 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Jonathan Cameron +#define PRODUCT 2x5keypad +#define DESCRIPTION 2x5 Keypad + +/* key matrix size */ +#define MATRIX_ROWS 2 +#define MATRIX_COLS 5 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { B3, B2 } +#define MATRIX_COL_PINS { D4, C6, D7, E6, B4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ + +#ifdef BACKLIGHT_PIN +#define BACKLIGHT_LEVELS 0 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* 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 + +/* key combination for command */ +/* DISABLED +#define IS_COMMAND() ( \ + get_mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) +*/ + +/* prevent stuck modifiers */ + + +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 0 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif diff --git a/keyboards/handwired/2x5keypad/keymaps/default/keymap.c b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c new file mode 100644 index 0000000000..808824f3a2 --- /dev/null +++ b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c @@ -0,0 +1,69 @@ +#include QMK_KEYBOARD_H + +#define WIN_TAB LGUI(KC_TAB) +#define WIN_LOCK LGUI(KC_L) + +enum layers { + NORMAL_LAYER = 0, + MEDIA_LAYER, + TBD_LAYER2, + TBD_LAYER3 +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [NORMAL_LAYER]= + LAYOUT(TO(1), WIN_TAB, KC_HOME, KC_UP, KC_END, + WIN_LOCK, KC_MUTE, KC_LEFT, KC_DOWN, KC_RGHT), + + [MEDIA_LAYER]= + LAYOUT(TO(2), KC_CALC, KC_MPRV, KC_MNXT, KC_VOLU, + KC_TRNS, KC_TRNS, KC_MSTP, KC_MPLY, KC_VOLD), + + [TBD_LAYER2]= + LAYOUT(TO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + [TBD_LAYER3]= + LAYOUT(TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) +}; + + +/* DISABLED +void matrix_init_user(void) { +} + +void matrix_scan_user(void) { +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} +*/ + + +layer_state_t layer_state_set_user(layer_state_t state) +{ + turn_off_leds(); + + switch (biton32(state)) + { + case NORMAL_LAYER: + break; + + case MEDIA_LAYER: + turn_on_led(RED_LED); + break; + + case TBD_LAYER2: + turn_on_led(BLUE_LED); + break; + + case TBD_LAYER3: + turn_on_led(GREEN_LED); + break; + } + return state; +} diff --git a/keyboards/handwired/2x5keypad/readme.md b/keyboards/handwired/2x5keypad/readme.md new file mode 100644 index 0000000000..d87a2e0178 --- /dev/null +++ b/keyboards/handwired/2x5keypad/readme.md @@ -0,0 +1,26 @@ +# 2x5keypad + +![2x5keypad](http://jmcameron.net/2x5keypad-small.jpg) + +This Keypad has 2 rows x 5 columns of keys. It has the top/default layer that +has a few handy navigation keys as well as one dedicated key to cycle through +the layers. The second layer has some media keys. The third and fourth layers +are currently undefined (although I may use them for inserting accented French +characters). The keypad also includes three LEDs that show which layer is +active (no lit LEDs means the default layer). + +Keyboard Maintainer: [Jonathan Cameron](https://github.com/jmcameron) + +Hardware: + * Key switch holes cut in blank piece of copper-clad project board + * Uses Kailh Box White switches with relegendable keycaps + * Chassis is three layers of wood + * Handwired + * Uses a Pro Micro + * Includes a reset switch accessible by a hole on the bottom + +Make example for this keyboard (after setting up your build environment): + + make handwired/2x5keyapd:default + +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 0000000000..fd999de2c2 --- /dev/null +++ b/keyboards/handwired/2x5keypad/rules.mk @@ -0,0 +1,13 @@ +MCU = atmega32u4 +BOOTLOADER = caterina + +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +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 +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = no -- cgit v1.2.3 From 3dbf08b655ac1f14bc7a5ae2b8cd8ae385063640 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Mon, 21 Oct 2019 06:51:37 +1100 Subject: Cleanup rules.mk for 32U4 keyboards, H (#7030) * Cleanup rules.mk for 32U4 keyboards, H * Change some boards incorrectly assumed to be halfkay --- keyboards/handwired/2x5keypad/rules.mk | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'keyboards/handwired/2x5keypad') diff --git a/keyboards/handwired/2x5keypad/rules.mk b/keyboards/handwired/2x5keypad/rules.mk index fd999de2c2..b7027cd9e9 100644 --- a/keyboards/handwired/2x5keypad/rules.mk +++ b/keyboards/handwired/2x5keypad/rules.mk @@ -1,4 +1,14 @@ +# MCU name MCU = atmega32u4 + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# ATmega32A bootloadHID +# ATmega328P USBasp BOOTLOADER = caterina BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration -- cgit v1.2.3 From 1d550552cab30ef49b5935bdd31bf2f659255c19 Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Mon, 11 Nov 2019 09:26:14 -0800 Subject: [Keyboard] Added French layer to handwired/2x5keypad (#7313) * 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 * Switch to image offsite * Moved image offsite * Update keyboards/handwired/2x5keypad/keymaps/default/keymap.h Co-Authored-By: fauxpark * Update keyboards/handwired/2x5keypad/2x5keypad.h Co-Authored-By: fauxpark * Moved functions into .c file per suggestions * Cosmetic * Fixed function called, per suggestions. * Update keyboards/handwired/2x5keypad/2x5keypad.h Ok Co-Authored-By: fauxpark * 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 * First cut at French support * Added French layer (green) for accented and special French characters * Added french layer * Fixed typo * Updated to get more reasonable tap function --- keyboards/handwired/2x5keypad/config.h | 6 +- .../handwired/2x5keypad/keymaps/default/keymap.c | 123 ++++++++++++++++++--- keyboards/handwired/2x5keypad/rules.mk | 16 ++- 3 files changed, 122 insertions(+), 23 deletions(-) (limited to 'keyboards/handwired/2x5keypad') diff --git a/keyboards/handwired/2x5keypad/config.h b/keyboards/handwired/2x5keypad/config.h index 6d09b5ed00..35a0fda8d1 100644 --- a/keyboards/handwired/2x5keypad/config.h +++ b/keyboards/handwired/2x5keypad/config.h @@ -37,6 +37,9 @@ /* Locking resynchronize hack */ #define LOCKING_RESYNC_ENABLE +/* Tap dancing params */ +#define TAPPING_TERM 250 + /* key combination for command */ /* DISABLED #define IS_COMMAND() ( \ @@ -44,9 +47,6 @@ ) */ -/* prevent stuck modifiers */ - - #ifdef RGB_DI_PIN #define RGBLIGHT_ANIMATIONS #define RGBLED_NUM 0 diff --git a/keyboards/handwired/2x5keypad/keymaps/default/keymap.c b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c index 808824f3a2..91a0e28f6a 100644 --- a/keyboards/handwired/2x5keypad/keymaps/default/keymap.c +++ b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c @@ -7,27 +7,116 @@ enum layers { NORMAL_LAYER = 0, MEDIA_LAYER, TBD_LAYER2, - TBD_LAYER3 + FRENCH_LAYER }; +/* Enum for the tap dancing keys */ +enum tap_codes { + A_Q, E_Q, E_U, E_E, + A_Y, I_I, O_C, U_U +}; + +#define FR_A_GRAVE "00E0" +#define FR_A_HAT "00E2" + +#define FR_C_CIRCUM "00E7" + +#define FR_E_AIGU "00E9" +#define FR_E_GRAVE "00E8" +#define FR_E_HAT "00EA" +#define FR_E_UMLAUT "00EB" + +#define FR_I_HAT "00EE" +#define FR_I_UMLAUT "00EF" + +#define FR_O_HAT "00F4" + +#define FR_U_GRAVE "00F9" +#define FR_U_HAT "00FB" +#define FR_U_UMLAUT "00FC" + +#define FR_Y_UMLAUT "00FF" + +#define FR_L_QUOTE "00AB" +#define FR_R_QUOTE "00BB" + +void send_french_unicode_char(uint8_t count, char *once, char *twice) +{ + if (count <= 1) + send_unicode_hex_string(once); + else + send_unicode_hex_string(twice); +} + +void dance_a_q(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_A_GRAVE, FR_L_QUOTE); +} + +void dance_e_q(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_E_AIGU, FR_R_QUOTE); +} + +void dance_e_u(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_E_GRAVE, FR_U_GRAVE); +} + +void dance_e_e(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_E_HAT, FR_E_UMLAUT); +} + +void dance_a_y(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_A_HAT, FR_Y_UMLAUT); +} + +void dance_i_i(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_I_HAT, FR_I_UMLAUT); +} + +void dance_o_c(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_O_HAT, FR_C_CIRCUM); +} + +void dance_u_u(qk_tap_dance_state_t *state, void *user_data) +{ + send_french_unicode_char(state->count, FR_U_HAT, FR_U_UMLAUT); +} + +/* Define the tap dance actions for the french characters */ +qk_tap_dance_action_t tap_dance_actions[] = { + [A_Q] = ACTION_TAP_DANCE_FN(dance_a_q), + [E_Q] = ACTION_TAP_DANCE_FN(dance_e_q), + [E_U] = ACTION_TAP_DANCE_FN(dance_e_u), + [E_E] = ACTION_TAP_DANCE_FN(dance_e_e), + + [A_Y] = ACTION_TAP_DANCE_FN(dance_a_y), + [I_I] = ACTION_TAP_DANCE_FN(dance_i_i), + [O_C] = ACTION_TAP_DANCE_FN(dance_o_c), + [U_U] = ACTION_TAP_DANCE_FN(dance_u_u) +}; + + + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [NORMAL_LAYER]= - LAYOUT(TO(1), WIN_TAB, KC_HOME, KC_UP, KC_END, - WIN_LOCK, KC_MUTE, KC_LEFT, KC_DOWN, KC_RGHT), + [NORMAL_LAYER] = LAYOUT(TO(1), WIN_TAB, KC_HOME, KC_UP, KC_END, + WIN_LOCK, KC_MUTE, KC_LEFT, KC_DOWN, KC_RGHT), - [MEDIA_LAYER]= - LAYOUT(TO(2), KC_CALC, KC_MPRV, KC_MNXT, KC_VOLU, - KC_TRNS, KC_TRNS, KC_MSTP, KC_MPLY, KC_VOLD), + [MEDIA_LAYER] = LAYOUT(TO(2), KC_CALC, KC_MPRV, KC_MNXT, KC_VOLU, + KC_TRNS, KC_TRNS, KC_MSTP, KC_MPLY, KC_VOLD), - [TBD_LAYER2]= - LAYOUT(TO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + [TBD_LAYER2] = LAYOUT(TO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - [TBD_LAYER3]= - LAYOUT(TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) + [FRENCH_LAYER] = LAYOUT(TO(0), TD(A_Q), TD(E_Q), TD(E_U), TD(E_E), + KC_TRNS, TD(A_Y), TD(I_I), TD(O_C), TD(U_U)) }; @@ -44,6 +133,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { */ +void matrix_init_user(void) +{ + set_unicode_input_mode(UC_WINC); /* See https://jayliu50.github.io/qmk-cheatsheet/ */ +} + + layer_state_t layer_state_set_user(layer_state_t state) { turn_off_leds(); @@ -61,7 +156,7 @@ layer_state_t layer_state_set_user(layer_state_t state) turn_on_led(BLUE_LED); break; - case TBD_LAYER3: + case FRENCH_LAYER: turn_on_led(GREEN_LED); break; } diff --git a/keyboards/handwired/2x5keypad/rules.mk b/keyboards/handwired/2x5keypad/rules.mk index b7027cd9e9..e62a0f24a8 100644 --- a/keyboards/handwired/2x5keypad/rules.mk +++ b/keyboards/handwired/2x5keypad/rules.mk @@ -11,13 +11,17 @@ MCU = atmega32u4 # ATmega328P USBasp BOOTLOADER = caterina + +AUDIO_ENABLE = no +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration -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 -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +CONSOLE_ENABLE= no # Console for debug +EXTRAKEY_ENABLE = yes # Audio control and System control +MOUSEKEY_ENABLE = yes # Mouse keys NKRO_ENABLE = yes # USB Nkey Rollover - -BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality -AUDIO_ENABLE = no + RGBLIGHT_ENABLE = no +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +UNICODE_ENABLE = yes +TAP_DANCE_ENABLE = yes -- cgit v1.2.3