Updates | Updates | ||||
------- | ------- | ||||
#### 2016/06/26 | |||||
Keymap framework was updated. `fn_actions[]` should be defined as `action_t` instead of `uint16_t`. And default code for keymap handling is now included in core you just need define `uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]` and `action_t fn_actions[]`. | |||||
#### 2016/06/22 | #### 2016/06/22 | ||||
Some projects were moved from `converter` and `keyboard` to `orphan` directory. Those might be removed in some future but you will be able to access them with `orphans` tag. See <https://github.com/tmk/tmk_keyboard/issues/173> | Some projects were moved from `converter` and `keyboard` to `orphan` directory. Those might be removed in some future but you will be able to access them with `orphans` tag. See <https://github.com/tmk/tmk_keyboard/issues/173> | ||||
#---------------------------------------------------------------------------- | |||||
# 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 file name (without extension). | ||||
TARGET = adb_usb_lufa | |||||
TARGET ?= adb_usb | |||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TMK_DIR = ../../tmk_core | |||||
TMK_DIR ?= ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | |||||
TARGET_DIR ?= . | |||||
# project specific files | # project specific files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC ?= matrix.c \ | |||||
led.c \ | led.c \ | ||||
adb.c | adb.c | ||||
ifdef KEYMAP | |||||
SRC := keymap_$(KEYMAP).c $(SRC) | |||||
else | |||||
SRC := keymap_plain.c $(SRC) | |||||
endif | |||||
CONFIG_H = config.h | CONFIG_H = config.h | ||||
# atmega32u4 Teensy2.0 | # atmega32u4 Teensy2.0 | ||||
# atemga32u4 TMK Converter rev.1 | # atemga32u4 TMK Converter rev.1 | ||||
# atemga32u2 TMK Converter rev.2 | # atemga32u2 TMK Converter rev.2 | ||||
MCU = atmega32u2 | |||||
MCU ?= atmega32u2 | |||||
# Processor frequency. | # Processor frequency. | ||||
# This will define a symbol, F_CPU, in all source code files equal to the | # This will define a symbol, F_CPU, in all source code files equal to the | ||||
# does not *change* the processor frequency - it should merely be updated to | # 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 | # reflect the processor speed set externally so that the code can use accurate | ||||
# software delays. | # software delays. | ||||
F_CPU = 16000000 | |||||
F_CPU ?= 16000000 | |||||
# | # | ||||
# LUFA specific | # LUFA specific | ||||
# | # | ||||
# Target architecture (see library "Board Types" documentation). | # Target architecture (see library "Board Types" documentation). | ||||
ARCH = AVR8 | |||||
ARCH ?= AVR8 | |||||
# Input clock frequency. | # Input clock frequency. | ||||
# This will define a symbol, F_USB, in all source code files equal to the | # This will define a symbol, F_USB, in all source code files equal to the | ||||
# | # | ||||
# If no clock division is performed on the input clock inside the AVR (via the | # 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. | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||||
F_USB = $(F_CPU) | |||||
F_USB ?= $(F_CPU) | |||||
# Interrupt driven control endpoint task(+60) | # Interrupt driven control endpoint task(+60) | ||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | ||||
#NKRO_ENABLE = yes # USB Nkey Rollover | #NKRO_ENABLE = yes # USB Nkey Rollover | ||||
ADB_MOUSE_ENABLE = yes | ADB_MOUSE_ENABLE = yes | ||||
#UNIMAP_ENABLE = yes | |||||
#ACTIONMAP_ENABLE = yes # Use 16bit actionmap instead of 8bit keymap | |||||
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor | |||||
# ADB Mice need acceleration for todays much bigger screens. | # ADB Mice need acceleration for todays much bigger screens. | ||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8 | OPT_DEFS += -DADB_MOUSE_MAXACC=8 | ||||
# Optimize size but this may cause error "relocation truncated to fit" | # Optimize size but this may cause error "relocation truncated to fit" | ||||
#EXTRALDFLAGS = -Wl,--relax | #EXTRALDFLAGS = -Wl,--relax | ||||
# | |||||
# Keymap file | |||||
# | |||||
ifdef UNIMAP_ENABLE | |||||
KEYMAP_FILE = unimap | |||||
else | |||||
ifdef ACTIONMAP_ENABLE | |||||
KEYMAP_FILE = actionmap | |||||
else | |||||
KEYMAP_FILE = keymap | |||||
endif | |||||
endif | |||||
ifdef KEYMAP | |||||
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) | |||||
else | |||||
SRC := $(KEYMAP_FILE)_plain.c $(SRC) | |||||
endif | |||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TMK_DIR) | VPATH += $(TMK_DIR) |
#---------------------------------------------------------------------------- | |||||
# 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 = adb_usb_lufa | |||||
# 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 \ | |||||
adb.c | |||||
ifdef KEYMAP | |||||
SRC := keymap_$(KEYMAP).c $(SRC) | |||||
else | |||||
SRC := keymap_ansi.c $(SRC) | |||||
endif | |||||
CONFIG_H = config.h | |||||
# MCU name | |||||
# atmega32u4 Teensy2.0 | |||||
# atemga32u4 TMK Converter rev.1 | |||||
# atemga32u2 TMK Converter rev.2 | |||||
TARGET = adb_usb_rev1 | |||||
MCU = atmega32u4 | 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 for TMK Converter rev.1/rev.2 | |||||
# 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 | |||||
ADB_MOUSE_ENABLE = yes | |||||
# ADB Mice need acceleration for todays much bigger screens. | |||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8 | |||||
# 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)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
include Makefile |
#---------------------------------------------------------------------------- | |||||
# 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 = adb_usb_lufa | |||||
# 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 \ | |||||
adb.c | |||||
ifdef KEYMAP | |||||
SRC := keymap_$(KEYMAP).c $(SRC) | |||||
else | |||||
SRC := keymap_ansi.c $(SRC) | |||||
endif | |||||
CONFIG_H = config.h | |||||
# MCU name | |||||
# atmega32u4 Teensy2.0 | |||||
# atemga32u4 TMK Converter rev.1 | |||||
# atemga32u2 TMK Converter rev.2 | |||||
TARGET = adb_usb_teensy | |||||
MCU = atmega32u4 | 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 for TMK Converter rev.1/rev.2 | |||||
# LUFA bootloader 4096 | |||||
# USBaspLoader 2048 | |||||
OPT_DEFS += -DBOOTLOADER_SIZE=512 | |||||
# 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 | |||||
ADB_MOUSE_ENABLE = yes | |||||
# ADB Mice need acceleration for todays much bigger screens. | |||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8 | |||||
# 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)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
include Makefile |
TARGET = adb_usb_unimap | |||||
UNIMAP_ENABLE = yes | |||||
KEYMAP_SECTION_ENABLE = yes | |||||
include Makefile |
ADB to USB keyboard converter | ADB to USB keyboard converter | ||||
============================= | ============================= | ||||
This firmware converts Apple ADB keyboard protocol to USB. You can use TMK Converter, PJRC Teensy2.0 and other USB AVR MCU(ATMega32U4, AT90USB64/128 or etc) for this. But binary size is probably more than 10KB and it won't fit into 8K flash. | |||||
This firmware converts Apple ADB keyboard protocol to USB, you can use it to plug old ADB keyboard into modern computer. It works on TMK ADB-USB Converter, PJRC Teensy2.0 and other USB AVR MCU(ATMega32U4, AT90USB64/128 or etc) and needs more than 10KB flash at least. | |||||
Discuss: http://geekhack.org/showwiki.php?title=Island:14290 | |||||
Discuss here: http://geekhack.org/showwiki.php?title=Island:14290 | |||||
TMK Converter: https://geekhack.org/index.php?topic=72052.0 | |||||
You can buy a TMK converter here: https://geekhack.org/index.php?topic=72052.0 | |||||
#define LOCKING_RESYNC_ENABLE | #define LOCKING_RESYNC_ENABLE | ||||
/* legacy keymap support */ | |||||
#define USE_LEGACY_KEYMAP | |||||
/* ADB port setting */ | /* ADB port setting */ | ||||
#define ADB_PORT PORTD | #define ADB_PORT PORTD | ||||
#define ADB_PIN PIND | #define ADB_PIN PIND |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
}; | }; |
/* | |||||
Copyright 2011,2012,2013 Jun Wako <[email protected]> | |||||
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)]) }; | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "action.h" | #include "action.h" | ||||
#include "action_macro.h" | #include "action_macro.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* Common layout: ANSI+ISO | /* Common layout: ANSI+ISO | ||||
* ,---. .---------------. ,---------------. ,---------------. ,-----------. ,---------------. | * ,---. .---------------. ,---------------. ,---------------. ,-----------. ,---------------. | ||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|Pwr| |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_BSLS), | [0] = ACTION_LAYER_TAP_KEY(1, KC_BSLS), | ||||
}; | }; |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
}; | }; |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_GRV), | [0] = ACTION_LAYER_TAP_KEY(1, KC_GRV), | ||||
[1] = ACTION_LAYER_TAP_KEY(1, KC_BSLS), | [1] = ACTION_LAYER_TAP_KEY(1, KC_BSLS), | ||||
}; | }; |
/* | |||||
Copyright 2016 Jun Wako <[email protected]> | |||||
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 UNIMAP_COMMON_H | |||||
#define UNIMAP_COMMON_H | |||||
#include <stdint.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "unimap.h" | |||||
/* Apple Extended Keyboard Common layout: ANSI+ISO | |||||
* ,---. .---------------. ,---------------. ,---------------. ,-----------. ,---------------. | |||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |VDn|VUp|Mut|F24| | |||||
* `---' `---------------' `---------------' `---------------' `-----------' `---------------' | |||||
* ,-----------------------------------------------------------. ,-----------. ,---------------. | |||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| |Ins|Hom|PgU| |NmL| =| /| *| | |||||
* |-----------------------------------------------------------| |-----------| |---------------| | |||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| |Del|End|PgD| | 7| 8| 9| -| | |||||
* |-----------------------------------------------------------| `-----------' |---------------| | |||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | 4| 5| 6| +| | |||||
* |-----------------------------------------------------------| ,---. |---------------| | |||||
* |Shif|\ | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | | |||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent| | |||||
* |Ctrl |Alt |Gui | Space |Gui |Alt |Ctrl | |Lef|Dow|Rig| | 0| .| | | |||||
* `-----------------------------------------------------------' `-----------' `---------------' | |||||
* Command = Gui | |||||
* Option = Alt | |||||
* Power key = F24 | |||||
* Mic = F13(Adjustable keyboard) | |||||
*/ | |||||
// http://lxr.free-electrons.com/source/drivers/macintosh/adbhid.c | |||||
// http://opensource.apple.com//source/IOHIDFamily/IOHIDFamily-701.20.10/IOHIDFamily/Cosmo_USB2ADB.c | |||||
// http://m0115.web.fc2.com/m0115.jpg | |||||
const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = { | |||||
// Position(unimap) ADB scan code(matrix) | |||||
// --------------------------------------------- | |||||
{ | |||||
UNIMAP_A, // 0x00 | |||||
UNIMAP_S, // 0x01 | |||||
UNIMAP_D, // 0x02 | |||||
UNIMAP_F, // 0x03 | |||||
UNIMAP_H, // 0x04 | |||||
UNIMAP_G, // 0x05 | |||||
UNIMAP_Z, // 0x06 | |||||
UNIMAP_X, // 0x07 | |||||
}, | |||||
{ | |||||
UNIMAP_C, // 0x08 | |||||
UNIMAP_V, // 0x09 | |||||
UNIMAP_NONUS_BSLASH, // 0x0A | |||||
UNIMAP_B, // 0x0B | |||||
UNIMAP_Q, // 0x0C | |||||
UNIMAP_W, // 0x0D | |||||
UNIMAP_E, // 0x0E | |||||
UNIMAP_R, // 0x0F | |||||
}, | |||||
{ | |||||
UNIMAP_Y, // 0x10 | |||||
UNIMAP_T, // 0x11 | |||||
UNIMAP_1, // 0x12 | |||||
UNIMAP_2, // 0x13 | |||||
UNIMAP_3, // 0x14 | |||||
UNIMAP_4, // 0x15 | |||||
UNIMAP_6, // 0x16 | |||||
UNIMAP_5, // 0x17 | |||||
}, | |||||
{ | |||||
UNIMAP_EQUAL, // 0x18 | |||||
UNIMAP_9, // 0x19 | |||||
UNIMAP_7, // 0x1A | |||||
UNIMAP_MINUS, // 0x1B | |||||
UNIMAP_8, // 0x1C | |||||
UNIMAP_0, // 0x1D | |||||
UNIMAP_RBRACKET, // 0x1E | |||||
UNIMAP_O, // 0x1F | |||||
}, | |||||
{ | |||||
UNIMAP_U, // 0x20 | |||||
UNIMAP_LBRACKET, // 0x21 | |||||
UNIMAP_I, // 0x22 | |||||
UNIMAP_P, // 0x23 | |||||
UNIMAP_ENTER, // 0x24 | |||||
UNIMAP_L, // 0x25 | |||||
UNIMAP_J, // 0x26 | |||||
UNIMAP_QUOTE, // 0x27 | |||||
}, | |||||
{ | |||||
UNIMAP_K, // 0x28 | |||||
UNIMAP_SCOLON, // 0x29 | |||||
UNIMAP_BSLASH, // 0x2A | |||||
UNIMAP_COMMA, // 0x2B | |||||
UNIMAP_SLASH, // 0x2C | |||||
UNIMAP_N, // 0x2D | |||||
UNIMAP_M, // 0x2E | |||||
UNIMAP_DOT, // 0x2F | |||||
}, | |||||
{ | |||||
UNIMAP_TAB, // 0x30 | |||||
UNIMAP_SPACE, // 0x31 | |||||
UNIMAP_GRAVE, // 0x32 | |||||
UNIMAP_BSPACE, // 0x33 | |||||
UNIMAP_KP_ENTER, // 0x34 | |||||
UNIMAP_ESCAPE, // 0x35 | |||||
UNIMAP_LCTRL, // 0x36 | |||||
UNIMAP_LGUI, // 0x37 | |||||
}, | |||||
{ | |||||
UNIMAP_LSHIFT, // 0x38 | |||||
UNIMAP_CAPSLOCK, // 0x39 | |||||
UNIMAP_LALT, // 0x3A | |||||
UNIMAP_LEFT, // 0x3B | |||||
UNIMAP_RIGHT, // 0x3C | |||||
UNIMAP_DOWN, // 0x3D | |||||
UNIMAP_UP, // 0x3E | |||||
UNIMAP_F23, // 0x3F FN? | |||||
}, | |||||
{ | |||||
UNIMAP_F17, // 0x40 | |||||
UNIMAP_KP_DOT, // 0x41 | |||||
UNIMAP_F13, // 0x42 Mic(Adjustable keyboard) | |||||
UNIMAP_KP_MINUS, // 0x43 ADB keypad asterisk(top right) | |||||
UNIMAP_NO, // 0x44 | |||||
UNIMAP_KP_COMMA, // 0x45 ADB keypad plus | |||||
UNIMAP_NO, // 0x46 | |||||
UNIMAP_NUMLOCK, // 0x47 | |||||
}, | |||||
{ | |||||
UNIMAP_VOLUME_UP, // 0x48 Vol Up(Adjustable keyboard) | |||||
UNIMAP_VOLUME_DOWN, // 0x49 Vol Down(Adjustable keyboard) | |||||
UNIMAP_VOLUME_MUTE, // 0x4A Vol Mute(Adjustable keyboard) | |||||
UNIMAP_KP_ASTERISK, // 0x4B ADB keypad slash(between equal and asterisk) | |||||
UNIMAP_KP_ENTER, // 0x4C | |||||
UNIMAP_NO, // 0x4D | |||||
UNIMAP_KP_PLUS, // 0x4E ADB keypad minus | |||||
UNIMAP_F18, // 0x4F | |||||
}, | |||||
{ | |||||
UNIMAP_F19, // 0x50 | |||||
UNIMAP_KP_SLASH, // 0x51 ADB keypad equal(next to clear/numlock) | |||||
UNIMAP_KP_0, // 0x52 | |||||
UNIMAP_KP_1, // 0x53 | |||||
UNIMAP_KP_2, // 0x54 | |||||
UNIMAP_KP_3, // 0x55 | |||||
UNIMAP_KP_4, // 0x56 | |||||
UNIMAP_KP_5, // 0x57 | |||||
}, | |||||
{ | |||||
UNIMAP_KP_6, // 0x58 | |||||
UNIMAP_KP_7, // 0x59 | |||||
UNIMAP_F20, // 0x5A | |||||
UNIMAP_KP_8, // 0x5B | |||||
UNIMAP_KP_9, // 0x5C | |||||
UNIMAP_JYEN, // 0x5D | |||||
UNIMAP_RO, // 0x5E | |||||
UNIMAP_KP_COMMA, // 0x5F | |||||
}, | |||||
{ | |||||
UNIMAP_F5, // 0x60 | |||||
UNIMAP_F6, // 0x61 | |||||
UNIMAP_F7, // 0x62 | |||||
UNIMAP_F3, // 0x63 | |||||
UNIMAP_F8, // 0x64 | |||||
UNIMAP_F9, // 0x65 | |||||
UNIMAP_MHEN, // 0x66 | |||||
UNIMAP_F11, // 0x67 | |||||
}, | |||||
{ | |||||
UNIMAP_HENK, // 0x68 | |||||
UNIMAP_PSCREEN, // 0x69 | |||||
UNIMAP_F16, // 0x6A | |||||
UNIMAP_SCROLLLOCK, // 0x6B | |||||
UNIMAP_NO, // 0x6C | |||||
UNIMAP_F10, // 0x6D | |||||
UNIMAP_APPLICATION, // 0x6E compose | |||||
UNIMAP_F12, // 0x6F | |||||
}, | |||||
{ | |||||
UNIMAP_NO, // 0x70 | |||||
UNIMAP_PAUSE, // 0x71 | |||||
UNIMAP_INSERT, // 0x72 | |||||
UNIMAP_HOME, // 0x73 | |||||
UNIMAP_PGUP, // 0x74 | |||||
UNIMAP_DELETE, // 0x75 | |||||
UNIMAP_F4, // 0x76 | |||||
UNIMAP_END, // 0x77 | |||||
}, | |||||
{ | |||||
UNIMAP_F2, // 0x78 | |||||
UNIMAP_PGDOWN, // 0x79 | |||||
UNIMAP_F1, // 0x7A | |||||
UNIMAP_RSHIFT, // 0x7B | |||||
UNIMAP_RALT, // 0x7C | |||||
UNIMAP_RCTRL, // 0x7D | |||||
UNIMAP_RGUI, // 0x7E | |||||
UNIMAP_F24, // 0x7F power key | |||||
} | |||||
}; | |||||
#endif |
/* | |||||
Copyright 2016 Jun Wako <[email protected]> | |||||
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 "unimap_common.h" | |||||
#define AC_FN0 ACTION_LAYER_TAP_KEY(1, KC_GRV) | |||||
#define AC_FN1 ACTION_LAYER_TAP_KEY(1, KC_BSLS) | |||||
#ifdef KEYMAP_SECTION_ENABLE | |||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = { | |||||
#else | |||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = { | |||||
#endif | |||||
UNIMAP( | |||||
F13, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, F24, | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, VOLD,VOLU,MUTE, | |||||
FN0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, FN1, DEL, END, PGDN, P7, P8, P9, PMNS, | |||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PPLS, | |||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, NO, RSFT, UP, P1, P2, P3, NO, | |||||
LCTL,LGUI,LALT,NO, SPC, NO, NO, RALT,RGUI,NO, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | |||||
), | |||||
UNIMAP( | |||||
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,F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, TRNS,DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, INS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,TRNS,TRNS,HOME,PGUP,LEFT,RGHT, TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,END, PGDN,DOWN, TRNS,TRNS, PGUP, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, HOME,PGDN,END, TRNS, TRNS,TRNS | |||||
), | |||||
}; |
TARGET_DIR = . | TARGET_DIR = . | ||||
# project specific files | # project specific files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c \ | led.c \ | ||||
protocol/ibm4704.c | protocol/ibm4704.c | ||||
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
}; | }; | ||||
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
}; | }; |
/* | |||||
Copyright 2011,2012,2013 Jun Wako <[email protected]> | |||||
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)]) }; | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "action.h" | #include "action.h" | ||||
#include "action_macro.h" | #include "action_macro.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
// 32*8(256) byte array which converts PS/2 code into USB code | |||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* 107-key */ | /* 107-key */ | ||||
#define KEYMAP( \ | #define KEYMAP( \ | ||||
K46,K64, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, K47,K48,K49,K4A, \ | K46,K64, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, K47,K48,K49,K4A, \ |
ALT_TAB, | ALT_TAB, | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN), | [1] = ACTION_LAYER_TAP_KEY(2, KC_SCLN), | ||||
[2] = ACTION_LAYER_TAP_KEY(3, KC_SLASH), | [2] = ACTION_LAYER_TAP_KEY(3, KC_SLASH), |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
}; | }; |
# keyboard dependent files | # keyboard dependent files | ||||
SRC = matrix.c \ | SRC = matrix.c \ | ||||
led.c \ | led.c \ | ||||
keymap_common.c \ | |||||
m0110.c | m0110.c | ||||
# To use own keymap file run make like: make keymap=hasu | # To use own keymap file run make like: make keymap=hasu |
# keyboard dependent files | # keyboard dependent files | ||||
SRC = matrix.c \ | SRC = matrix.c \ | ||||
led.c \ | led.c \ | ||||
keymap_common.c \ | |||||
m0110.c | m0110.c | ||||
# To use own keymap file run make like: make keymap=hasu | # To use own keymap file run make like: make keymap=hasu |
# keyboard dependent files | # keyboard dependent files | ||||
SRC = matrix.c \ | SRC = matrix.c \ | ||||
led.c \ | led.c \ | ||||
keymap_common.c \ | |||||
m0110.c | m0110.c | ||||
# To use own keymap file run make like: make keymap=hasu | # To use own keymap file run make like: make keymap=hasu |
# keyboard dependent files | # keyboard dependent files | ||||
SRC = matrix.c \ | SRC = matrix.c \ | ||||
led.c \ | led.c \ | ||||
keymap_common.c \ | |||||
m0110.c | m0110.c | ||||
# To use own keymap file run make like: make keymap=hasu | # To use own keymap file run make like: make keymap=hasu |
/* | |||||
Copyright 2011,2012,2014 Jun Wako <[email protected]> | |||||
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 <stdint.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "action.h" | |||||
#include "keycode.h" | |||||
#include "keymap.h" | |||||
#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 index to action */ | |||||
action_t keymap_fn_to_action(uint8_t keycode) | |||||
{ | |||||
action_t action; | |||||
action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]); | |||||
return action; | |||||
} |
along with this program. If not, see <http://www.gnu.org/licenses/>. | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#include <stdint.h> | #include <stdint.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* Common layout for M0110 and M0110A | /* Common layout for M0110 and M0110A | ||||
* This keymap works with both keyboards. As you can see, the M0110A is | * This keymap works with both keyboards. As you can see, the M0110A is | ||||
* a superset of M0110 keyboard, only one exception is 'Enter'(34) of M0110 | * a superset of M0110 keyboard, only one exception is 'Enter'(34) of M0110 |
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
#else | #else | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
#endif | #endif | ||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[1] = ACTION_LAYER_MOMENTARY(2), | [1] = ACTION_LAYER_MOMENTARY(2), |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[1] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), | [1] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), | ||||
[2] = ACTION_LAYER_TAP_KEY(3, KC_SPACE), | [2] = ACTION_LAYER_TAP_KEY(3, KC_SPACE), |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
}; | }; |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | ||||
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | ||||
}; | }; |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | ||||
static const uint8_t PROGMEM fn_layer[] = { | |||||
const uint8_t PROGMEM fn_layer[] = { | |||||
0, // Fn0 | 0, // Fn0 | ||||
0, // Fn1 | 0, // Fn1 | ||||
0, // Fn2 | 0, // Fn2 | ||||
// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | ||||
// See layer.c for details. | // See layer.c for details. | ||||
static const uint8_t PROGMEM fn_keycode[] = { | |||||
const uint8_t PROGMEM fn_keycode[] = { | |||||
KC_NO, // Fn0 | KC_NO, // Fn0 | ||||
KC_NO, // Fn1 | KC_NO, // Fn1 | ||||
KC_NO, // Fn2 | KC_NO, // Fn2 | ||||
}; | }; | ||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* 0: default | /* 0: default | ||||
* ,---. ,------------------------, ,------------------------. ,---------. | * ,---. ,------------------------, ,------------------------. ,---------. | ||||
* |Pow| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| ,-----------. | * |Pow| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| ,-----------. | ||||
LALT,CAPS,LALT, SPC, ERAS, RALT,RGUI,RCTL, PGDN, TAB, LEFT,DOWN,RGHT | LALT,CAPS,LALT, SPC, ERAS, RALT,RGUI,RCTL, PGDN, TAB, LEFT,DOWN,RGHT | ||||
), | ), | ||||
}; | }; | ||||
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) | |||||
{ | |||||
return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); | |||||
} | |||||
uint8_t keymap_fn_layer(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_layer[index]); | |||||
} | |||||
uint8_t keymap_fn_keycode(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_keycode[index]); | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "print.h" | #include "print.h" | ||||
#include "debug.h" | #include "debug.h" | ||||
#include "keycode.h" | #include "keycode.h" | ||||
// 32*8(256) byte array which converts PS/2 code into USB code | // 32*8(256) byte array which converts PS/2 code into USB code | ||||
static const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
ACTION_LAYER_MOMENTARY(1), // FN0 - left command key | ACTION_LAYER_MOMENTARY(1), // FN0 - left command key | ||||
ACTION_LAYER_MOMENTARY(1), // FN1 - right command key | ACTION_LAYER_MOMENTARY(1), // FN1 - right command key | ||||
ACTION_KEY(KC_BSLS), // FN2 - number pad slash & backslash | ACTION_KEY(KC_BSLS), // FN2 - number pad slash & backslash | ||||
} | } | ||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* Layer 0: default | /* Layer 0: default | ||||
* ,-----------------------------------------------------------. ,-----------. ,---------------. | * ,-----------------------------------------------------------. ,-----------. ,---------------. | ||||
) | ) | ||||
}; | }; | ||||
/* 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)]) }; | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "action.h" | #include "action.h" | ||||
#include "action_macro.h" | #include "action_macro.h" | ||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* | /* | ||||
,---------------------------------------------------------------. | ,---------------------------------------------------------------. | ||||
| 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E| | | 60| 61| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 36| 37| 3F| 3E| | ||||
LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT | LGUI, LALT, LCTL, LSFT, SPC, SPC, RALT | ||||
), | ), | ||||
}; | }; | ||||
static const uint8_t PROGMEM overlays[][MATRIX_ROWS][MATRIX_COLS] = {}; | |||||
/* | /* | ||||
* Macro definition | * Macro definition | ||||
/* | /* | ||||
* Fn actions | * Fn actions | ||||
*/ | */ | ||||
static const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
ACTION_LAYER_TAP_TOGGLE(0), // FN0 | ACTION_LAYER_TAP_TOGGLE(0), // FN0 | ||||
ACTION_LAYER_TAP_KEY(1, KC_SLASH), // FN1 | ACTION_LAYER_TAP_KEY(1, KC_SLASH), // FN1 | ||||
ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN2 | ACTION_LAYER_TAP_KEY(2, KC_SCLN), // FN2 | ||||
ACTION_MACRO(RBRACKET), // FN5 | ACTION_MACRO(RBRACKET), // FN5 | ||||
ACTION_MACRO(DUMMY), // FN6 | ACTION_MACRO(DUMMY), // FN6 | ||||
}; | }; | ||||
/* | |||||
* No need to edit. | |||||
*/ | |||||
#define KEYMAPS_SIZE (sizeof(keymaps) / sizeof(keymaps[0])) | |||||
#define FN_ACTIONS_SIZE (sizeof(fn_actions) / sizeof(fn_actions[0])) | |||||
/* translates key to keycode */ | |||||
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) | |||||
{ | |||||
if (layer < KEYMAPS_SIZE) { | |||||
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); | |||||
} else { | |||||
// fall back to layer 0 | |||||
return pgm_read_byte(&keymaps[0][(key.row)][(key.col)]); | |||||
} | |||||
} | |||||
/* translates Fn keycode to action */ | |||||
action_t keymap_fn_to_action(uint8_t keycode) | |||||
{ | |||||
action_t action; | |||||
if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) { | |||||
action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]); | |||||
} else { | |||||
action.code = ACTION_NO; | |||||
} | |||||
return action; | |||||
} |
TARGET_DIR = . | TARGET_DIR = . | ||||
# project specific files | # project specific files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
OBJECTS = \ | OBJECTS = \ | ||||
$(OBJDIR)/protocol/ps2_busywait.o \ | $(OBJDIR)/protocol/ps2_busywait.o \ | ||||
$(OBJDIR)/protocol/ps2_io_mbed.o \ | $(OBJDIR)/protocol/ps2_io_mbed.o \ | ||||
$(OBJDIR)/./keymap_common.o \ | |||||
$(OBJDIR)/./matrix.o \ | $(OBJDIR)/./matrix.o \ | ||||
$(OBJDIR)/./led.o \ | $(OBJDIR)/./led.o \ | ||||
$(OBJDIR)/./main.o | $(OBJDIR)/./main.o |
TARGET_DIR = . | TARGET_DIR = . | ||||
# keyboard dependent files | # keyboard dependent files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
TARGET_DIR = . | TARGET_DIR = . | ||||
# project specific files | # project specific files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
TARGET_DIR = . | TARGET_DIR = . | ||||
# project specific files | # project specific files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
TARGET_DIR = . | TARGET_DIR = . | ||||
# keyboard dependent files | # keyboard dependent files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
/* | |||||
Copyright 2011,2012,2013 Jun Wako <[email protected]> | |||||
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" | |||||
#include "progmem.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)]) }; | |||||
} |
#include "keymap.h" | #include "keymap.h" | ||||
// 32*8(256) byte array which converts PS/2 code into USB code | |||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* All keys */ | /* All keys */ | ||||
#define KEYMAP_ALL( \ | #define KEYMAP_ALL( \ | ||||
K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ | K76,K05,K06,K04,K0C,K03,K0B,K83,K0A,K01,K09,K78,K07, KFC,K7E,KFE, \ |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
}; | }; |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
}; | }; |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | ||||
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | ||||
}; | }; |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | ||||
static const uint8_t PROGMEM fn_layer[] = { | |||||
const uint8_t PROGMEM fn_layer[] = { | |||||
2, // Fn0 | 2, // Fn0 | ||||
3, // Fn1 | 3, // Fn1 | ||||
4, // Fn2 | 4, // Fn2 | ||||
// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | ||||
// See layer.c for details. | // See layer.c for details. | ||||
static const uint8_t PROGMEM fn_keycode[] = { | |||||
const uint8_t PROGMEM fn_keycode[] = { | |||||
KC_NO, // Fn0 | KC_NO, // Fn0 | ||||
KC_SCLN, // Fn1 | KC_SCLN, // Fn1 | ||||
KC_SLSH, // Fn2 | KC_SLSH, // Fn2 | ||||
}; | }; | ||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* | /* | ||||
KEYMAP( | KEYMAP( | ||||
HELP, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12, PSCR,SLCK,PAUS, MUTE,VOLD,VOLU,PWR, | HELP, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10,F11,F12, PSCR,SLCK,PAUS, MUTE,VOLD,VOLU,PWR, | ||||
CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT | CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT | ||||
), | ), | ||||
}; | }; | ||||
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) | |||||
{ | |||||
return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); | |||||
} | |||||
uint8_t keymap_fn_layer(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_layer[index]); | |||||
} | |||||
uint8_t keymap_fn_keycode(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_keycode[index]); | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "util.h" | #include "util.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
), | ), | ||||
*/ | */ | ||||
}; | }; | ||||
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) | |||||
{ | |||||
return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); | |||||
} | |||||
uint8_t keymap_fn_layer(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_layer[index]); | |||||
} | |||||
uint8_t keymap_fn_keycode(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_keycode[index]); | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "print.h" | #include "print.h" | ||||
#include "debug.h" | #include "debug.h" | ||||
} | } | ||||
// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | // Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | ||||
static const uint8_t PROGMEM fn_layer[] = { | |||||
const uint8_t PROGMEM fn_layer[] = { | |||||
0, // Fn0 | 0, // Fn0 | ||||
0, // Fn1 | 0, // Fn1 | ||||
0, // Fn2 | 0, // Fn2 | ||||
// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | // Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | ||||
// See layer.c for details. | // See layer.c for details. | ||||
static const uint8_t PROGMEM fn_keycode[] = { | |||||
const uint8_t PROGMEM fn_keycode[] = { | |||||
KC_NO, // Fn0 | KC_NO, // Fn0 | ||||
KC_NO, // Fn1 | KC_NO, // Fn1 | ||||
KC_NO, // Fn2 | KC_NO, // Fn2 | ||||
}; | }; | ||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* 0: default | /* 0: default | ||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. | ||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | ||||
), | ), | ||||
*/ | */ | ||||
}; | }; | ||||
uint8_t keymap_get_keycode(uint8_t layer, uint8_t row, uint8_t col) | |||||
{ | |||||
return pgm_read_byte(&keymaps[(layer)][(row)][(col)]); | |||||
} | |||||
uint8_t keymap_fn_layer(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_layer[index]); | |||||
} | |||||
uint8_t keymap_fn_keycode(uint8_t index) | |||||
{ | |||||
return pgm_read_byte(&fn_keycode[index]); | |||||
} |
#OPT_DEFS += -DNO_ACTION_LAYER | #OPT_DEFS += -DNO_ACTION_LAYER | ||||
#OPT_DEFS += -DNO_ACTION_MACRO | #OPT_DEFS += -DNO_ACTION_MACRO | ||||
SRC = \ | |||||
keymap_common.c \ | |||||
usb_usb.cpp \ | |||||
SRC = usb_usb.cpp \ | |||||
main.cpp | main.cpp | ||||
ifdef KEYMAP | ifdef KEYMAP |
#endif | #endif | ||||
}; | }; | ||||
const uint16_t fn_actions[] PROGMEM = {}; | |||||
const action_t fn_actions[] PROGMEM = {}; |
/* | |||||
Copyright 2014 Jun Wako <[email protected]> | |||||
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" | |||||
#include "progmem.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)]) }; | |||||
} |
#include "keymap.h" | #include "keymap.h" | ||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* ,---------------. ,---------------. ,---------------. | /* ,---------------. ,---------------. ,---------------. | ||||
* |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| | * |F13|F14|F15|F16| |F17|F18|F19|F20| |F21|F22|F23|F24| | ||||
* ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. | * ,---. |---------------| |---------------| |---------------| ,-----------. ,---------------. ,-------. |
), | ), | ||||
}; | }; | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[1] = ACTION_LAYER_MOMENTARY(2), | [1] = ACTION_LAYER_MOMENTARY(2), | ||||
[2] = ACTION_LAYER_MOMENTARY(3), | [2] = ACTION_LAYER_MOMENTARY(3), |
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
#else | #else | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
#endif | #endif | ||||
[0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used) | [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used) | ||||
[1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps) | [1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps) |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
}; | }; |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
}; | }; |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | ||||
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | ||||
}; | }; |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "action.h" | #include "action.h" | ||||
#include "util.h" | #include "util.h" | ||||
} | } | ||||
static const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
[0] = ACTION_FUNCTION(0), // toggle all LEDs | [0] = ACTION_FUNCTION(0), // toggle all LEDs | ||||
}; | }; | ||||
} | } | ||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* X68000 Keyboard Scan codes | /* X68000 Keyboard Scan codes | ||||
,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------. | ,---. ,---. ,-------------------, ,-------------------. ,-----------. ,---------------. | ||||
| 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54| | | 61| | 62| | 63| 64| 65| 66| 67| | 68| 69| 6A| 6B| 6C| | 5A| 5B| 5C| | 5D| 52| 53| 54| | ||||
LGUI,LALT,MHEN, SPC, HENK,KANA,APP, ZKHK, F14, F15, P0, PCMM,PDOT | LGUI,LALT,MHEN, SPC, HENK,KANA,APP, ZKHK, F14, F15, P0, PCMM,PDOT | ||||
), | ), | ||||
}; | }; | ||||
/* 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)]) }; | |||||
} |
TARGET_DIR = . | TARGET_DIR = . | ||||
# project specific files | # project specific files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
/* | |||||
Copyright 2011,2012,2013 Jun Wako <[email protected]> | |||||
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" | |||||
#include "progmem.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)]) }; | |||||
} |
#include "keymap.h" | #include "keymap.h" | ||||
// 32*8(256) byte array which converts PS/2 code into USB code | |||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* All keys */ | /* All keys */ | ||||
#define KEYMAP_ALL( \ | #define KEYMAP_ALL( \ | ||||
K00, K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D, K0E,K0F,K0G, \ | K00, K02,K03,K04,K05,K06,K07,K08,K09,K0A,K0B,K0C,K0D, K0E,K0F,K0G, \ |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
}; | }; |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
}; | }; |
), | ), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | ||||
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | ||||
}; | }; |
KEYMAP_FILE = actionmap | KEYMAP_FILE = actionmap | ||||
else | else | ||||
KEYMAP_FILE = keymap | KEYMAP_FILE = keymap | ||||
SRC := keymap_common.c $(SRC) | |||||
endif | endif | ||||
ifdef KEYMAP | ifdef KEYMAP | ||||
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) | SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) |
#include <avr/pgmspace.h> | |||||
#include "actionmap.h" | #include "actionmap.h" | ||||
#include "action_code.h" | #include "action_code.h" | ||||
#include "actionmap_common.h" | #include "actionmap_common.h" | ||||
} | } | ||||
const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const action_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* Default Layer | /* Default Layer | ||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | | * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | |
#include <avr/pgmspace.h> | |||||
#include "actionmap.h" | #include "actionmap.h" | ||||
#include "action_code.h" | #include "action_code.h" | ||||
#include "actionmap_common.h" | #include "actionmap_common.h" | ||||
#define AC_LM1 ACTION_LAYER_MOMENTARY(1) // HHKB layer | #define AC_LM1 ACTION_LAYER_MOMENTARY(1) // HHKB layer | ||||
const uint16_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
const action_t PROGMEM actionmaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
/* Default Layer | /* Default Layer | ||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BSpc | | * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|BSpc | |
/* | |||||
Copyright 2012,2013 Jun Wako <[email protected]> | |||||
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)]) }; | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "action.h" | #include "action.h" | ||||
#include "action_macro.h" | #include "action_macro.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* Alps64 keymap definition macro */ | /* Alps64 keymap definition macro */ | ||||
#define KEYMAP( \ | #define KEYMAP( \ | ||||
K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K26, K27, \ | K36, K37, K46, K47, K56, K57, K66, K67, K76, K77, K06, K07, K17, K26, K27, \ |
}; | }; | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
#else | #else | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
#endif | #endif | ||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[1] = ACTION_LAYER_MOMENTARY(2), | [1] = ACTION_LAYER_MOMENTARY(2), |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), // HHKB layer | [0] = ACTION_LAYER_MOMENTARY(1), // HHKB layer | ||||
[1] = ACTION_LAYER_TAP_KEY(1, KC_ENTER), // HHKB layer | [1] = ACTION_LAYER_TAP_KEY(1, KC_ENTER), // HHKB layer | ||||
[2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash* | [2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash* |
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), | TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS), | ||||
}; | }; | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
}; | }; |
TARGET_DIR = . | TARGET_DIR = . | ||||
# project specific files | # project specific files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
/* | |||||
Copyright 2012,2013 Jun Wako <[email protected]> | |||||
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)]) }; | |||||
} |
#include <stdint.h> | #include <stdint.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | #include "keycode.h" | ||||
#include "action.h" | #include "action.h" | ||||
#include "action_macro.h" | #include "action_macro.h" | ||||
#include "keymap.h" | #include "keymap.h" | ||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
/* GH60 keymap definition macro | /* GH60 keymap definition macro | ||||
* K2C, K31 and K3C are extra keys for ISO | * K2C, K31 and K3C are extra keys for ISO | ||||
*/ | */ |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_MOMENTARY(4), | [0] = ACTION_LAYER_MOMENTARY(4), | ||||
[1] = ACTION_LAYER_TAP_KEY(5, KC_SLASH), | [1] = ACTION_LAYER_TAP_KEY(5, KC_SLASH), | ||||
[2] = ACTION_LAYER_TAP_KEY(6, KC_SCLN), | [2] = ACTION_LAYER_TAP_KEY(6, KC_SCLN), |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
}; | }; |
LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, \ | LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, \ | ||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL), | LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = {}; | |||||
const action_t PROGMEM fn_actions[] = {}; |
TRNS,TRNS,TRNS,FN6, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS, \ | TRNS,TRNS,TRNS,FN6, 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[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
/* Poker Layout */ | /* Poker Layout */ | ||||
[0] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay | [0] = ACTION_LAYER_MOMENTARY(6), // to Fn overlay | ||||
[1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay | [1] = ACTION_LAYER_TOGGLE(4), // toggle arrow overlay |
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ | TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, UP, \ | ||||
TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), | TRNS,TRNS,TRNS, TRNS, TRNS,LEFT,DOWN,RGHT), | ||||
}; | }; | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
/* Poker Layout */ | /* Poker Layout */ | ||||
[0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc) | [0] = ACTION_LAYER_BIT_XOR(1, 0b0101, ON_BOTH), // Poker Fn(with fix for Esc) | ||||
[1] = ACTION_LAYER_TOGGLE(5), // Poker Arrow toggle | [1] = ACTION_LAYER_TOGGLE(5), // Poker Arrow toggle |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
/* Poker Layout */ | /* Poker Layout */ | ||||
[0] = ACTION_LAYER_SET(4, ON_PRESS), // FN0 move to Fn'd when press | [0] = ACTION_LAYER_SET(4, ON_PRESS), // FN0 move to Fn'd when press | ||||
[1] = ACTION_LAYER_SET(5, ON_PRESS), // FN1 move to Fn'd arrow when press | [1] = ACTION_LAYER_SET(5, ON_PRESS), // FN1 move to Fn'd arrow when press |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | [0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE), | ||||
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | ||||
}; | }; |
# List C source files here. (C dependencies are automatically generated.) | # List C source files here. (C dependencies are automatically generated.) | ||||
SRC += keymap_common.c \ | |||||
matrix.c \ | |||||
SRC += matrix.c \ | |||||
led.c | led.c | ||||
CONFIG_H = config.h | CONFIG_H = config.h | ||||
NKRO_ENABLE = yes # USB Nkey Rollover | NKRO_ENABLE = yes # USB Nkey Rollover | ||||
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor | #KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor | ||||
#HHKB_JP = yes # HHKB JP support | #HHKB_JP = yes # HHKB JP support | ||||
#UNIMAP_ENABLE = yes | |||||
#ACTIONMAP_ENABLE = yes # Use 16bit actionmap instead of 8bit keymap | |||||
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor | |||||
#OPT_DEFS += -DNO_ACTION_TAPPING | #OPT_DEFS += -DNO_ACTION_TAPPING | ||||
#OPT_DEFS += -DNO_ACTION_LAYER | #OPT_DEFS += -DNO_ACTION_LAYER | ||||
# | # | ||||
# Keymap file | # Keymap file | ||||
# | # | ||||
ifdef UNIMAP_ENABLE | |||||
KEYMAP_FILE = unimap | |||||
else | |||||
ifdef ACTIONMAP_ENABLE | |||||
KEYMAP_FILE = actionmap | |||||
else | |||||
KEYMAP_FILE = keymap | |||||
endif | |||||
endif | |||||
ifdef KEYMAP | ifdef KEYMAP | ||||
SRC := keymap_$(KEYMAP).c $(SRC) | |||||
SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC) | |||||
else | else | ||||
ifdef HHKB_JP | ifdef HHKB_JP | ||||
SRC := keymap_jp.c $(SRC) | |||||
SRC := $(KEYMAP_FILE)_jp.c $(SRC) | |||||
else | else | ||||
SRC := keymap_hhkb.c $(SRC) | |||||
SRC := $(KEYMAP_FILE)_hhkb.c $(SRC) | |||||
endif | endif | ||||
endif | endif | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# keyboard dependent files | # keyboard dependent files | ||||
SRC = keymap_common.c \ | |||||
matrix.c \ | |||||
SRC = matrix.c \ | |||||
led.c | led.c | ||||
ifdef KEYMAP | ifdef KEYMAP |
# List C source files here. (C dependencies are automatically generated.) | # List C source files here. (C dependencies are automatically generated.) | ||||
SRC += keymap_common.c \ | |||||
matrix.c \ | |||||
SRC += matrix.c \ | |||||
led.c | led.c | ||||
CONFIG_H = config_rn42.h | CONFIG_H = config_rn42.h |
HHKB_JP = yes | |||||
UNIMAP_ENABLE = yes | |||||
KEYMAP_SECTION_ENABLE = yes | |||||
include Makefile |
/* | |||||
Copyright 2012,2013 Jun Wako <[email protected]> | |||||
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 <stdint.h> | |||||
#include "action.h" | |||||
#include <avr/pgmspace.h> | |||||
#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)]) }; | |||||
} |
#include "keymap.h" | #include "keymap.h" | ||||
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; | |||||
extern const uint16_t fn_actions[]; | |||||
#define KEYMAP( \ | #define KEYMAP( \ | ||||
K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \ | K31, K30, K00, K10, K11, K20, K21, K40, K41, K60, K61, K70, K71, K50, K51, \ | ||||
K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \ | K32, K01, K02, K13, K12, K23, K22, K42, K43, K62, K63, K73, K72, K52, \ |
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
#else | #else | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
#endif | #endif | ||||
[0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used) | [0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used) | ||||
[1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps) | [1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps) |
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[1] = ACTION_LAYER_MOMENTARY(2), | [1] = ACTION_LAYER_MOMENTARY(2), | ||||
[2] = ACTION_LAYER_MOMENTARY(3), | [2] = ACTION_LAYER_MOMENTARY(3), | ||||
[31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), | [31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSLASH), | ||||
}; | }; | ||||
#else | #else | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
}; | }; | ||||
#endif | #endif |
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
const action_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | |||||
#else | #else | ||||
const uint16_t fn_actions[] PROGMEM = { | |||||
const action_t fn_actions[] PROGMEM = { | |||||
#endif | #endif | ||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
}; | }; |
/* | /* | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t PROGMEM fn_actions[] = { | |||||
const action_t PROGMEM fn_actions[] = { | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | [0] = ACTION_LAYER_MOMENTARY(1), | ||||
[1] = ACTION_LAYER_TAP_KEY(2, KC_SPACE), | [1] = ACTION_LAYER_TAP_KEY(2, KC_SPACE), | ||||
[2] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde | [2] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde |
/* | |||||
Copyright 2016 Jun Wako <[email protected]> | |||||
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 UNIMAP_COMMON_H | |||||
#define UNIMAP_COMMON_H | |||||
#include <stdint.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "unimap.h" | |||||
/* HHKB JP | |||||
* ,-----------------------------------------------------------. | |||||
* |` |1 |2 |3 |4 |5 |6 |7 |8 |9 |0 |- |= |JPY|BS | | |||||
* |-----------------------------------------------------------| | |||||
* |Tab |Q |W |E |R |T |Y |U |I |O |P |[ |] |Enter| | |||||
* |------------------------------------------------------` | | |||||
* |Caps |A |S |D |F |G |H |J |K |L |; |' |# | | | |||||
* |-----------------------------------------------------------| | |||||
* |Shift |Z |X |C |V |B |N |M |, |. |/ |Ro |Up |Shi| | |||||
* |-----------------------------------------------------------| | |||||
* |Ctl||Esc|Gui|Alt|Mhn| |Hen|Kan|Alt|Ctl||Lef|Dow|Rig| | |||||
* `-----------------------------------------------------------' | |||||
* Esc = Grave(`) | |||||
* Control = Caps Lock | |||||
* Left Fn = Left Control | |||||
* Right Fn = Right Control | |||||
*/ | |||||
// row:16 x col:8 | |||||
const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = { | |||||
// 0 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_GRAVE, | |||||
UNIMAP_TAB, | |||||
UNIMAP_LCTRL, | |||||
UNIMAP_LSHIFT, | |||||
UNIMAP_CAPSLOCK, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 1 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_4, | |||||
UNIMAP_E, | |||||
UNIMAP_MHEN, | |||||
UNIMAP_C, | |||||
UNIMAP_D, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 2 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_3, | |||||
UNIMAP_W, | |||||
UNIMAP_LALT, | |||||
UNIMAP_X, | |||||
UNIMAP_S, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 3 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_1, | |||||
UNIMAP_NO, | |||||
UNIMAP_ESCAPE, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 4 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 5 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_5, | |||||
UNIMAP_R, | |||||
UNIMAP_NO, | |||||
UNIMAP_V, | |||||
UNIMAP_F, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 6 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_2, | |||||
UNIMAP_Q, | |||||
UNIMAP_LGUI, | |||||
UNIMAP_Z, | |||||
UNIMAP_A, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 7 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_6, | |||||
UNIMAP_T, | |||||
UNIMAP_SPACE, | |||||
UNIMAP_B, | |||||
UNIMAP_G, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 8 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_9, | |||||
UNIMAP_I, | |||||
UNIMAP_KANA, | |||||
UNIMAP_COMMA, | |||||
UNIMAP_K, | |||||
UNIMAP_NO, | |||||
}, | |||||
// 9 | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_8, | |||||
UNIMAP_U, | |||||
UNIMAP_HENK, | |||||
UNIMAP_M, | |||||
UNIMAP_J, | |||||
UNIMAP_NO, | |||||
}, | |||||
// A | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_7, | |||||
UNIMAP_Y, | |||||
UNIMAP_NO, | |||||
UNIMAP_N, | |||||
UNIMAP_H, | |||||
UNIMAP_NO, | |||||
}, | |||||
// B | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_0, | |||||
UNIMAP_O, | |||||
UNIMAP_RALT, | |||||
UNIMAP_DOT, | |||||
UNIMAP_L, | |||||
UNIMAP_NO, | |||||
}, | |||||
// C | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_BSPACE, | |||||
UNIMAP_NO, | |||||
UNIMAP_RIGHT, | |||||
UNIMAP_RSHIFT, | |||||
UNIMAP_ENTER, | |||||
UNIMAP_NO, | |||||
}, | |||||
// D | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_JYEN, | |||||
UNIMAP_RBRACKET, | |||||
UNIMAP_DOWN, | |||||
UNIMAP_UP, | |||||
UNIMAP_NONUS_HASH, | |||||
UNIMAP_NO, | |||||
}, | |||||
// E | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_MINUS, | |||||
UNIMAP_P, | |||||
UNIMAP_RCTRL, | |||||
UNIMAP_SLASH, | |||||
UNIMAP_SCOLON, | |||||
UNIMAP_NO, | |||||
}, | |||||
// F | |||||
{ | |||||
UNIMAP_NO, | |||||
UNIMAP_NO, | |||||
UNIMAP_EQUAL, | |||||
UNIMAP_LBRACKET, | |||||
UNIMAP_LEFT, | |||||
UNIMAP_RO, | |||||
UNIMAP_QUOTE, | |||||
UNIMAP_NO, | |||||
}, | |||||
}; | |||||
#endif |
/* | |||||
Copyright 2016 Jun Wako <[email protected]> | |||||
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 "unimap_common.h" | |||||
#define AC_FN0 ACTION_LAYER_MOMENTARY(1) | |||||
#ifdef KEYMAP_SECTION_ENABLE | |||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] __attribute__ ((section (".keymap.keymaps"))) = { | |||||
#else | |||||
const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = { | |||||
#endif | |||||
UNIMAP( | |||||
NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, | |||||
ZKHK, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, | |||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, JYEN,BSPC, NO, NO, NO, NO, NO, NO, NO, | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, NO, NO, NO, NO, NO, NO, NO, | |||||
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, NO, NO, NO, NO, | |||||
LSFT,NO, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, NO, NO, NO, NO, | |||||
FN0, LGUI,LALT,MHEN, SPC, HENK,KANA,RALT,NO, NO, FN0, LEFT,DOWN,RGHT, NO, NO, NO | |||||
), | |||||
UNIMAP( | |||||
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, | |||||
PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS,UP, TRNS, TRNS, TRNS,TRNS,TRNS, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT, TRNS,PENT, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN, TRNS,TRNS, PGUP, TRNS,TRNS,TRNS,TRNS, | |||||
TRNS,TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, HOME,PGDN,END, TRNS, TRNS,TRNS | |||||
), | |||||
}; |
OBJECTS = \ | OBJECTS = \ | ||||
$(OBJDIR)/matrix.o \ | $(OBJDIR)/matrix.o \ | ||||
$(OBJDIR)/keymap_common.o \ | |||||
$(OBJDIR)/led.o \ | $(OBJDIR)/led.o \ | ||||
$(OBJDIR)/main.o | $(OBJDIR)/main.o | ||||