From: Jeff Date: Wed, 4 Jan 2017 02:56:11 +0000 (-0600) Subject: Refactor minivan config to not use a layer hack X-Git-Url: https://git.gir.st/tmk_keyboard.git/commitdiff_plain/5dd11e823831216f81d4d3e1bbe70a3ff103cd75 Refactor minivan config to not use a layer hack There is backlight support built into TMK core, so rather than injecting a hacky function on layer switching for LED toggling, you can instead add in support for the existing system and using the `ACTION_BACKLIGHT_` commands. For now, this toggles between off and 100% on. A software PWM can be done (look at the sleep led code) to do breathing, various intensities, etc. Also cleaned up the minivan codebase (removed incorrect/left over keymaps for other GH60 layouts, fixed the README, added in comment sections for the keymap layouts to be visualized, etc). This does not have updated keymaps for the arrow layout (but should not be much work) or the additional layouts that Evan has been working on. --- diff --git a/keyboard/tv44/Makefile b/keyboard/tv44/Makefile new file mode 100644 index 00000000..35f002f1 --- /dev/null +++ b/keyboard/tv44/Makefile @@ -0,0 +1,146 @@ +#---------------------------------------------------------------------------- +# 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). +ifdef TARGETFILE + TARGET = $(TARGETFILE) +else + TARGET = tv44_lufa +endif + +ifdef LEDCONF + LED = $(LEDCONF).c +else + LED = led.c +endif + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = matrix.c \ + backlight.c \ + $(LED) + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_tv44.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 +# 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 +#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA +BACKLIGHT_ENABLE = yes + + +# Optimize size but this may cause error "relocation truncated to fit" +#EXTRALDFLAGS = -Wl,--relax + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + +include $(TMK_DIR)/protocol/lufa.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk diff --git a/keyboard/tv44/Makefile.pjrc b/keyboard/tv44/Makefile.pjrc new file mode 100644 index 00000000..11bd3b78 --- /dev/null +++ b/keyboard/tv44/Makefile.pjrc @@ -0,0 +1,116 @@ +#---------------------------------------------------------------------------- +# 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 = gh60_pjrc + +# Directory common source filess exist +TMK_DIR = ../../tmk_core + +# Directory keyboard dependent files exist +TARGET_DIR = . + +# project specific files +SRC = keymap_common.c \ + matrix.c \ + led.c + +ifdef KEYMAP + SRC := keymap_$(KEYMAP).c $(SRC) +else + SRC := keymap_poker.c $(SRC) +endif + +CONFIG_H = config.h + + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +MCU = atmega32u4 +#MCU = at90usb1286 + + +# Processor frequency. +# Normally the first thing your program should do is set the clock prescaler, +# so your program will run at the correct speed. You should also set this +# variable to same clock speed. The _delay_ms() macro uses this, and many +# examples use this variable to calculate timings. Do not add a "UL" here. +F_CPU = 16000000 + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+5000) +EXTRAKEY_ENABLE = yes # Audio control and System control(+600) +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover(+500) +#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support + + +# Search Path +VPATH += $(TARGET_DIR) +VPATH += $(TMK_DIR) + +include $(TMK_DIR)/protocol/pjrc.mk +include $(TMK_DIR)/common.mk +include $(TMK_DIR)/rules.mk + +plain: OPT_DEFS += -DKEYMAP_PLAIN +plain: all + +poker: OPT_DEFS += -DKEYMAP_POKER +poker: all + +poker_set: OPT_DEFS += -DKEYMAP_POKER_SET +poker_set: all + +poker_bit: OPT_DEFS += -DKEYMAP_POKER_BIT +poker_bit: all diff --git a/keyboard/tv44/README.md b/keyboard/tv44/README.md new file mode 100644 index 00000000..a042d18c --- /dev/null +++ b/keyboard/tv44/README.md @@ -0,0 +1,10 @@ +TV44 keyboard firmware +====================== +40% keyboard designed by evangs + +## Build +Move to this directory then just run `make` like: + + $ make + +Use `make -f Makefile.pjrc` if you want to use PJRC stack but I find no reason to do so now. diff --git a/keyboard/tv44/backlight.c b/keyboard/tv44/backlight.c new file mode 100644 index 00000000..026e95b1 --- /dev/null +++ b/keyboard/tv44/backlight.c @@ -0,0 +1,30 @@ +/* +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 . +*/ + +#include +#include "backlight.h" + + +void backlight_set(uint8_t level) { + DDRB |= (1<<2); + + if (level) { // Backlight on + PORTB |= (1<<2); + } else { // Backlight off + PORTB &= ~(1<<2); + } +} diff --git a/keyboard/tv44/config.h b/keyboard/tv44/config.h new file mode 100644 index 00000000..8e8a7f87 --- /dev/null +++ b/keyboard/tv44/config.h @@ -0,0 +1,73 @@ +/* +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 + + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEAE +#define PRODUCT_ID 0x8844 +#define DEVICE_VER 0x0002 +#define MANUFACTURER Evan Sailer +#define PRODUCT TheVan 44 +#define DESCRIPTION keyboard firmware for TV44 + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 12 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 1 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* 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 + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + + + +/* + * 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/tv44/keymap_common.c b/keyboard/tv44/keymap_common.c new file mode 100644 index 00000000..fdb1769e --- /dev/null +++ b/keyboard/tv44/keymap_common.c @@ -0,0 +1,30 @@ +/* +Copyright 2012,2013 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 . +*/ +#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/tv44/keymap_common.h b/keyboard/tv44/keymap_common.h new file mode 100644 index 00000000..16222c2c --- /dev/null +++ b/keyboard/tv44/keymap_common.h @@ -0,0 +1,61 @@ +/* +Copyright 2012,2013 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 KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include +#include +#include +#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" + + +/* TV44 standard keymap definition macro + */ +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K37, K38, K39, K3B \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_NO, KC_NO, KC_##K37, KC_##K38, KC_##K39, KC_NO, KC_##K3B } \ +} + +/* TV44 arrow keymap definition macro + */ +#define KEYMAP_ARROW( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K37, K38, K39, K3A, K3B \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_NO, KC_NO, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ +} + +#endif diff --git a/keyboard/tv44/keymap_tv44.c b/keyboard/tv44/keymap_tv44.c new file mode 100644 index 00000000..16bb4931 --- /dev/null +++ b/keyboard/tv44/keymap_tv44.c @@ -0,0 +1,116 @@ +#include "keymap_common.h" + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Layer: Base Layer + * ,-------------------------------------------------. + * |Tab| Q| W| E| R| T| Y| U| I| O| P| BSp | + * |-------------------------------------------------| + * |FN1 | A| S| D| F| G| H| J| K| L| ;|Fn1'| + * |-------------------------------------------------| + * |SftEs| Z| X| C| V| B| N| M| ,| .| /|FN2| + * |-------------------------------------------------| + * |Ctrl| FN2 |Gui |Enter| Space |Alt |Shift| FN3 | + * `-------------------------------------------------' + */ + KEYMAP( + TAB , Q, W, E, R, T, Y, U, I, O, P, BSPC, \ + FN0 , A, S, D, F, G, H, J, K, L,SCLN, FN21, \ + FN22 , Z, X, C, V, B, N, M,COMM, DOT,SLSH, FN1, \ + LCTL, FN1, LGUI, ENT, SPC, RALT, RSFT, FN2 ), + + /* Layer: Function Layer 1 + * ,-------------------------------------------------. + * | `| !| @| #| $| %| ^| &| *| (| )| Del | + * |-------------------------------------------------| + * | | \| '| -| =| [| ]| Dn| Up|Lft| Rt| | + * |-------------------------------------------------| + * | |Esc|LED|PSc| | | |Stp|Ply|Prv|Nxt|Sft| + * |-------------------------------------------------| + * | | Gui | | | | | | | + * `-------------------------------------------------' + */ + KEYMAP( + GRV , FN4, FN5, FN6, FN7, FN8, FN9,FN10,FN11,FN12,FN13, DEL, \ + TRNS ,BSLS,QUOT,MINS, EQL,LBRC,RBRC,DOWN, UP,LEFT,RGHT, TRNS, \ + TRNS , ESC,FN20,PSCR,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,RSFT, \ + TRNS, LGUI, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ), + + /* Layer: Function Layer 2 + * ,-------------------------------------------------. + * | ~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| | + * |-------------------------------------------------| + * | Esc| || "| _| +| {| }| 4| 5| 6|Vl+|Entr| + * |-------------------------------------------------| + * | | | | | | | | 1| 2| 3|Vl-| | + * |-------------------------------------------------| + * | | | | | | | | | + * `-------------------------------------------------' + */ + KEYMAP( + FN3 , 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, \ + ESC ,FN14,FN15,FN16,FN17,FN18,FN19, 4, 5, 6,VOLU, ENT, \ + TRNS ,TRNS,TRNS,TRNS,TRNS,TRNS, 0, 1, 2, 3,VOLD,TRNS, \ + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ), + + /* Layer: Game Layer + * ,-------------------------------------------------. + * | | | | | | | | F1| F2| F3| F4| | + * |-------------------------------------------------| + * | Esc| | | | | | | F5| F6| F7| F8|Entr| + * |-------------------------------------------------| + * |Shift| 1| 2| 3| 4| 5| 6| F9|F10|F11|F12|Sft| + * |-------------------------------------------------| + * | | Shift | B |Space| C | | | | + * `-------------------------------------------------' + */ + KEYMAP( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, F1, F2, F3, F4, TRNS, \ + ESC ,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, F5, F6, F7, F8, ENT, \ + LSFT , 1, 2, 3, 4, 5, 6, F9, F10, F11, F12,RSFT, \ + TRNS, LSFT, B, SPC, C, TRNS, TRNS, TRNS ), + +#if 0 + /* Layer: XX Layer + * ,-------------------------------------------------. + * | | | | | | | | | | | | | + * |-------------------------------------------------| + * | | | | | | | | | | | | | + * |-------------------------------------------------| + * | | | | | | | | | | | | | + * |-------------------------------------------------| + * | | | | | | | | | + * `-------------------------------------------------' + */ + KEYMAP( + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS ,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS ,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS ), +#endif +}; + +const action_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_MOMENTARY(2), + [2] = ACTION_LAYER_TOGGLE(3), + [3] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), + [4] = ACTION_MODS_KEY(MOD_LSFT, KC_1), + [5] = ACTION_MODS_KEY(MOD_LSFT, KC_2), + [6] = ACTION_MODS_KEY(MOD_LSFT, KC_3), + [7] = ACTION_MODS_KEY(MOD_LSFT, KC_4), + [8] = ACTION_MODS_KEY(MOD_LSFT, KC_5), + [9] = ACTION_MODS_KEY(MOD_LSFT, KC_6), + [10] = ACTION_MODS_KEY(MOD_LSFT, KC_7), + [11] = ACTION_MODS_KEY(MOD_LSFT, KC_8), + [12] = ACTION_MODS_KEY(MOD_LSFT, KC_9), + [13] = ACTION_MODS_KEY(MOD_LSFT, KC_0), + [14] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), + [15] = ACTION_MODS_KEY(MOD_LSFT, KC_QUOT), + [16] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), + [17] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), + [18] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), + [19] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), + [20] = ACTION_BACKLIGHT_STEP(), + [21] = ACTION_LAYER_TAP_KEY(1, KC_QUOT), + [22] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC) +}; diff --git a/keyboard/tv44/keymap_tv44_arrow.c b/keyboard/tv44/keymap_tv44_arrow.c new file mode 100644 index 00000000..5e734bf8 --- /dev/null +++ b/keyboard/tv44/keymap_tv44_arrow.c @@ -0,0 +1,59 @@ +#include "keymap_common.h" + +const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* 0: qerty */ + KEYMAP_ARROW(TAB, Q, W, E, R, T, Y, U, I, O, P, BSPC, \ + FN0, A, S, D, F, G, H, J, K, L, SCLN,FN0, \ + LSFT, Z, X, C, V, B, N, M, COMM,DOT,SLSH,FN1, \ + LCTL, FN1, LGUI, ENT, SPC, RALT, RSFT, ESC, FN2), + + /* 1: FN 1 */ + KEYMAP_ARROW(GRV, FN4, FN5, FN6, FN7, FN8, FN9,FN10,FN11,FN12,FN13, DEL, \ + TRNS, BSLS,QUOT,MINS, EQL,LBRC,RBRC,DOWN, UP,LEFT,RGHT, TRNS, \ + TRNS, ESC,FN20,PSCR,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT, RSFT, \ + TRNS, LGUI, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), + + /* 2: FN 2 */ + KEYMAP_ARROW(FN3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, TRNS, \ + ESC, FN14,FN15,FN16,FN17,FN18,FN19, 4, 5, 6,VOLU, ENT, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, 0, 1, 2, 3,VOLD, TRNS, \ + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), + + /* 3: Game Mode */ + KEYMAP_ARROW(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, F1, F2, F3, F4, TRNS, \ + ESC, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, F5, F6, F7, F8, ENT, \ + LSFT, 1, 2, 3, 4, 5, 6, F9, F10, F11, F12,RSFT, \ + TRNS, LSFT, B, SPC, C, TRNS, TRNS, TRNS, TRNS), + + /* 4: LED Mode */ + KEYMAP_ARROW(TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,TRNS, \ + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_LAYER_MOMENTARY(1), + [1] = ACTION_LAYER_MOMENTARY(2), + [2] = ACTION_LAYER_TOGGLE(3), + [3] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), + [4] = ACTION_MODS_KEY(MOD_LSFT, KC_1), + [5] = ACTION_MODS_KEY(MOD_LSFT, KC_2), + [6] = ACTION_MODS_KEY(MOD_LSFT, KC_3), + [7] = ACTION_MODS_KEY(MOD_LSFT, KC_4), + [8] = ACTION_MODS_KEY(MOD_LSFT, KC_5), + [9] = ACTION_MODS_KEY(MOD_LSFT, KC_6), + [10] = ACTION_MODS_KEY(MOD_LSFT, KC_7), + [11] = ACTION_MODS_KEY(MOD_LSFT, KC_8), + [12] = ACTION_MODS_KEY(MOD_LSFT, KC_9), + [13] = ACTION_MODS_KEY(MOD_LSFT, KC_0), + [14] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), + [15] = ACTION_MODS_KEY(MOD_LSFT, KC_QUOT), + [16] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), + [17] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), + [18] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), + [19] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), + [20] = ACTION_LAYER_TOGGLE(4), + [21] = ACTION_LAYER_TAP_KEY(1, KC_QUOT), + [22] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC) +}; diff --git a/keyboard/tv44/led.c b/keyboard/tv44/led.c new file mode 100644 index 00000000..91f20030 --- /dev/null +++ b/keyboard/tv44/led.c @@ -0,0 +1,45 @@ +/* +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 . +*/ + +#include +#include "stdint.h" +#include "led.h" + + +void led_set(uint8_t usb_led) +{ + if (usb_led & (1< + +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" + + +#ifndef DEBOUNCE +# define DEBOUNCE 5 +#endif +static uint8_t debouncing = DEBOUNCE; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +static matrix_row_t read_cols(void); +static void init_cols(void); +static void unselect_rows(void); +static void select_row(uint8_t row); + + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + // To use PORTF disable JTAG with writing JTD bit twice within four cycles. + MCUCR |= (1<