From f6da00b85d32f5bc451f5c89e26845434ae62bed Mon Sep 17 00:00:00 2001 From: Yan-Fa Li Date: Sat, 24 Aug 2019 23:44:20 -0700 Subject: [PATCH] [Keyboard] Maartenwut Wonderland PCB (#6492) * Initial Commit * ID * Use current manu name * Fix define DEBOUNCE Co-Authored-By: fauxpark * Fix NUM Lock LED detection Co-Authored-By: fauxpark * Fix CAPs LED detection Co-Authored-By: fauxpark * Fix Scroll Lock LED detection Co-Authored-By: fauxpark * Use correct convention for setting pins * Move folder to maartenwut - enable velocikey * Fix columns size * Sync with homerowco * Add Keebs keymap * Best practices * Latest keymap changes from homerowco --- keyboards/maartenwut/wonderland/config.h | 55 ++++++++++++++++++ .../wonderland/keymaps/default/keymap.c | 25 ++++++++ .../wonderland/keymaps/keebs/keymap.c | 26 +++++++++ keyboards/maartenwut/wonderland/rules.mk | 58 +++++++++++++++++++ keyboards/maartenwut/wonderland/wonderland.c | 42 ++++++++++++++ keyboards/maartenwut/wonderland/wonderland.h | 22 +++++++ 6 files changed, 228 insertions(+) create mode 100755 keyboards/maartenwut/wonderland/config.h create mode 100755 keyboards/maartenwut/wonderland/keymaps/default/keymap.c create mode 100755 keyboards/maartenwut/wonderland/keymaps/keebs/keymap.c create mode 100755 keyboards/maartenwut/wonderland/rules.mk create mode 100755 keyboards/maartenwut/wonderland/wonderland.c create mode 100755 keyboards/maartenwut/wonderland/wonderland.h diff --git a/keyboards/maartenwut/wonderland/config.h b/keyboards/maartenwut/wonderland/config.h new file mode 100755 index 0000000000..4da601257a --- /dev/null +++ b/keyboards/maartenwut/wonderland/config.h @@ -0,0 +1,55 @@ +/* +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 . +*/ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0xA71C +#define DEVICE_VER 0x0003 +#define MANUFACTURER Maartenwut +#define PRODUCT Wonderland +#define DESCRIPTION "QMK Firmware for the Wonderland" + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +// ROWS: Top to bottom, COLS: Left to right + +#define MATRIX_ROW_PINS {B0,D1,D2,D3,D5} +#define MATRIX_COL_PINS {F0,F1,F4,F5,F6,F7,E6,C7,C6,B6,B5,B4,D7,D6,D4} +#define UNUSED_PINS + + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Backlight configuration + */ +#define RGB_DI_PIN B7 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 + +#define QMK_ESC_OUTPUT F0 // usually COL +#define QMK_ESC_INPUT B0 // usually ROW +#define QMK_LED B1 diff --git a/keyboards/maartenwut/wonderland/keymaps/default/keymap.c b/keyboards/maartenwut/wonderland/keymaps/default/keymap.c new file mode 100755 index 0000000000..fb876443b3 --- /dev/null +++ b/keyboards/maartenwut/wonderland/keymaps/default/keymap.c @@ -0,0 +1,25 @@ +#include QMK_KEYBOARD_H + +enum layers { + _BASE, + _FUNC +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_BASE] = LAYOUT( + KC_ESC, KC_1, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_BSPC, \ + KC_F10, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ + RGB_TOG, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), \ + KC_LCTL, KC_LAPO, KC_BSPC, KC_LGUI, KC_SPC, KC_RAPC, KC_RCTRL \ + ), +[_FUNC] = LAYOUT( + RGB_TOG, VLK_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, RESET, \ + RGB_MOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ + RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, \ + KC_LSFT, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT, XXXXXXX, \ + _______, KC_LALT, _______, _______, _______, KC_RALT, _______ \ + ) +}; diff --git a/keyboards/maartenwut/wonderland/keymaps/keebs/keymap.c b/keyboards/maartenwut/wonderland/keymaps/keebs/keymap.c new file mode 100755 index 0000000000..437370bb73 --- /dev/null +++ b/keyboards/maartenwut/wonderland/keymaps/keebs/keymap.c @@ -0,0 +1,26 @@ +#include QMK_KEYBOARD_H + +enum layers { + _BASE, + _FUNC +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_BASE] = LAYOUT( + KC_ESC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_BSPC, \ + KC_F10, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ + RGB_HUI, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1), \ + KC_LCTL, KC_LAPO, KC_LGUI, RGUI(KC_SPC), KC_SPC, KC_RAPC, KC_RCTRL \ + ), +[_FUNC] = LAYOUT( + RGB_TOG, VLK_TOG, KC_F1,KC_F2,KC_F3,KC_F4,KC_F5,KC_F6,KC_F7,KC_F8,KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, RESET, \ +RGB_MODE_FORWARD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \ +RGB_MODE_REVERSE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, \ + KC_LSFT, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX,KC_LEFT,KC_DOWN,KC_RIGHT,XXXXXXX, \ + KC_LCTL, KC_LALT, KC_BSPC, KC_LGUI, KC_SPC, KC_RALT, KC_RCTRL \ + ) +}; + + diff --git a/keyboards/maartenwut/wonderland/rules.mk b/keyboards/maartenwut/wonderland/rules.mk new file mode 100755 index 0000000000..498076d4ea --- /dev/null +++ b/keyboards/maartenwut/wonderland/rules.mk @@ -0,0 +1,58 @@ +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 = qmk-dfu + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = lite # 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 +NKRO_ENABLE = no # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality (+4870) +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality (+1150) +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +AUTO_SHIFT_ENABLE = no +VELOCIKEY_ENABLE = yes diff --git a/keyboards/maartenwut/wonderland/wonderland.c b/keyboards/maartenwut/wonderland/wonderland.c new file mode 100755 index 0000000000..9f3233e0f1 --- /dev/null +++ b/keyboards/maartenwut/wonderland/wonderland.c @@ -0,0 +1,42 @@ +#include "wonderland.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + matrix_init_user(); + led_init_ports(); +}; + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + matrix_scan_user(); +}; + +void led_init_ports(void) { + // * Set our LED pins as output + setPinOutput(B1); + setPinOutput(B2); + setPinOutput(B3); +} + +void led_set_kb(uint8_t usb_led) { + if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) { + writePinLow(B1); + } else { + writePinHigh(B1); + } + + if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + writePinLow(B2); + } else { + writePinHigh(B2); + } + + if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) { + writePinLow(B3); + } else { + writePinHigh(B3); + } + led_set_user(usb_led); +} diff --git a/keyboards/maartenwut/wonderland/wonderland.h b/keyboards/maartenwut/wonderland/wonderland.h new file mode 100755 index 0000000000..075e3f64b4 --- /dev/null +++ b/keyboards/maartenwut/wonderland/wonderland.h @@ -0,0 +1,22 @@ +#pragma once +#include "quantum.h" + +// readability +#define XXX KC_NO +#define LAYOUT( \ + k10, k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \ + k20, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \ + k30, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2e, \ + k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \ + k41, k43, k45, k46, k48, k4a, k4e \ +) \ +{ \ + {k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e}, \ + {k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e}, \ + {k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, XXX, k2e}, \ + {k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \ + {XXX, k41, XXX, k43, XXX, k45, k46, XXX, k48, XXX, k4a, XXX, XXX, XXX, k4e} \ +} + +void matrix_init_user(void); +void matrix_scan_user(void);