From 09ee7da6deb50a3ff5f808cc47daebe94f5a3f3a Mon Sep 17 00:00:00 2001 From: Maarten Dekkers Date: Sat, 19 Jan 2019 23:29:15 +0100 Subject: [PATCH] Add Plain60 support (#4887) * Add Plain60 support * Delete info.json * Remove definition of KC_TRNS in keymap * Add spaces for proper markdown to readme.md --- keyboards/plain60/config.h | 75 ++++++++++++++++++++++ keyboards/plain60/keymaps/default/keymap.c | 17 +++++ keyboards/plain60/plain60.c | 1 + keyboards/plain60/plain60.h | 29 +++++++++ keyboards/plain60/readme.md | 12 ++++ keyboards/plain60/rules.mk | 66 +++++++++++++++++++ 6 files changed, 200 insertions(+) create mode 100644 keyboards/plain60/config.h create mode 100644 keyboards/plain60/keymaps/default/keymap.c create mode 100644 keyboards/plain60/plain60.c create mode 100644 keyboards/plain60/plain60.h create mode 100644 keyboards/plain60/readme.md create mode 100644 keyboards/plain60/rules.mk diff --git a/keyboards/plain60/config.h b/keyboards/plain60/config.h new file mode 100644 index 000000000..9e838616b --- /dev/null +++ b/keyboards/plain60/config.h @@ -0,0 +1,75 @@ +/* +Copyright 2019 Maarten Dekkers + +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 QMK_KEYBOARD_CONFIG_H + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x4705 +#define PRODUCT_ID 0x0160 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Maartenwut +#define PRODUCT Plain60 +#define DESCRIPTION A plain 60% PCB + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +// ROWS: Top to bottom, COLS: Left to right + +#define MATRIX_ROW_PINS {B4,D7,D6,D4,E6} +#define MATRIX_COL_PINS {D2,D1,D0,D3,D5,B5,F0,B6,C6,C7,F1,F4,F5,F6,F7} + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +#define QMK_ESC_OUTPUT D2 // usually COL +#define QMK_ESC_INPUT B4 // usually ROW + +//VIA +#define DYNAMIC_KEYMAP_LAYER_COUNT 4 + +// EEPROM usage + +// TODO: refactor with new user EEPROM code (coming soon) +#define EEPROM_MAGIC 0x451F +#define EEPROM_MAGIC_ADDR 32 +// Bump this every time we change what we store +// This will automatically reset the EEPROM with defaults +// and avoid loading invalid data from the EEPROM +#define EEPROM_VERSION 0x08 +#define EEPROM_VERSION_ADDR 34 + +// Dynamic keymap starts after EEPROM version +#define DYNAMIC_KEYMAP_EEPROM_ADDR 35 +// Dynamic macro starts after dynamic keymaps (35+(4*10*6*2)) = (35+480) +#define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 635 +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 389 // 1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 \ No newline at end of file diff --git a/keyboards/plain60/keymaps/default/keymap.c b/keyboards/plain60/keymaps/default/keymap.c new file mode 100644 index 000000000..7e8cfff35 --- /dev/null +++ b/keyboards/plain60/keymaps/default/keymap.c @@ -0,0 +1,17 @@ +#include QMK_KEYBOARD_H + +// 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 _MA 0 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_MA] = LAYOUT( + KC_ESC, 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_BSLS, KC_BSPC, \ + 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, \ + 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_BSLS, KC_ENT, \ + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTRL) +}; diff --git a/keyboards/plain60/plain60.c b/keyboards/plain60/plain60.c new file mode 100644 index 000000000..d81606410 --- /dev/null +++ b/keyboards/plain60/plain60.c @@ -0,0 +1 @@ +#include "plain60.h" diff --git a/keyboards/plain60/plain60.h b/keyboards/plain60/plain60.h new file mode 100644 index 000000000..01a6216a7 --- /dev/null +++ b/keyboards/plain60/plain60.h @@ -0,0 +1,29 @@ +#pragma once + +#ifndef PLAIN60_H +#define PLAIN60_H + +#include "quantum.h" + +// readability +#define XXX KC_NO + +#define LAYOUT( \ + 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, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, \ + k40, k41, k42, k46, k4a, k4b, k4c, k4d \ +) \ +{ \ + {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, XXX}, \ + {k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, XXX}, \ + {k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, XXX}, \ + {k40, k41, k42, XXX, XXX, XXX, k46, XXX, XXX, XXX, k4a, k4b, k4c, k4d, XXX} \ +} + +void matrix_init_user(void); +void matrix_scan_user(void); + +#endif diff --git a/keyboards/plain60/readme.md b/keyboards/plain60/readme.md new file mode 100644 index 000000000..58be67ac0 --- /dev/null +++ b/keyboards/plain60/readme.md @@ -0,0 +1,12 @@ +Plain60-C and Plain60-B +====== + +A plain 60% PCB with USB-C. + +Keyboard Maintainer: Maartenwut +Hardware Supported: Plain60-C and Plain60-B +Hardware Availability: https://github.com/Maartenwut/plain60-c + +Make example for this keyboard (after setting up your build environment): + + make plain60:default \ No newline at end of file diff --git a/keyboards/plain60/rules.mk b/keyboards/plain60/rules.mk new file mode 100644 index 000000000..a1a0e9ca1 --- /dev/null +++ b/keyboards/plain60/rules.mk @@ -0,0 +1,66 @@ +SRC += keyboards/wilba_tech/wt_main.c +# 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* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +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 = no # Console for debug(+400) +COMMAND_ENABLE = no # 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 = no # 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 +RAW_ENABLE = yes +DYNAMIC_KEYMAP_ENABLE = yes