diff options
Diffstat (limited to 'keyboard')
-rw-r--r-- | keyboard/alps64/Makefile | 9 | ||||
-rw-r--r-- | keyboard/alps64/alps64.c (renamed from keyboard/alps64/keymap_common.c) | 31 | ||||
-rw-r--r-- | keyboard/alps64/alps64.h (renamed from keyboard/alps64/keymap_common.h) | 21 | ||||
-rw-r--r-- | keyboard/alps64/config.h | 5 | ||||
-rw-r--r-- | keyboard/alps64/keymaps/default.c | 4 | ||||
-rw-r--r-- | keyboard/alps64/keymaps/hasu.c | 4 | ||||
-rw-r--r-- | keyboard/alps64/matrix.c | 5 | ||||
-rw-r--r-- | keyboard/gh60/Makefile | 10 | ||||
-rw-r--r-- | keyboard/gh60/keymap_common.c | 30 | ||||
-rw-r--r-- | keyboard/hhkb/Makefile | 2 | ||||
-rw-r--r-- | keyboard/hhkb/matrix.c | 8 | ||||
-rw-r--r-- | keyboard/jd45/Makefile | 2 | ||||
-rw-r--r-- | keyboard/kc60_v2/Makefile | 158 | ||||
-rw-r--r-- | keyboard/kc60_v2/README.md | 24 | ||||
-rw-r--r-- | keyboard/kc60_v2/config.h | 161 | ||||
-rw-r--r-- | keyboard/kc60_v2/kc60.c | 111 | ||||
-rw-r--r-- | keyboard/kc60_v2/kc60.h | 36 | ||||
-rw-r--r-- | keyboard/kc60_v2/keymaps/default.c | 24 | ||||
-rw-r--r-- | keyboard/planck/.gitignore | 1 |
19 files changed, 569 insertions, 77 deletions
diff --git a/keyboard/alps64/Makefile b/keyboard/alps64/Makefile index 7634c4280e..bd6ecb6b91 100644 --- a/keyboard/alps64/Makefile +++ b/keyboard/alps64/Makefile @@ -42,14 +42,14 @@ TARGET = alps64 # Directory common source filess exist +TOP_DIR = ../.. TMK_DIR = ../../tmk_core # Directory keyboard dependent files exist TARGET_DIR = . # project specific files -SRC = keymap_common.c \ - matrix.c \ +SRC = alps64.c \ led.c ifdef KEYMAP @@ -127,8 +127,7 @@ COMMAND_ENABLE = yes # Commands for debug and configuration # Search Path VPATH += $(TARGET_DIR) +VPATH += $(TOP_DIR) VPATH += $(TMK_DIR) -include $(TMK_DIR)/protocol/lufa.mk -include $(TMK_DIR)/common.mk -include $(TMK_DIR)/rules.mk +include $(TOP_DIR)/quantum/quantum.mk diff --git a/keyboard/alps64/keymap_common.c b/keyboard/alps64/alps64.c index fdb1769e1c..dde10c11e3 100644 --- a/keyboard/alps64/keymap_common.c +++ b/keyboard/alps64/alps64.c @@ -14,17 +14,30 @@ 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 <http://www.gnu.org/licenses/>. */ -#include "keymap_common.h" +#include "quantum.h" +#define LED_ON() do { DDRC |= (1<<5); PORTC |= (1<<5); } while (0) +#define LED_OFF() do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0) +#define LED_TGL() do { DDRC |= (1<<5); PINC |= (1<<5); } while (0) -/* translates key to keycode */ -uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) -{ - return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); +__attribute__ ((weak)) +void matrix_init_user(void) { + +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { + +} + +void matrix_init_kb(void) { + LED_ON(); + _delay_ms(500); + LED_OFF(); + + matrix_init_user(); } -/* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint8_t keycode) -{ - return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; +void matrix_scan_kb(void) { + matrix_scan_user(); } diff --git a/keyboard/alps64/keymap_common.h b/keyboard/alps64/alps64.h index 957db57922..d0777201e0 100644 --- a/keyboard/alps64/keymap_common.h +++ b/keyboard/alps64/alps64.h @@ -14,25 +14,10 @@ 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 <http://www.gnu.org/licenses/>. */ -#ifndef KEYMAP_COMMON_H -#define KEYMAP_COMMON_H - -#include <stdint.h> -#include <stdbool.h> -#include <avr/pgmspace.h> -#include "keycode.h" -#include "action.h" -#include "action_macro.h" -#include "report.h" -#include "host.h" -#include "print.h" -#include "debug.h" -#include "keymap.h" - - -extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; -extern const uint16_t fn_actions[]; +#ifndef ALPS64_H +#define ALPS64_H +#include "quantum.h" /* Alps64 keymap definition macro */ #define KEYMAP( \ diff --git a/keyboard/alps64/config.h b/keyboard/alps64/config.h index 824d3e8302..858a82ecdd 100644 --- a/keyboard/alps64/config.h +++ b/keyboard/alps64/config.h @@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef CONFIG_H #define CONFIG_H +#include "config_common.h" /* USB Device descriptor parameter */ #define VENDOR_ID 0xFEED @@ -31,6 +32,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define MATRIX_ROWS 8 #define MATRIX_COLS 8 +#define MATRIX_COL_PINS { B0, B1, B2, B3, B4, B5, B6, B7 } +#define MATRIX_ROW_PINS { D0, D1, D2, D3, D4, D5, D6, C2 } +#define UNUSED_PINS + /* define if matrix has ghost */ //#define MATRIX_HAS_GHOST diff --git a/keyboard/alps64/keymaps/default.c b/keyboard/alps64/keymaps/default.c index a54899196a..2c45dc7f34 100644 --- a/keyboard/alps64/keymaps/default.c +++ b/keyboard/alps64/keymaps/default.c @@ -1,6 +1,6 @@ -#include "keymap_common.h" +#include "alps64.h" -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 0: qwerty */ KEYMAP( \ GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NUHS, BSPC, \ diff --git a/keyboard/alps64/keymaps/hasu.c b/keyboard/alps64/keymaps/hasu.c index d297d72fea..e93dd0d410 100644 --- a/keyboard/alps64/keymaps/hasu.c +++ b/keyboard/alps64/keymaps/hasu.c @@ -1,9 +1,9 @@ -#include "keymap_common.h" +#include "alps64.h" /* * Hasu */ -const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Default Layer * ,-----------------------------------------------------------. * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | diff --git a/keyboard/alps64/matrix.c b/keyboard/alps64/matrix.c index 5638d7f69d..805999d4a1 100644 --- a/keyboard/alps64/matrix.c +++ b/keyboard/alps64/matrix.c @@ -55,10 +55,6 @@ uint8_t matrix_cols(void) return MATRIX_COLS; } -#define LED_ON() do { DDRC |= (1<<5); PORTC |= (1<<5); } while (0) -#define LED_OFF() do { DDRC &= ~(1<<5); PORTC &= ~(1<<5); } while (0) -#define LED_TGL() do { DDRC |= (1<<5); PINC |= (1<<5); } while (0) - void matrix_init(void) { // initialize row and col @@ -160,6 +156,7 @@ static void unselect_rows(void) PORTC &= ~0b00000100; } + static void select_row(uint8_t row) { // Output low(DDR:1, PORT:0) to select diff --git a/keyboard/gh60/Makefile b/keyboard/gh60/Makefile index 4c8f9dc8ab..9429049fd9 100644 --- a/keyboard/gh60/Makefile +++ b/keyboard/gh60/Makefile @@ -42,14 +42,14 @@ TARGET = gh60_lufa # Directory common source filess exist +TOP_DIR = ../.. TMK_DIR = ../../tmk_core # Directory keyboard dependent files exist TARGET_DIR = . # project specific files -SRC = keymap_common.c \ - matrix.c \ +SRC = matrix.c \ led.c ifdef KEYMAP @@ -119,6 +119,7 @@ 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 +CUSTOM_MATRIX = yes #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA @@ -128,8 +129,7 @@ NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA # Search Path VPATH += $(TARGET_DIR) +VPATH += $(TOP_DIR) VPATH += $(TMK_DIR) -include $(TMK_DIR)/protocol/lufa.mk -include $(TMK_DIR)/common.mk -include $(TMK_DIR)/rules.mk
\ No newline at end of file +include $(TOP_DIR)/quantum/quantum.mk diff --git a/keyboard/gh60/keymap_common.c b/keyboard/gh60/keymap_common.c deleted file mode 100644 index fdb1769e1c..0000000000 --- a/keyboard/gh60/keymap_common.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2012,2013 Jun Wako <wakojun@gmail.com> - -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 <http://www.gnu.org/licenses/>. -*/ -#include "keymap_common.h" - - -/* translates key to keycode */ -uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) -{ - return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); -} - -/* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint8_t keycode) -{ - return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; -} diff --git a/keyboard/hhkb/Makefile b/keyboard/hhkb/Makefile index 21ba261a23..b6c3b869e4 100644 --- a/keyboard/hhkb/Makefile +++ b/keyboard/hhkb/Makefile @@ -56,7 +56,7 @@ SRC = hhkb_qmk.c \ ifdef KEYMAP SRC := keymaps/keymaps/$(KEYMAP).c $(SRC) else - SRC := keymaps/keymaps/default.c $(SRC) + SRC := keymaps/default.c $(SRC) endif CONFIG_H = config.h diff --git a/keyboard/hhkb/matrix.c b/keyboard/hhkb/matrix.c index 14fae0b82c..2dfb2f5e1f 100644 --- a/keyboard/hhkb/matrix.c +++ b/keyboard/hhkb/matrix.c @@ -188,6 +188,14 @@ void matrix_print(void) } } +uint8_t matrix_key_count(void) { + uint8_t count = 0; + for (int8_t r = MATRIX_ROWS - 1; r >= 0; --r) { + count += bitpop16(matrix_get_row(r)); + } + return count; +} + void matrix_power_up(void) { KEY_POWER_ON(); } diff --git a/keyboard/jd45/Makefile b/keyboard/jd45/Makefile index f6a8d10c58..d270a6f8a7 100644 --- a/keyboard/jd45/Makefile +++ b/keyboard/jd45/Makefile @@ -56,7 +56,7 @@ SRC = jd45.c \ ifdef KEYMAP SRC := keymaps/keymaps/(KEYMAP).c $(SRC) else - SRC := keymaps/keymaps/default.c $(SRC) + SRC := keymaps/default.c $(SRC) endif CONFIG_H = config.h diff --git a/keyboard/kc60_v2/Makefile b/keyboard/kc60_v2/Makefile new file mode 100644 index 0000000000..33ece31647 --- /dev/null +++ b/keyboard/kc60_v2/Makefile @@ -0,0 +1,158 @@ +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device. +# Please customize your programmer settings(PROGRAM_CMD) +# +# make teensy = Download the hex file to the device, using teensy_loader_cli. +# (must have teensy_loader_cli installed). +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + +# Target file name (without extension). +TARGET = kc60 + + +# Directory common source filess exist +TOP_DIR = ../.. +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# # project specific files +SRC = kc60.c + +ifdef KEYMAP + SRC := keymaps/$(KEYMAP).c $(SRC) +else + SRC := keymaps/default.c $(SRC) +endif + +CONFIG_H = config.h + +# 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 = 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 = 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 +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 + + +ifdef KEYMAP + +ifeq ("$(wildcard keymaps/$(KEYMAP).c)","") +ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","") + include keymaps/$(KEYMAP)/makefile.mk +endif +endif + +else + +ifneq ("$(wildcard keymaps/default/makefile.mk)","") + include keymaps/default/makefile.mk +endif + +endif + +# Optimize size but this may cause error "relocation truncated to fit" +#EXTRALDFLAGS = -Wl,--relax + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TOP_DIR) +VPATH += $(TMK_DIR) + +include $(TOP_DIR)/quantum/quantum.mk + diff --git a/keyboard/kc60_v2/README.md b/keyboard/kc60_v2/README.md new file mode 100644 index 0000000000..4be448d15c --- /dev/null +++ b/keyboard/kc60_v2/README.md @@ -0,0 +1,24 @@ +kc60 keyboard firmware +====================== + +## Quantum MK Firmware + +For the full Quantum feature list, see [the parent README.md](/README.md). + +## Building + +Download or clone the whole firmware and navigate to the keyboard/kc60 folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. + +Depending on which keymap you would like to use, you will have to compile slightly differently. + +### Default +To build with the default keymap, simply run `make`. + +### Other Keymaps +Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>.c` in the keymaps folder, and see keymap document (you can find in top README.md) and existent keymap files. + +To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like: +``` +$ make KEYMAP=[default|jack|<name>] +``` +Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder. diff --git a/keyboard/kc60_v2/config.h b/keyboard/kc60_v2/config.h new file mode 100644 index 0000000000..16bc1cbb29 --- /dev/null +++ b/keyboard/kc60_v2/config.h @@ -0,0 +1,161 @@ +/* +Copyright 2012 Jun Wako <wakojun@gmail.com> + +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 <http://www.gnu.org/licenses/>. +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER You +#define PRODUCT kc60v2 +#define DESCRIPTION A custom keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +/* + * 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) + * +*/ + +// Possible pins for columns include: F1 F0 E6 D7 D6 D4 C7 C6 B7 B5 B4 B3 B1 B0 +// Pins for rows include: D0 D1 F6 F7 D5 +#define MATRIX_ROW_PINS { D0, D1, F6, F7, D5 } +#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3 } +#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 */ +#define BACKLIGHT_LEVELS 3 + +/* 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 + +#endif diff --git a/keyboard/kc60_v2/kc60.c b/keyboard/kc60_v2/kc60.c new file mode 100644 index 0000000000..0a578b2b88 --- /dev/null +++ b/keyboard/kc60_v2/kc60.c @@ -0,0 +1,111 @@ +#include "kc60.h" + +__attribute__ ((weak)) + void matrix_init_user(void) { + // leave this function blank - it can be defined in a keymap file + }; + +__attribute__ ((weak)) + void matrix_scan_user(void) { + // leave this function blank - it can be defined in a keymap file + } + +__attribute__ ((weak)) + bool process_action_user(keyrecord_t *record) { + // leave this function blank - it can be defined in a keymap file + return true; + } + +__attribute__ ((weak)) + void led_set_user(uint8_t usb_led) { + // leave this function blank - it can be defined in a keymap file + } + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + +#ifdef BACKLIGHT_ENABLE + backlight_init_ports(); +#endif + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_action_kb(keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_action_user(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); +} + +#ifdef BACKLIGHT_ENABLE +#define CHANNEL OCR1B + +void backlight_init_ports() +{ + + // Setup PB6 as output and output low. + DDRB |= (1<<6); + PORTB &= ~(1<<6); + + // Use full 16-bit resolution. + ICR1 = 0xFFFF; + + // I could write a wall of text here to explain... but TL;DW + // Go read the ATmega32u4 datasheet. + // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on + + // Pin PB7 = OCR1C (Timer 1, Channel C) + // Compare Output Mode = Clear on compare match, Channel C = COM1B1=1 COM1C0=0 + // (i.e. start high, go low when counter matches.) + // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0 + // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1 + + TCCR1A = _BV(COM1B1) | _BV(WGM11); // = 0b00001010; + TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001; + + backlight_init(); +} + +void backlight_set(uint8_t level) +{ + // Prevent backlight blink on lowest level + PORTB &= ~(_BV(PORTB6)); + + if ( level == 0 ) + { + // Turn off PWM control on PB6, revert to output low. + TCCR1A &= ~(_BV(COM1B1)); + CHANNEL = 0x0; + } + else if ( level == BACKLIGHT_LEVELS) + { + // Turn on PWM control of PB6 + TCCR1A |= _BV(COM1B1); + // Set the brightness + CHANNEL = 0xFFFF; + } + else + { + // Turn on PWM control of PB6 + TCCR1A |= _BV(COM1B1); + // Set the brightness + CHANNEL = 0xFFFF >> ((BACKLIGHT_LEVELS - level) * ((BACKLIGHT_LEVELS + 1) / 2)); + } +} + +#endif diff --git a/keyboard/kc60_v2/kc60.h b/keyboard/kc60_v2/kc60.h new file mode 100644 index 0000000000..d346a55028 --- /dev/null +++ b/keyboard/kc60_v2/kc60.h @@ -0,0 +1,36 @@ +#ifndef KC60_H +#define KC60_H + +#include "matrix.h" +#include "keymap_common.h" +#ifdef BACKLIGHT_ENABLE +#include "backlight.h" +#endif +#include <avr/io.h> +#include <stddef.h> + +// This a shortcut to help you visually see your layout. +// The first section contains all of the arguements +// The second converts the arguments into a multi-dimensional array +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, \ + 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, K45, K4A, K4B, K4C, K4D \ + ) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D }, \ + { 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, KC_NO, KC_NO, K45, KC_NO, KC_NO, KC_NO, KC_NO,K4A, K4B, K4C, K4D } \ +} + +void matrix_init_user(void); +void matrix_scan_user(void); +bool process_action_user(keyrecord_t *record); + +void led_set_user(uint8_t usb_led); +void backlight_init_ports(void); + +#endif diff --git a/keyboard/kc60_v2/keymaps/default.c b/keyboard/kc60_v2/keymaps/default.c new file mode 100644 index 0000000000..6f8352c695 --- /dev/null +++ b/keyboard/kc60_v2/keymaps/default.c @@ -0,0 +1,24 @@ +// This is the canonical layout file for the Quantum project. If you want to add another keyboard, +// this is the style you want to emulate. + +#include "kc60.h" + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = KEYMAP( /* Basic QWERTY */ + 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_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_NO, KC_ENT, \ + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_NO, KC_RSFT, \ + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_RCTL, RESET \ + ), +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + return MACRO_NONE; +}; diff --git a/keyboard/planck/.gitignore b/keyboard/planck/.gitignore new file mode 100644 index 0000000000..6e92f57d46 --- /dev/null +++ b/keyboard/planck/.gitignore @@ -0,0 +1 @@ +tags |