diff --git a/keyboards/puck/config.h b/keyboards/puck/config.h new file mode 100644 index 000000000000..b2cb1b23e362 --- /dev/null +++ b/keyboards/puck/config.h @@ -0,0 +1,31 @@ +#pragma once + +#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 diff --git a/keyboards/puck/keymaps/default/keymap.c b/keyboards/puck/keymaps/default/keymap.c new file mode 100644 index 000000000000..6ba70a88bb59 --- /dev/null +++ b/keyboards/puck/keymaps/default/keymap.c @@ -0,0 +1,64 @@ +#include QMK_KEYBOARD_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; +} diff --git a/keyboards/puck/puck.c b/keyboards/puck/puck.c new file mode 100644 index 000000000000..0e26b9c3cd83 --- /dev/null +++ b/keyboards/puck/puck.c @@ -0,0 +1 @@ +#include "puck.h" diff --git a/keyboards/puck/puck.h b/keyboards/puck/puck.h new file mode 100644 index 000000000000..4467614fdb80 --- /dev/null +++ b/keyboards/puck/puck.h @@ -0,0 +1,15 @@ +#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 }, \ +} + +#endif diff --git a/keyboards/puck/readme.md b/keyboards/puck/readme.md new file mode 100644 index 000000000000..45e438c4719e --- /dev/null +++ b/keyboards/puck/readme.md @@ -0,0 +1,11 @@ +A 4 x 3 macropad. + +Keyboard Maintainer: [john-pettigrew](https://github.com/john-pettigrew) +Hardware Supported: Puck PCB. +Hardware Availability: [OkKeebs.com](https://okkeebs.com/products/puck-pcb) + +Make example for this keyboard (after setting up your build environment): + + make puck: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/puck/rules.mk b/keyboards/puck/rules.mk new file mode 100644 index 000000000000..48144534d47f --- /dev/null +++ b/keyboards/puck/rules.mk @@ -0,0 +1,68 @@ + + +# MCU name +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 +BOOTLOADER = halfkay + +# 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) +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