Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a simple 2x5 Keypad with 4 layers #6699

Merged
merged 21 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions keyboards/handwired/2x5keypad/2x5keypad.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "2x5keypad.h"


void matrix_init_kb(void)
{
matrix_init_user();

setPinOutput(RED_LED);
setPinOutput(BLUE_LED);
setPinOutput(GREEN_LED);
}
19 changes: 19 additions & 0 deletions keyboards/handwired/2x5keypad/2x5keypad.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include "quantum.h"
#include "led.h"
jmcameron marked this conversation as resolved.
Show resolved Hide resolved

#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 } \
}


57 changes: 57 additions & 0 deletions keyboards/handwired/2x5keypad/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#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 */
#define PREVENT_STUCK_MODIFIERS
jmcameron marked this conversation as resolved.
Show resolved Hide resolved


#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
82 changes: 82 additions & 0 deletions keyboards/handwired/2x5keypad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#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;
}
*/


void turn_off_leds(void)
{
writePinLow(RED_LED);
writePinLow(BLUE_LED);
writePinLow(GREEN_LED);
}

void turn_on_led(pin_t pin)
{
writePinHigh(pin);
}


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;
}
26 changes: 26 additions & 0 deletions keyboards/handwired/2x5keypad/readme.md
Original file line number Diff line number Diff line change
@@ -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).
13 changes: 13 additions & 0 deletions keyboards/handwired/2x5keypad/rules.mk
Original file line number Diff line number Diff line change
@@ -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