From c1a6ca46a77d88da40647a54bf1e712da69bc143 Mon Sep 17 00:00:00 2001 From: That-Canadian Date: Mon, 11 Dec 2017 17:57:40 -0800 Subject: [PATCH] The ruler (#2138) * Line ending stuff again * Added initital files and layout for the PCB Ruler keyboard/macro pad thing * Updated Readme * Changed make command to new format --- keyboards/the_ruler/config.h | 167 ++++++++++++++++++ keyboards/the_ruler/keymaps/default/config.h | 8 + keyboards/the_ruler/keymaps/default/keymap.c | 70 ++++++++ keyboards/the_ruler/keymaps/default/readme.md | 1 + keyboards/the_ruler/keymaps/default/rules.mk | 21 +++ keyboards/the_ruler/readme.md | 14 ++ keyboards/the_ruler/rules.mk | 68 +++++++ keyboards/the_ruler/the_ruler.c | 22 +++ keyboards/the_ruler/the_ruler.h | 11 ++ 9 files changed, 382 insertions(+) create mode 100644 keyboards/the_ruler/config.h create mode 100644 keyboards/the_ruler/keymaps/default/config.h create mode 100644 keyboards/the_ruler/keymaps/default/keymap.c create mode 100644 keyboards/the_ruler/keymaps/default/readme.md create mode 100644 keyboards/the_ruler/keymaps/default/rules.mk create mode 100644 keyboards/the_ruler/readme.md create mode 100644 keyboards/the_ruler/rules.mk create mode 100644 keyboards/the_ruler/the_ruler.c create mode 100644 keyboards/the_ruler/the_ruler.h diff --git a/keyboards/the_ruler/config.h b/keyboards/the_ruler/config.h new file mode 100644 index 000000000..16135bbd1 --- /dev/null +++ b/keyboards/the_ruler/config.h @@ -0,0 +1,167 @@ +/* +Copyright 2012 Jun Wako + +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 0x1337 +#define PRODUCT_ID 0x6007 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Maple Computing +#define PRODUCT The PCB Ruler +#define DESCRIPTION A custom keyboard PCB ruler, can also function as a macro pad + +/* key matrix size */ +#define MATRIX_ROWS 1 +#define MATRIX_COLS 6 + +/* + * 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 { C7 } +#define MATRIX_COL_PINS { D6, D7, B4, B5, B6, C6} +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* 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 + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#define RGBLIGHT_TIMER +#define RGB_DI_PIN E6 // The pin your RGB strip is wired to +#define RGBLIGHT_TIMER // Require for fancier stuff (not compatible with audio) +#define RGBLED_NUM 1 // Number of LEDs +#define RGBLIGHT_ANIMATIONS +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +#define RGBLIGHT_VAL_STEP 17 + +#endif diff --git a/keyboards/the_ruler/keymaps/default/config.h b/keyboards/the_ruler/keymaps/default/config.h new file mode 100644 index 000000000..df06a2620 --- /dev/null +++ b/keyboards/the_ruler/keymaps/default/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +// place overrides here + +#endif \ No newline at end of file diff --git a/keyboards/the_ruler/keymaps/default/keymap.c b/keyboards/the_ruler/keymaps/default/keymap.c new file mode 100644 index 000000000..78a785534 --- /dev/null +++ b/keyboards/the_ruler/keymaps/default/keymap.c @@ -0,0 +1,70 @@ +#include "the_ruler.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _DEFAULT 0 +#define _FN_1 1 +#define _FN_2 2 + +enum custom_keycodes { + DEFAULT = SAFE_RANGE, + FN_1, + FN_2 +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +// Defines for task manager and such +#define CALTDEL LCTL(LALT(KC_DEL)) +#define TSKMGR LCTL(LSFT(KC_ESC)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Default Layer + * ,-----------------------------------------------. + * | FN_2 | 2 |TSKMGR |CALTDEL| ESC | FN_1 | + * `-----------------------------------------------' + */ +[_DEFAULT] = KEYMAP( \ + MO(_FN_2), KC_2, TSKMGR, CALTDEL, KC_ESC, MO(_FN_1) +), + +/* FN 1 Layer + * ,-----------------------------------------------. + * |RGB_TOG|RGB_HUD|RGB_HUI|RGB_SAD|RGB_SAI| FN_1 | + * `-----------------------------------------------' + */ +[_FN_1] = KEYMAP( \ + RGB_TOG, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, _______ +), + +/* FN 2 Layer + * ,-----------------------------------------------. + * | FN_2 |RGB_VAD|RGB_VAI|RGB_MOD|TSKMGR | RESET | + * `-----------------------------------------------' + */ +[_FN_2] = KEYMAP( \ + _______, RGB_VAD, RGB_VAI, RGB_MOD, TSKMGR, RESET +) + +}; + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // NONE + } + return true; +} \ No newline at end of file diff --git a/keyboards/the_ruler/keymaps/default/readme.md b/keyboards/the_ruler/keymaps/default/readme.md new file mode 100644 index 000000000..b515c1d48 --- /dev/null +++ b/keyboards/the_ruler/keymaps/default/readme.md @@ -0,0 +1 @@ +# The default keymap for the ruler \ No newline at end of file diff --git a/keyboards/the_ruler/keymaps/default/rules.mk b/keyboards/the_ruler/keymaps/default/rules.mk new file mode 100644 index 000000000..fac9327db --- /dev/null +++ b/keyboards/the_ruler/keymaps/default/rules.mk @@ -0,0 +1,21 @@ +# 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 = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # 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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/the_ruler/readme.md b/keyboards/the_ruler/readme.md new file mode 100644 index 000000000..cc1f817de --- /dev/null +++ b/keyboards/the_ruler/readme.md @@ -0,0 +1,14 @@ +The Ruler PCB +======= + +A custom keyboard PCB ruler, that can also function as a macro pad + +Keyboard Maintainer: Maple Computing +Hardware Supported: PCB Ruler V1 by That-Canadian and Bishop Keyboards +Hardware Availability: https://www.maple-computing.com/products/pcb-ruler-v1-1 + +Make example for this keyboard (after setting up your build environment): + + make the_ruler: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/the_ruler/rules.mk b/keyboards/the_ruler/rules.mk new file mode 100644 index 000000000..30d76a3c9 --- /dev/null +++ b/keyboards/the_ruler/rules.mk @@ -0,0 +1,68 @@ +# 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 yes to no to disable +# +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 = 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 = no # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE = no # MIDI controls +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE = no # Audio output on port C6 +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. diff --git a/keyboards/the_ruler/the_ruler.c b/keyboards/the_ruler/the_ruler.c new file mode 100644 index 000000000..9686379eb --- /dev/null +++ b/keyboards/the_ruler/the_ruler.c @@ -0,0 +1,22 @@ +#include "the_ruler.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); +} \ No newline at end of file diff --git a/keyboards/the_ruler/the_ruler.h b/keyboards/the_ruler/the_ruler.h new file mode 100644 index 000000000..6f38034c3 --- /dev/null +++ b/keyboards/the_ruler/the_ruler.h @@ -0,0 +1,11 @@ +#ifndef THERULER_H +#define THERULER_H + +#include "quantum.h" + +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05 ) { \ + { K00, K01, K02, K03, K04, K05 } \ +} + +#endif