mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-10-31 13:22:31 +01:00 
			
		
		
		
	[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>
This commit is contained in:
		
							parent
							
								
									00225b77e5
								
							
						
					
					
						commit
						2e521b509c
					
				
							
								
								
									
										25
									
								
								keyboards/handwired/2x5keypad/2x5keypad.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								keyboards/handwired/2x5keypad/2x5keypad.c
									
									
									
									
									
										Normal file
									
								
							| @ -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); | ||||
| } | ||||
							
								
								
									
										21
									
								
								keyboards/handwired/2x5keypad/2x5keypad.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								keyboards/handwired/2x5keypad/2x5keypad.h
									
									
									
									
									
										Normal file
									
								
							| @ -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); | ||||
							
								
								
									
										56
									
								
								keyboards/handwired/2x5keypad/config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								keyboards/handwired/2x5keypad/config.h
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||
							
								
								
									
										69
									
								
								keyboards/handwired/2x5keypad/keymaps/default/keymap.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								keyboards/handwired/2x5keypad/keymaps/default/keymap.c
									
									
									
									
									
										Normal file
									
								
							| @ -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; | ||||
| } | ||||
							
								
								
									
										26
									
								
								keyboards/handwired/2x5keypad/readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								keyboards/handwired/2x5keypad/readme.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| # 2x5keypad | ||||
| 
 | ||||
|  | ||||
| 
 | ||||
| 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
									
								
								keyboards/handwired/2x5keypad/rules.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								keyboards/handwired/2x5keypad/rules.mk
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jonathan Cameron
						Jonathan Cameron