From e8082b5f9ecc8cc000823091273576ae58c8411f Mon Sep 17 00:00:00 2001 From: Cole Markham Date: Thu, 18 Jan 2018 22:59:00 -0600 Subject: [PATCH] Add support for NovelPad/NumChoc by NovelKeys and Woodkeys --- keyboards/novelpad/config.h | 68 +++++++++++ keyboards/novelpad/keymaps/default/keymap.c | 127 ++++++++++++++++++++ keyboards/novelpad/novelpad.c | 17 +++ keyboards/novelpad/novelpad.h | 36 ++++++ keyboards/novelpad/readme.md | 15 +++ keyboards/novelpad/rules.mk | 56 +++++++++ 6 files changed, 319 insertions(+) create mode 100755 keyboards/novelpad/config.h create mode 100755 keyboards/novelpad/keymaps/default/keymap.c create mode 100755 keyboards/novelpad/novelpad.c create mode 100755 keyboards/novelpad/novelpad.h create mode 100644 keyboards/novelpad/readme.md create mode 100755 keyboards/novelpad/rules.mk diff --git a/keyboards/novelpad/config.h b/keyboards/novelpad/config.h new file mode 100755 index 0000000000..0d6a713433 --- /dev/null +++ b/keyboards/novelpad/config.h @@ -0,0 +1,68 @@ +/* +Copyright 2018 Cole Markham + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6070 +#define DEVICE_VER 0x0001 +#define MANUFACTURER NovelKeys.xyz +#define PRODUCT Novelpad +#define DESCRIPTION 5x4 Hotswap MX numpad + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { C2, C4, C5, C6, C7 } +#define MATRIX_COL_PINS { D7, D6, D5, D4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* 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() ( \ + false \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + +#define BACKLIGHT_LEVELS 10 +#define BACKLIGHT_PIN B7 + +#ifdef RGBLIGHT_ENABLE +#define RGB_DI_PIN D3 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 4 +#endif + +#endif diff --git a/keyboards/novelpad/keymaps/default/keymap.c b/keyboards/novelpad/keymaps/default/keymap.c new file mode 100755 index 0000000000..59cc1adc86 --- /dev/null +++ b/keyboards/novelpad/keymaps/default/keymap.c @@ -0,0 +1,127 @@ +/* +Copyright 2018 Cole Markham + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include QMK_KEYBOARD_H + +enum custom_keycodes { + BL = SAFE_RANGE, + WK_RED, + WK_GREEN, + WK_BLUE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +KEYMAP( + KC_NLCK, KC_PSLS, KC_PAST, KC_ESC, + KC_P7, KC_P8, KC_P9, KC_PMNS, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, KC_TAB, + MO(1), KC_P0, KC_PDOT, KC_ENT), + +KEYMAP( + KC_TRNS, BL, RGB_MODE_SWIRL, RESET, \ + RGB_TOG, RGB_MOD, RGB_MODE_PLAIN, RGB_MODE_SNAKE, \ + RGB_HUI, RGB_SAI, RGB_VAI, RGB_MODE_KNIGHT, \ + RGB_HUD , RGB_SAD, RGB_VAD, RGB_MODE_XMAS, \ + KC_TRNS, WK_RED, WK_GREEN, WK_BLUE \ + ), + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + return MACRO_NONE ; +} + +void matrix_init_user(void) { + + rgblight_setrgb(0,255,0); +} + +void matrix_scan_user(void) { +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case BL: + if (record->event.pressed) { +#ifdef BACKLIGHT_ENABLE + backlight_step(); +#endif + } + return false; + break; + case WK_RED: + if (record->event.pressed) { + rgblight_show_solid_color(0xFF, 0, 0); + } else { + rgblight_show_solid_color(0xFF, 0xFF, 0xFF); + } + return false; + break; + case WK_GREEN: + if (record->event.pressed) { + rgblight_show_solid_color(0, 0xFF, 0); + } else { + rgblight_show_solid_color(0xFF, 0xFF, 0xFF); + } + return false; + break; + case WK_BLUE: + if (record->event.pressed) { + rgblight_show_solid_color(0, 0, 0xFF); + } else { + rgblight_show_solid_color(0xFF, 0xFF, 0xFF); + } + return false; + break; + } + return true; +} + +void led_set_user(uint8_t usb_led) { + + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_COMPOSE)) { + + } else { + + } + + if (usb_led & (1 << USB_LED_KANA)) { + + } else { + + } + +} diff --git a/keyboards/novelpad/novelpad.c b/keyboards/novelpad/novelpad.c new file mode 100755 index 0000000000..719cb89d6a --- /dev/null +++ b/keyboards/novelpad/novelpad.c @@ -0,0 +1,17 @@ +/* +Copyright 2018 Cole Markham + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#include "novelpad.h" diff --git a/keyboards/novelpad/novelpad.h b/keyboards/novelpad/novelpad.h new file mode 100755 index 0000000000..079dc30c53 --- /dev/null +++ b/keyboards/novelpad/novelpad.h @@ -0,0 +1,36 @@ +/* +Copyright 2018 Cole Markham + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#ifndef KB_H +#define KB_H + +#include "quantum.h" + +#define KEYMAP( \ + K00, K01, K02, K03, \ + K10, K11, K12, K13, \ + K20, K21, K22, K23, \ + K30, K31, K32, K33, \ + K40, K41, K42, K43 \ +) { \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, K13 }, \ + { K20, K21, K22, K23 }, \ + { K30, K31, K32, K33 }, \ + { K40, K41, K42, K43 } \ +} + +#endif diff --git a/keyboards/novelpad/readme.md b/keyboards/novelpad/readme.md new file mode 100644 index 0000000000..b743b92049 --- /dev/null +++ b/keyboards/novelpad/readme.md @@ -0,0 +1,15 @@ +# NovelPad/NumChoc + +![NovelPad](https://i.imgur.com/vi4EdSh.jpg?1) + +A 5x4 macropad/numpad, sold by NovelKeys.xyz. There are two versions of the PCB, the NovelPad for MX switches and the NumChoc for Kailh Choc low profile switches. Both utilize the same firmware with no changes required. + +Keyboard Maintainer: [Cole Markham](https://github.com/colemarkham) / [Woodkeys.click](https://woodkeys.click) +Hardware Supported: NovelPad +Hardware Availability: [Novelkeys.xyz](https://novelkeys.xyz) + +Make example for this keyboard (after setting up your build environment): + + make novelpad: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/novelpad/rules.mk b/keyboards/novelpad/rules.mk new file mode 100755 index 0000000000..d90dd6265e --- /dev/null +++ b/keyboards/novelpad/rules.mk @@ -0,0 +1,56 @@ +# MCU name +MCU = atmega32u2 + +# 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 = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = yes # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # In-switch LEDs +AUDIO_ENABLE = no # There is no available timer or pin for audio on the NovelPad +RGBLIGHT_ENABLE = yes # RGB LEDs for underglow, installed and enabled by default for the NovelPad \ No newline at end of file