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

Puck Macropad #4274

Merged
merged 10 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
34 changes: 34 additions & 0 deletions keyboards/puck/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#ifndef CONFIG_H
#define CONFIG_H

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER OKKeebs, LLC
#define PRODUCT Puck
#define DESCRIPTION 4x3 macropad

/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 3

#define MATRIX_ROW_PINS { D2, D3, C6, C7 }
#define MATRIX_COL_PINS { B4, D7, D6 }
#define UNUSED_PINS

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 5

/* number of backlight levels */
#define BACKLIGHT_LEVELS 3

/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

#endif
64 changes: 64 additions & 0 deletions keyboards/puck/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "puck.h"

#define _BL 0
#define _HL 1
#define _LL 2

enum keycodes {
LOW,
HIGH
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* Base Layer (Numbers)
*/
[_BL] = LAYOUT(
KC_KP_7, KC_KP_8, KC_KP_9,
KC_KP_4, KC_KP_5, KC_KP_6,
KC_KP_1, KC_KP_2, KC_KP_3,
LOW, KC_KP_0, HIGH
),
/*
* High Layer (Work)
*/
[_HL] = LAYOUT(
KC_NUMLOCK, KC_PAST, KC_NO,
KC_PMNS, KC_PENT, KC_PPLS,
KC_NO, KC_PSLS, KC_NO,
KC_NO, KC_PDOT, KC_NO
),
/*
* Low Layer (Media)
*/
[_LL] = LAYOUT(
KC_NO, KC_VOLU, KC_NO,
KC_MPRV, KC_MPLY, KC_MNXT,
KC_NO, KC_VOLD, KC_NO,
KC_NO, KC_NO, KC_NO
),
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch(keycode) {
case HIGH:
if (record->event.pressed) {
layer_on(_HL);
}else{
layer_off(_HL);
layer_off(_LL);
}
return false;
break;
case LOW:
if (record->event.pressed) {
layer_on(_LL);
}else{
layer_off(_LL);
layer_off(_HL);
}
return false;
break;
}
return true;
}
1 change: 1 addition & 0 deletions keyboards/puck/puck.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "puck.h"
17 changes: 17 additions & 0 deletions keyboards/puck/puck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef PUCK_H
#define PUCK_H

#include "quantum.h"

#define LAYOUT( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B \
) { \
{ K00, K01, K02 }, \
{ K03, K04, K05 }, \
{ K06, K07, K08 }, \
{ K09, K0A, K0B }, \
}

#define KEYMAP LAYOUT

#endif
2 changes: 2 additions & 0 deletions keyboards/puck/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Puck
An ortholinear number pad.
69 changes: 69 additions & 0 deletions keyboards/puck/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@


# MCU name
#MCU = at90usb1287
MCU = atmega32u4

# Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the
# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
# This will be an integer division of F_USB below, as it is sourced by
# F_USB after it has run through any CPU prescalers. Note that this value
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU = 16000000

#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8

# Input clock frequency.
# This will define a symbol, F_USB, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
# at the end, this will be done automatically to create a 32-bit value in your
# source code.
#
# If no clock division is performed on the input clock inside the AVR (via the
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)

# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT


# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096

# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to consider using the bootmagic light option here: https://docs.qmk.fm/#/feature_bootmagic?id=bootmagic-lite

MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.

# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend