From 2558466d78a2c2436dedeff593491bdb20780cfc Mon Sep 17 00:00:00 2001 From: pngu <34752364+itspngu@users.noreply.github.com> Date: Tue, 11 Jun 2019 23:58:29 +0200 Subject: [PATCH] [Keyboard] Added idb 60 keyboard (#5994) * Added idb 60 keyboard * fixed info.json * implemented revievers' suggested changes * fixed an error * implemented revievers' suggestions * further cleanup * implemented suggested changes * fixed errors --- keyboards/idb_60/config.h | 170 ++++++++++++++++++++++ keyboards/idb_60/idb_60.c | 23 +++ keyboards/idb_60/idb_60.h | 38 +++++ keyboards/idb_60/info.json | 76 ++++++++++ keyboards/idb_60/keymaps/default/keymap.c | 32 ++++ keyboards/idb_60/keymaps/pngu/keymap.c | 39 +++++ keyboards/idb_60/readme.md | 17 +++ keyboards/idb_60/rules.mk | 65 +++++++++ 8 files changed, 460 insertions(+) create mode 100644 keyboards/idb_60/config.h create mode 100644 keyboards/idb_60/idb_60.c create mode 100644 keyboards/idb_60/idb_60.h create mode 100644 keyboards/idb_60/info.json create mode 100644 keyboards/idb_60/keymaps/default/keymap.c create mode 100644 keyboards/idb_60/keymaps/pngu/keymap.c create mode 100644 keyboards/idb_60/readme.md create mode 100644 keyboards/idb_60/rules.mk diff --git a/keyboards/idb_60/config.h b/keyboards/idb_60/config.h new file mode 100644 index 000000000..b85eb14af --- /dev/null +++ b/keyboards/idb_60/config.h @@ -0,0 +1,170 @@ +/* +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 0x6060 // 24672 +#define PRODUCT_ID 0x6060 // 24672 +#define DEVICE_VER 0x0001 +#define MANUFACTURER pngu +#define PRODUCT idb 60 +#define DESCRIPTION QMK keyboard firmware for idb 60 + +/* key matrix size */ +#define MATRIX_ROWS 10 +#define MATRIX_COLS 8 + +/* + * 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 { C2, D0, D1, D2, D3, D4, D5, D6, B0, B1 } +#define MATRIX_COL_PINS { B2, B3, B4, C6, B6, B7, C7, B5 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 0 + +/* 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. + * + */ + +/* 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 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 675 // **** CHANGE THIS BASED ON MATRIX_ROWS & MATRIX_COLS **** +#define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 349 // **** CHANGE THIS BASED ON 1024-DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR **** +#define DYNAMIC_KEYMAP_MACRO_COUNT 16 diff --git a/keyboards/idb_60/idb_60.c b/keyboards/idb_60/idb_60.c new file mode 100644 index 000000000..d280f644b --- /dev/null +++ b/keyboards/idb_60/idb_60.c @@ -0,0 +1,23 @@ +#include "idb_60.h" + +extern inline void _idb_60_caps_led_on(void); +extern inline void _idb_60_esc_led_on(void); + +extern inline void _idb_60_caps_led_off(void); +extern inline void _idb_60_esc_led_off(void); + +void keyboard_pre_init_kb(void) { + setPinOutput(C4); + setPinOutput(C5); +} + +void led_set_kb(uint8_t usb_led) { + + if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) { + _idb_60_caps_led_on(); + } else { + _idb_60_caps_led_off(); + } + + led_set_user(usb_led); +} diff --git a/keyboards/idb_60/idb_60.h b/keyboards/idb_60/idb_60.h new file mode 100644 index 000000000..e9045f664 --- /dev/null +++ b/keyboards/idb_60/idb_60.h @@ -0,0 +1,38 @@ +#pragma once + +#include "quantum.h" + +inline void _idb_60_caps_led_on(void) { + writePinLow(C5); +} + +inline void _idb_60_esc_led_on(void) { + writePinLow(C4); +} + +inline void _idb_60_caps_led_off(void) { + writePinLow(C5); +} + +inline void _idb_60_esc_led_off(void) { + writePinLow(C4); +} + +#define LAYOUT( \ + K00, K10, K01, K11, K02, K12, K03, K13, K04, K14, K05, K15, K06, K16, K07,\ + K20, K30, K21, K31, K22, K32, K23, K33, K24, K34, K25, K35, K26, K36,\ + K40, K50, K41, K51, K42, K52, K43, K53, K44, K54, K45, K55, K56,\ + K60, K70, K61, K71, K62, K72, K63, K73, K64, K74, K65, K75, K66, K76,\ + K80, K90, K81, K93, K95, K86, K96\ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07 }, \ + { K10, K11, K12, K13, K14, K15, K16 }, \ + { K20, K21, K22, K23, K24, K25, K26 }, \ + { K30, K31, K32, K33, K34, K35, K36 }, \ + { K40, K41, K42, K43, K44, K45, KC_NO }, \ + { K50, K51, K52, K53, K54, K55, K56 }, \ + { K60, K61, K62, K63, K64, K65, K66 }, \ + { K70, K71, K72, K73, K74, K75, K76 }, \ + { K80, K81, KC_NO, KC_NO, KC_NO, KC_NO, K86 }, \ + { K90, KC_NO, KC_NO, K93, KC_NO, K95, K96 } \ +} diff --git a/keyboards/idb_60/info.json b/keyboards/idb_60/info.json new file mode 100644 index 000000000..9bbe580bf --- /dev/null +++ b/keyboards/idb_60/info.json @@ -0,0 +1,76 @@ +{ + "keyboard_name": "idb_60", + "url": "https://idb-keyboards.xyz/60", + "maintainer": "pngu", + "width": 15, + "height": 5, + "layouts": { + "LAYOUT": { + "layout": [ + {"label":"Esc","x":0,"y":0}, + {"label":"!\n1","x":1,"y":0}, + {"label":"@\n2","x":2,"y":0}, + {"label":"#\n3","x":3,"y":0}, + {"label":"$\n4","x":4,"y":0}, + {"label":"%\n5","x":5,"y":0}, + {"label":"^\n6","x":6,"y":0}, + {"label":"&\n7","x":7,"y":0}, + {"label":"*\n8","x":8,"y":0}, + {"label":"(\n9","x":9,"y":0}, + {"label":")\n0","x":10,"y":0}, + {"label":"_\n-","x":11,"y":0}, + {"label":"+\n=","x":12,"y":0}, + {"label":"BS","x":13,"y":0}, + {"label":"~\n`","x":14,"y":0}, + {"label":"Tab","x":0,"y":1,"w":1.5}, + {"label":"Q","x":1.5,"y":1}, + {"label":"W","x":2.5,"y":1}, + {"label":"E","x":3.5,"y":1}, + {"label":"R","x":4.5,"y":1}, + {"label":"T","x":5.5,"y":1}, + {"label":"Y","x":6.5,"y":1}, + {"label":"U","x":7.5,"y":1}, + {"label":"I","x":8.5,"y":1}, + {"label":"O","x":9.5,"y":1}, + {"label":"P","x":10.5,"y":1}, + {"label":"{\n[","x":11.5,"y":1}, + {"label":"}\n]","x":12.5,"y":1}, + {"label":"|\n\\","x":13.5,"y":1,"w":1.5}, + {"label":"Caps Lock","x":0,"y":2,"w":1.75}, + {"label":"A","x":1.75,"y":2}, + {"label":"S","x":2.75,"y":2}, + {"label":"D","x":3.75,"y":2}, + {"label":"F","x":4.75,"y":2}, + {"label":"G","x":5.75,"y":2}, + {"label":"H","x":6.75,"y":2}, + {"label":"J","x":7.75,"y":2}, + {"label":"K","x":8.75,"y":2}, + {"label":"L","x":9.75,"y":2}, + {"label":":\n;","x":10.75,"y":2}, + {"label":"\"\n'","x":11.75,"y":2}, + {"label":"Enter","x":12.75,"y":2,"w":2.25}, + {"label":"Shift","x":0,"y":3,"w":1.25}, + {"label":">\n<\n\n|","x":1.25,"y":3}, + {"label":"Z","x":2.25,"y":3}, + {"label":"X","x":3.25,"y":3}, + {"label":"C","x":4.25,"y":3}, + {"label":"V","x":5.25,"y":3}, + {"label":"B","x":6.25,"y":3}, + {"label":"N","x":7.25,"y":3}, + {"label":"M","x":8.25,"y":3}, + {"label":"<\n,","x":9.25,"y":3}, + {"label":">\n.","x":10.25,"y":3}, + {"label":"?\n/","x":11.25,"y":3}, + {"label":"Shift","x":12.25,"y":3,"w":1.75}, + {"label":"Fn","x":14,"y":3}, + {"label":"Ctrl","x":0,"y":4,"w":1.5}, + {"label":"Win","x":1.5,"y":4}, + {"label":"Alt","x":2.5,"y":4,"w":1.5}, + {"label":"","x":4,"y":4,"w":7}, + {"label":"Alt","x":11,"y":4,"w":1.5}, + {"label":"Win","x":12.5,"y":4}, + {"label":"Ctrl","x":13.5,"y":4,"w":1.5} + ] + } + } +} diff --git a/keyboards/idb_60/keymaps/default/keymap.c b/keyboards/idb_60/keymaps/default/keymap.c new file mode 100644 index 000000000..48c998774 --- /dev/null +++ b/keyboards/idb_60/keymaps/default/keymap.c @@ -0,0 +1,32 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT( + KC_GESC, 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_BSPC, KC_NO, + 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_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, MO(1), + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_MENU, KC_RCTL + ), + [1] = LAYOUT( + RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ) + +}; + +// Layer LED indicators + +layer_state_t layer_state_set_user(layer_state_t state) { + if (layer_state_cmp(state, 1)) { + _idb_60_esc_led_on(); + } else { + _idb_60_esc_led_off(); + } + + return state; +} \ No newline at end of file diff --git a/keyboards/idb_60/keymaps/pngu/keymap.c b/keyboards/idb_60/keymaps/pngu/keymap.c new file mode 100644 index 000000000..de336e5fa --- /dev/null +++ b/keyboards/idb_60/keymaps/pngu/keymap.c @@ -0,0 +1,39 @@ +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [0] = LAYOUT( + KC_GESC, 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_BSPC, KC_NO, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + LT(2, 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_NUBS, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_MENU, MO(1) + ), + [1] = LAYOUT( + RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ), + [2] = LAYOUT( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_UP, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______ + ) + +}; + +// Layer LED indicators + +layer_state_t layer_state_set_user(layer_state_t state) { + if (layer_state_cmp(state, 1)) { + _idb_60_esc_led_on(); + } else { + _idb_60_esc_led_off(); + } + + return state; +} \ No newline at end of file diff --git a/keyboards/idb_60/readme.md b/keyboards/idb_60/readme.md new file mode 100644 index 000000000..e6ed6822b --- /dev/null +++ b/keyboards/idb_60/readme.md @@ -0,0 +1,17 @@ +# idb 60 PCB + +Firmware for the idb 60 PCB + +Keyboard Maintainer: [/u/omgitspngu](https://github.com/itspngu) +Hardware Supported: idb 60 PCB +Hardware Availability: [/u/omgitspngu](https://www.reddit.com/user/omgitspngu/) + +Make example for this keyboard (after setting up your build environment): + + make idb_60:default + +Or to make and flash: + + make idb_60: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/idb_60/rules.mk b/keyboards/idb_60/rules.mk new file mode 100644 index 000000000..b5c941347 --- /dev/null +++ b/keyboards/idb_60/rules.mk @@ -0,0 +1,65 @@ +# 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* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +BOOTLOADER = atmel-dfu + + +# Build Options +# comment out to disable the options. +# +# BOOTMAGIC_ENABLE = yes # 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 +# KEYBOARD_LOCK_ENABLE = yes # Allow locking of keyboard via magic key +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +# MIDI_ENABLE = YES # MIDI controls +# UNICODE_ENABLE = YES # Unicode +# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID \ No newline at end of file