From b6fbcd9d6210524fe73921db12209e8703c74d2d Mon Sep 17 00:00:00 2001 From: Nicholas Shaff Date: Sun, 3 Feb 2019 21:40:42 -0600 Subject: [PATCH] New Keyboard: Sentraq Number Pad RGB DIY Kit (#5047) * Added QMK Config for Sentraq Number Pad keyboard. * Sentraq Number Pad documentation cleanup. * mend * Added json for configurator. * Small documentation tweaks. * Updated the layouts to use the default layouts that match. * Uncommended user level functions in keymap, left custom keycode/macro code commented but documented why. * Switched to #pragma once from #ifndef structure in header file. * Moved Sentraq number pad to sentraq creator directory. * Renamed sentraq_number_pad to number_pad now that it's nested in the sentraq directory. * Updated references inside the files for the keyboard rename and nesting. --- keyboards/sentraq/number_pad/config.h | 83 ++++++++++++++ keyboards/sentraq/number_pad/info.json | 29 +++++ .../number_pad/keymaps/default/keymap.c | 105 ++++++++++++++++++ .../number_pad/keymaps/default/readme.md | 1 + keyboards/sentraq/number_pad/number_pad.c | 43 +++++++ keyboards/sentraq/number_pad/number_pad.h | 56 ++++++++++ keyboards/sentraq/number_pad/readme.md | 13 +++ keyboards/sentraq/number_pad/rules.mk | 80 +++++++++++++ 8 files changed, 410 insertions(+) create mode 100644 keyboards/sentraq/number_pad/config.h create mode 100644 keyboards/sentraq/number_pad/info.json create mode 100644 keyboards/sentraq/number_pad/keymaps/default/keymap.c create mode 100644 keyboards/sentraq/number_pad/keymaps/default/readme.md create mode 100644 keyboards/sentraq/number_pad/number_pad.c create mode 100644 keyboards/sentraq/number_pad/number_pad.h create mode 100644 keyboards/sentraq/number_pad/readme.md create mode 100644 keyboards/sentraq/number_pad/rules.mk diff --git a/keyboards/sentraq/number_pad/config.h b/keyboards/sentraq/number_pad/config.h new file mode 100644 index 00000000000..d52670c7dac --- /dev/null +++ b/keyboards/sentraq/number_pad/config.h @@ -0,0 +1,83 @@ +/* +Copyright 2019 QMK Community + +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x0000 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Sentraq +#define PRODUCT Sentraq Number Pad +#define DESCRIPTION RBG backlit number pad kit + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 4 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { F5, F0, B5, D6, D4 } +#define MATRIX_COL_PINS { C7, D5, D1, D0 } +#define UNUSED_PINS + +/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */ +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_PIN B7 +// #define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 3 + +#define RGB_DI_PIN B0 +#ifdef RGB_DI_PIN + #define RGBLED_NUM 13 + #define RGBLIGHT_HUE_STEP 8 + #define RGBLIGHT_SAT_STEP 8 + #define RGBLIGHT_VAL_STEP 8 + #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */ + #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */ +/*== all animations enable ==*/ + #define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ + #define RGBLIGHT_EFFECT_BREATHING + #define RGBLIGHT_EFFECT_RAINBOW_MOOD + #define RGBLIGHT_EFFECT_RAINBOW_SWIRL + #define RGBLIGHT_EFFECT_SNAKE + #define RGBLIGHT_EFFECT_KNIGHT + #define RGBLIGHT_EFFECT_CHRISTMAS + #define RGBLIGHT_EFFECT_STATIC_GRADIENT + #define RGBLIGHT_EFFECT_RGB_TEST + #define RGBLIGHT_EFFECT_ALTERNATING +#endif + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) diff --git a/keyboards/sentraq/number_pad/info.json b/keyboards/sentraq/number_pad/info.json new file mode 100644 index 00000000000..1c6e3f53ca8 --- /dev/null +++ b/keyboards/sentraq/number_pad/info.json @@ -0,0 +1,29 @@ +{ + "keyboard_name": "Sentraq Number Pad", + "maintainer": "qmk", + "url": "https://sentraq.com/collections/kits/products/number-pad-rgb-kit", + "width": 4, + "height": 5, + "layouts": { + "LAYOUT_numpad_5x4": { + "keycount": 17, + "layout": [ + {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, + {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1, "h":2}, + {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, + {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3, "h":2}, + {"x":0, "y":4, "w":2}, {"x":2, "y":4} + ] + }, + "LAYOUT_ortho_5x4": { + "keycount": 20, + "layout": [ + {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, + {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, + {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, + {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, + {"x":0, "y":4}, {"x":1, "y":4}, {"x":2, "y":4}, {"x":3, "y":4} + ] + } + } +} diff --git a/keyboards/sentraq/number_pad/keymaps/default/keymap.c b/keyboards/sentraq/number_pad/keymaps/default/keymap.c new file mode 100644 index 00000000000..90c806a917b --- /dev/null +++ b/keyboards/sentraq/number_pad/keymaps/default/keymap.c @@ -0,0 +1,105 @@ +/* Copyright 2019 QMK Community + * + * 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 + +#define _BL 0 +#define _FN 1 + +// Defines the keycodes used by our macros in process_record_user. +// Disabled as it isn't used in this keymap, but available for modification. +// enum custom_keycodes { +// QMKBEST = SAFE_RANGE, +// QMKURL +// }; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BL] = LAYOUT_numpad_5x4( + /* Base Layer: Number Pad + * ,---------------. + * |FN | / | * | - | + * |---+---+---|---| + * | 7 | 8 | 9 | | + * |---+---+---| + | + * | 4 | 5 | 6 | | + * |---+---+---|---| + * | 1 | 2 | 3 | | + * |---+---+---|Ent| + * | 0 | . | | + * `---------------' + */ + MO(_FN), KC_PSLS, KC_PAST, KC_PMNS, \ + KC_P7, KC_P8, KC_P9, \ + KC_P4, KC_P5, KC_P6, KC_PPLS, \ + KC_P1, KC_P2, KC_P3, \ + KC_P0, KC_PDOT, KC_PENT + ), + /* Function Layer: RGB Controls and Numlock + * ,---------------. + * |FN |TOG|M+ |M- | Mode + * |---+---+---|---| + * | |H- |H+ | | Hue + * |---+---+---| | + * | |S- |S+ | | Saturation + * |---+---+---|---| + * | |B- |B+ |NUM| Brightness + * |---+---+---| | + * | | |LCK| + * `---------------' + */ + [_FN] = LAYOUT_numpad_5x4( + KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, \ + KC_NO, RGB_HUD, RGB_HUI, \ + KC_NO, RGB_SAD, RGB_SAI, KC_NO, \ + KC_NO, RGB_VAD, RGB_VAI, \ + KC_NO, KC_NO, KC_NLCK + ), +}; + +// Handles macros for keycodes defined above. +// Disabled as it isn't used in this keymap, but available for modification. +// bool process_record_user(uint16_t keycode, keyrecord_t *record) { +// switch (keycode) { +// case QMKBEST: +// if (record->event.pressed) { +// // when keycode QMKBEST is pressed +// SEND_STRING("QMK is the best thing ever!"); +// } else { +// // when keycode QMKBEST is released +// } +// break; +// case QMKURL: +// if (record->event.pressed) { +// // when keycode QMKURL is pressed +// SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER)); +// } else { +// // when keycode QMKURL is released +// } +// break; +// } +// return true; +// } + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/sentraq/number_pad/keymaps/default/readme.md b/keyboards/sentraq/number_pad/keymaps/default/readme.md new file mode 100644 index 00000000000..a2c0e756762 --- /dev/null +++ b/keyboards/sentraq/number_pad/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for Sentraq Number Pad RGB DIY Kit diff --git a/keyboards/sentraq/number_pad/number_pad.c b/keyboards/sentraq/number_pad/number_pad.c new file mode 100644 index 00000000000..8c39efac58c --- /dev/null +++ b/keyboards/sentraq/number_pad/number_pad.c @@ -0,0 +1,43 @@ +/* Copyright 2019 QMK Community + * + * 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 "number_pad.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} diff --git a/keyboards/sentraq/number_pad/number_pad.h b/keyboards/sentraq/number_pad/number_pad.h new file mode 100644 index 00000000000..05bcd527cd0 --- /dev/null +++ b/keyboards/sentraq/number_pad/number_pad.h @@ -0,0 +1,56 @@ +/* Copyright 2019 QMK Community + * + * 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 . + */ +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT_numpad_5x4( \ + K00, K01, K02, K03, \ + K10, K11, K12, \ + K20, K21, K22, K23, \ + K30, K31, K32, \ + K40, K42, K43 \ +) \ +{ \ + { K00, K01, K02, K03 }, \ + { K10, K11, K12, KC_NO }, \ + { K20, K21, K22, K23 }, \ + { K30, K31, K32, KC_NO }, \ + { K40, KC_NO, K42, K43 } \ +} + +#define LAYOUT_ortho_5x4( \ + 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 } \ +} diff --git a/keyboards/sentraq/number_pad/readme.md b/keyboards/sentraq/number_pad/readme.md new file mode 100644 index 00000000000..ce9bfe4357c --- /dev/null +++ b/keyboards/sentraq/number_pad/readme.md @@ -0,0 +1,13 @@ +# Sentraq Number Pad RGB DIY Kit + +Sentraq Number Pad RGB DIY Kit. + +Keyboard Maintainer: QMK Community\ +Hardware Supported: Sentraq Number Pad PCB\ +Hardware Availability: [Sentraq](https://sentraq.com/collections/kits/products/number-pad-rgb-kit) + +Make example for this keyboard (after setting up your build environment): + + make sentraq/number_pad:default:dfu + +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/sentraq/number_pad/rules.mk b/keyboards/sentraq/number_pad/rules.mk new file mode 100644 index 00000000000..8678b7f886e --- /dev/null +++ b/keyboards/sentraq/number_pad/rules.mk @@ -0,0 +1,80 @@ +# 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 + + +# Bootloader selection +# Teensy halfkay +# Pro Micro caterina +# Atmel DFU atmel-dfu +# LUFA DFU lufa-dfu +# QMK DFU qmk-dfu +# atmega32a bootloadHID +BOOTLOADER = atmel-dfu + + +# If you don't know the bootloader type, then you can specify the +# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# change yes to no to disable +# +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 = yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE = no # USB Nkey Rollover +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality on B7 by default +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config) +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches +HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)