From 9a91b42e922ed152cb548c529233cf7f2b6d5183 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Wed, 20 Dec 2017 10:58:28 -0500 Subject: [PATCH] Add Chocopad keyboard --- keyboards/chocopad/README.md | 14 +++++ keyboards/chocopad/chocopad.c | 1 + keyboards/chocopad/chocopad.h | 32 +++++++++++ keyboards/chocopad/config.h | 59 ++++++++++++++++++++ keyboards/chocopad/keymaps/default/config.h | 6 ++ keyboards/chocopad/keymaps/default/keymap.c | 61 +++++++++++++++++++++ keyboards/chocopad/keymaps/default/rules.mk | 5 ++ keyboards/chocopad/rules.mk | 56 +++++++++++++++++++ 8 files changed, 234 insertions(+) create mode 100644 keyboards/chocopad/README.md create mode 100644 keyboards/chocopad/chocopad.c create mode 100644 keyboards/chocopad/chocopad.h create mode 100644 keyboards/chocopad/config.h create mode 100644 keyboards/chocopad/keymaps/default/config.h create mode 100644 keyboards/chocopad/keymaps/default/keymap.c create mode 100644 keyboards/chocopad/keymaps/default/rules.mk create mode 100644 keyboards/chocopad/rules.mk diff --git a/keyboards/chocopad/README.md b/keyboards/chocopad/README.md new file mode 100644 index 0000000000..ad0f6b3560 --- /dev/null +++ b/keyboards/chocopad/README.md @@ -0,0 +1,14 @@ +Chocopad +======== + +A 4x4 macropad keyboard using Kailh PG1350 Lower Profile Choc switches. + +Keyboard Maintainer: Keebio +Hardware Supported: Chocopad PCB, Arduino Pro Micro +Hardware Availability: [Keebio](https://keeb.io) + +Make example for this keyboard (after setting up your build environment): + + make chocopad:default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/chocopad/chocopad.c b/keyboards/chocopad/chocopad.c new file mode 100644 index 0000000000..f54753af50 --- /dev/null +++ b/keyboards/chocopad/chocopad.c @@ -0,0 +1 @@ +#include "chocopad.h" diff --git a/keyboards/chocopad/chocopad.h b/keyboards/chocopad/chocopad.h new file mode 100644 index 0000000000..329e2d56f6 --- /dev/null +++ b/keyboards/chocopad/chocopad.h @@ -0,0 +1,32 @@ +#ifndef CHOCOPAD_H +#define CHOCOPAD_H + +#include "quantum.h" + +#define KEYMAP( \ + A1, A2, A3, A4, \ + B1, B2, B3, B4, \ + C1, C2, C3, C4, \ + D1, D2, D3, D4 \ +) { \ + { A1, A2, A3, A4 }, \ + { B1, B2, B3, B4 }, \ + { C1, C2, C3, C4 }, \ + { D1, D2, D3, D4 } \ +} + +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + A1, A2, A3, A4, \ + B1, B2, B3, B4, \ + C1, C2, C3, C4, \ + D1, D2, D3, D4 \ +) \ + KEYMAP( \ + KC_##A1, KC_##A2, KC_##A3, KC_##A4, \ + KC_##B1, KC_##B2, KC_##B3, KC_##B4, \ + KC_##C1, KC_##C2, KC_##C3, KC_##C4, \ + KC_##D1, KC_##D2, KC_##D3, KC_##D4 \ + ) + +#endif diff --git a/keyboards/chocopad/config.h b/keyboards/chocopad/config.h new file mode 100644 index 0000000000..bf861ccda4 --- /dev/null +++ b/keyboards/chocopad/config.h @@ -0,0 +1,59 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1144 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT Chocopad +#define DESCRIPTION 4x4 macropad using Kailh Choc low-profile switches + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 4 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D7, E6, B3, B2 } +#define MATRIX_COL_PINS { D2, D4, F6, F5 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B5 +#define BACKLIGHT_LEVELS 6 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 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 */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + + +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 4 +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +#endif \ No newline at end of file diff --git a/keyboards/chocopad/keymaps/default/config.h b/keyboards/chocopad/keymaps/default/config.h new file mode 100644 index 0000000000..7fa3bf328e --- /dev/null +++ b/keyboards/chocopad/keymaps/default/config.h @@ -0,0 +1,6 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#endif diff --git a/keyboards/chocopad/keymaps/default/keymap.c b/keyboards/chocopad/keymaps/default/keymap.c new file mode 100644 index 0000000000..c4536a1b41 --- /dev/null +++ b/keyboards/chocopad/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +#include "chocopad.h" + +#define _BASE 0 +#define _FN1 1 +#define _FN2 2 + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_X1 MO(_FN1) +#define KC_X2 MO(_FN2) +#define KC_RST RESET +#define KC_BSTP BL_STEP +#define KC_RTOG RGB_TOG +#define KC_RMOD RGB_MOD +#define KC_RHUI RGB_HUI +#define KC_RHUD RGB_HUD +#define KC_RSAI RGB_SAI +#define KC_RSAD RGB_SAD +#define KC_RVAI RGB_VAI +#define KC_RVAD RGB_VAD + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_BASE] = KC_KEYMAP( + //,----+----+----+----. + PGUP,HOME, UP ,END , + //|----+----+----+----| + PGDN,LEFT,DOWN,RGHT, + //|----+----+----+----| + X2 ,VOLU,MPLY,MPRV, + //|----+----+----+----| + X1 ,VOLD,MUTE,MNXT + //`----+----+----+----' + ), + + [_FN1] = KC_KEYMAP( + //,----+----+----+----. + ESC , P7 , P8 , P9 , + //|----+----+----+----| + TAB , P4 , P5 , P6 , + //|----+----+----+----| + ENT , P1 , P2 , P3 , + //|----+----+----+----| + , P0 , P0 ,DOT + //`----+----+----+----' + ), + + [_FN2] = KC_KEYMAP( + //,----+----+----+----. + RTOG,RHUI,RSAI,RVAI, + //|----+----+----+----| + RMOD,RHUD,RSAD,RVAD, + //|----+----+----+----| + , , ,RST , + //|----+----+----+----| + BSTP, , , + //`----+----+----+----' + ) + +}; diff --git a/keyboards/chocopad/keymaps/default/rules.mk b/keyboards/chocopad/keymaps/default/rules.mk new file mode 100644 index 0000000000..1e57612788 --- /dev/null +++ b/keyboards/chocopad/keymaps/default/rules.mk @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/chocopad/rules.mk b/keyboards/chocopad/rules.mk new file mode 100644 index 0000000000..cd9222a154 --- /dev/null +++ b/keyboards/chocopad/rules.mk @@ -0,0 +1,56 @@ +# 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* +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # 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 +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = yes