Conflicts: common.mk common/action.c common/avr/suspend.c common/command.c common/keyboard.c keyboard/gh60/Makefile keyboard/gh60/Makefile.pjrcexp
[submodule "protocol/lufa/LUFA-git"] | |||||
path = protocol/lufa/LUFA-git | |||||
url = https://github.com/abcminiuser/lufa.git | |||||
[submodule "protocol/usb_hid/USB_Host_Shield_2.0"] | |||||
path = protocol/usb_hid/USB_Host_Shield_2.0 | |||||
url = https://github.com/felis/USB_Host_Shield_2.0.git |
Source code is available here: <http://github.com/tmk/tmk_keyboard> | Source code is available here: <http://github.com/tmk/tmk_keyboard> | ||||
Updates | |||||
------- | |||||
#### 2015/04/22 | |||||
Core library was separated to other branch `core`. <https://github.com/tmk/tmk_keyboard/tree/core> | |||||
In `Makefile` you need to set `TMK_DIR` to indicate core library location now. | |||||
TMK_DIR = ../../tmk_core | |||||
Features | Features | ||||
-------- | -------- | ||||
These features can be used in your keyboard. | These features can be used in your keyboard. | ||||
* Backlight - Control backlight levels | * Backlight - Control backlight levels | ||||
Projects | Projects | ||||
-------- | -------- | ||||
You can find some keyboard specific projects under `converter` and `keyboard` directory. | You can find some keyboard specific projects under `converter` and `keyboard` directory. | ||||
License | License | ||||
------- | ------- | ||||
**GPLv2** or later. Some protocol files are under **Modified BSD License**. | **GPLv2** or later. Some protocol files are under **Modified BSD License**. | ||||
LUFA, PJRC and V-USB stack have their own license respectively. | |||||
Third party libraries like LUFA, PJRC and V-USB have their own license respectively. | |||||
-------------- | -------------- | ||||
To see help press `Magic` + `H`. | To see help press `Magic` + `H`. | ||||
`Magic` key bind may be `LShift` + `RShift` in many project, but `Power` key on ADB converter. `Magic` keybind can be vary on each project, check `config.h` in project directory. | |||||
`Magic` key combination is `LShift` + `RShift` in many project, but `Power` key on ADB converter. | |||||
`Magic` keybind can be vary on each project, check `config.h` in project directory. | |||||
Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed. | Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed. | ||||
Caps: Lock Keyboard(Child Proof) | Caps: Lock Keyboard(Child Proof) | ||||
Paus: jump to bootloader | Paus: jump to bootloader | ||||
**TBD** | |||||
### Boot Magic Configuration - Virtual DIP Switch | |||||
Boot Magic Configuration - Virtual DIP Switch | |||||
--------------------------------------------- | |||||
Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable. | Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable. | ||||
Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles. | Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles. | ||||
To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [common/bootmagic.h](common/bootmagic.h). | |||||
To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [tmk_core/common/bootmagic.h](tmk_core/common/bootmagic.h). | |||||
#### General | #### General | ||||
- Skip reading EEPROM to start with default configuration(`ESC`) | - Skip reading EEPROM to start with default configuration(`ESC`) | ||||
- Set Default Layer to 6(`6`) | - Set Default Layer to 6(`6`) | ||||
- Set Default Layer to 7(`7`) | - Set Default Layer to 7(`7`) | ||||
#### Caution | |||||
Unintentional use of this feature will cause user confusion. | |||||
TODO: Magic key combination to avoid unintentional press during plug in | |||||
**TBD** | |||||
Mechanical Locking support | Mechanical Locking support | ||||
-------------------------- | -------------------------- | ||||
This feature makes it possible for you to use mechanical switch for `CapsLock`, `NumLock` or `ScrollLock`. To enable this feature define these macros in `config.h` and use `KC_LCAP`, `KC_LNUM` or `KC_LSCR` in keymap for locking key instead of normal `KC_CAPS`, `KC_NLCK` or `KC_SLCK`. Resync option tries to keep lock switch state consistent with keyboard LED state. | |||||
This feature makes it possible for you to use mechanical locking switch for `CapsLock`, `NumLock` | |||||
or `ScrollLock`. To enable this feature define these macros in `config.h` and use `KC_LCAP`, `KC_LN | |||||
UM` or `KC_LSCR` in keymap for locking key instead of normal `KC_CAPS`, `KC_NLCK` or `KC_SLCK`. Res | |||||
ync option tries to keep switch state consistent with keyboard LED state. | |||||
#define LOCKING_SUPPORT_ENABLE | #define LOCKING_SUPPORT_ENABLE | ||||
#define LOCKING_RESYNC_ENABLE | #define LOCKING_RESYNC_ENABLE | ||||
Start Your Own Project | Start Your Own Project | ||||
----------------------- | ----------------------- | ||||
**TBD** | **TBD** | ||||
### Config.h Options | |||||
#### 1. USB vendor/product ID and device description | |||||
#define VENDOR_ID 0xFEED | |||||
#define PRODUCT_ID 0xBEEF | |||||
#define MANUFACTURER t.m.k. | |||||
#define PRODUCT Macway mod | |||||
#define DESCRIPTION t.m.k. keyboard firmware for Macway mod | |||||
#### 2. Keyboard matrix configuration | |||||
#define MATRIX_ROWS 8 | |||||
#define MATRIX_COLS 8 | |||||
#define MATRIX_HAS_GHOST | |||||
Architecture | |||||
------------ | |||||
Architecture Diagram | |||||
+---------------+---------------+-------------+ | |||||
| Host | Keyboard | Matrix, LED | | |||||
___________ |-----------+-+ +-------------+ | +-----------| | |||||
/ /| Keys/Mouse | Protocol |d| | Action | | | Protocol | | |||||
/__________/ |<-----------| LUFA |r| | Layer, Tap | | | Matrix | | |||||
|.--------.| | LED | V-USB |i| |-------------| | | PS/2,IBM | __________________ | |||||
|| || |----------->| PJRC |v| | Keymap | | | ADB,M0110| Keys / /_/_/_/_/_/_/_/ /| | |||||
|| Host || | Console | iWRAP(BT)|e| | Mousekey | | | SUN/NEWS |<----------/ /_/_/_/_/_/_/_/ / / | |||||
||________||/.<-----------| UART |r| | Report | | | X68K/PC98| Control / /_/_/_/_/_/_/_/ / / | |||||
`_========_'/| |---------------------------------------------|-------->/___ /_______/ ___/ / | |||||
|_o______o_|/ | Sendchar, Print, Debug, Command, ... | |_________________|/ | |||||
+---------------------------------------------+ Keyboard | |||||
-------- | -------- | ||||
Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack. | Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack. | ||||
You can use xprintf() to display debug info on `hid_listen`, see `common/xprintf.h`. | |||||
You can use xprintf() to display debug info on `hid_listen`, see `tmk_core/common/xprintf.h`. | |||||
Files and Directories | Files and Directories | ||||
------------------- | ------------------- | ||||
### Top | ### Top | ||||
* common/ - common codes | |||||
* protocol/ - keyboard protocol support | |||||
* tmk_core/ - core library | |||||
* keyboard/ - keyboard projects | * keyboard/ - keyboard projects | ||||
* converter/ - protocol converter projects | * converter/ - protocol converter projects | ||||
* doc/ - documents | * doc/ - documents | ||||
* common.mk - Makefile for common | |||||
* protocol.mk - Makefile for protocol | |||||
* rules.mk - Makefile for build rules | |||||
### Common | |||||
* host.h | |||||
* host_driver.h | |||||
* keyboard.h | |||||
* command.h | |||||
* keymap.h | |||||
* action.h | |||||
* keycode.h | |||||
* matrix.h | |||||
* led.h | |||||
* mousekey.h | |||||
* report.h | |||||
* debug.h | |||||
* print.h | |||||
* bootloader.h | |||||
* sendchar.h | |||||
* timer.h | |||||
* util.h | |||||
### Keyboard Protocols | |||||
* lufa/ - LUFA USB stack | |||||
* pjrc/ - PJRC USB stack | |||||
* vusb/ - Objective Development V-USB | |||||
* iwrap/ - Bluetooth HID for Bluegiga iWRAP | |||||
* ps2.c - PS/2 protocol | |||||
* adb.c - Apple Desktop Bus protocol | |||||
* m0110.c - Macintosh 128K/512K/Plus keyboard protocol | |||||
* news.c - Sony NEWS keyboard protocol | |||||
* x68k.c - Sharp X68000 keyboard protocol | |||||
* serial_soft.c - Asynchronous Serial protocol implemented by software | |||||
#include <avr/io.h> | |||||
#include <avr/interrupt.h> | |||||
#include "led.h" | |||||
#include "breathing_led.h" | |||||
#include "debug.h" | |||||
#define BREATHING_LED_TIMER_TOP F_CPU/256 | |||||
static uint8_t breathing_led_duration = 0; | |||||
void breathing_led_init(void) | |||||
{ | |||||
#ifdef BREATHING_LED_TIMER1 | |||||
/* Timer1 setup */ | |||||
/* CTC mode */ | |||||
TCCR1B |= (1<<WGM12); | |||||
/* Clock selelct: clk/8 */ | |||||
TCCR1B |= (1<<CS10); | |||||
/* Set TOP value */ | |||||
uint8_t sreg = SREG; | |||||
cli(); | |||||
OCR1AH = (BREATHING_LED_TIMER_TOP>>8)&0xff; | |||||
OCR1AL = BREATHING_LED_TIMER_TOP&0xff; | |||||
#else | |||||
/* Timer3 setup */ | |||||
/* CTC mode */ | |||||
TCCR3B |= (1<<WGM32); | |||||
/* Clock selelct: clk/8 */ | |||||
TCCR3B |= (1<<CS30); | |||||
/* Set TOP value */ | |||||
uint8_t sreg = SREG; | |||||
cli(); | |||||
OCR3AH = (BREATHING_LED_TIMER_TOP>>8)&0xff; | |||||
OCR3AL = BREATHING_LED_TIMER_TOP&0xff; | |||||
#endif | |||||
SREG = sreg; | |||||
} | |||||
void breathing_led_enable(void) | |||||
{ | |||||
/* Enable Compare Match Interrupt */ | |||||
#ifdef BREATHING_LED_TIMER1 | |||||
TIMSK1 |= (1<<OCIE1A); | |||||
dprintf("breathing led on: %u\n", TIMSK1 & (1<<OCIE1A)); | |||||
#else | |||||
TIMSK3 |= (1<<OCIE3A); | |||||
dprintf("breathing led on: %u\n", TIMSK3 & (1<<OCIE3A)); | |||||
#endif | |||||
} | |||||
void breathing_led_disable(void) | |||||
{ | |||||
/* Disable Compare Match Interrupt */ | |||||
#ifdef BREATHING_LED_TIMER1 | |||||
TIMSK1 &= ~(1<<OCIE1A); | |||||
dprintf("breathing led off: %u\n", TIMSK1 & (1<<OCIE1A)); | |||||
#else | |||||
TIMSK3 &= ~(1<<OCIE3A); | |||||
dprintf("breathing led off: %u\n", TIMSK3 & (1<<OCIE3A)); | |||||
#endif | |||||
} | |||||
void breathing_led_toggle(void) | |||||
{ | |||||
/* Disable Compare Match Interrupt */ | |||||
#ifdef BREATHING_LED_TIMER1 | |||||
TIMSK1 ^= (1<<OCIE1A); | |||||
dprintf("breathing led toggle: %u\n", TIMSK1 & (1<<OCIE1A)); | |||||
#else | |||||
TIMSK3 ^= (1<<OCIE3A); | |||||
dprintf("breathing led toggle: %u\n", TIMSK3 & (1<<OCIE3A)); | |||||
#endif | |||||
} | |||||
void breathing_led_set_duration(uint8_t dur) | |||||
{ | |||||
breathing_led_duration = dur; | |||||
dprintf("breathing led set duration: %u\n", breathing_led_duration); | |||||
} | |||||
/* Breathing LED brighness(PWM On period) table | |||||
* | |||||
* http://www.wolframalpha.com/input/?i=Table%5Bfloor%28%28exp%28sin%28x%2F256*2*pi%2B3%2F2*pi%29%29-1%2Fe%29*%28256%2F%28e-1%2Fe%29%29%29%2C+%7Bx%2C0%2C255%2C1%7D%5D | |||||
* Table[floor((exp(sin(x/256*2*pi+3/2*pi))-1/e)*(256/(e-1/e))), {x,0,255,1}] | |||||
* (0..255).each {|x| print ((exp(sin(x/256.0*2*PI+3.0/2*PI))-1/E)*(256/(E-1/E))).to_i, ', ' } | |||||
*/ | |||||
static const uint8_t breathing_table[256] PROGMEM = { | |||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 32, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 56, 58, 61, 63, 66, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 102, 105, 108, 112, 116, 119, 123, 126, 130, 134, 138, 142, 145, 149, 153, 157, 161, 165, 169, 173, 176, 180, 184, 188, 192, 195, 199, 203, 206, 210, 213, 216, 219, 223, 226, 228, 231, 234, 236, 239, 241, 243, 245, 247, 248, 250, 251, 252, 253, 254, 255, 255, 255, 255, 255, 255, 255, 254, 253, 252, 251, 250, 248, 247, 245, 243, 241, 239, 236, 234, 231, 228, 226, 223, 219, 216, 213, 210, 206, 203, 199, 195, 192, 188, 184, 180, 176, 173, 169, 165, 161, 157, 153, 149, 145, 142, 138, 134, 130, 126, 123, 119, 116, 112, 108, 105, 102, 98, 95, 92, 89, 86, 83, 80, 77, 74, 71, 68, 66, 63, 61, 58, 56, 53, 51, 49, 47, 45, 43, 41, 39, 37, 35, 34, 32, 30, 29, 27, 26, 25, 23, 22, 21, 19, 18, 17, 16, 15, 14, 13, 12, 11, 11, 10, 9, 8, 8, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 | |||||
}; | |||||
#ifdef BREATHING_LED_TIMER1 | |||||
ISR(TIMER1_COMPA_vect) | |||||
#else | |||||
ISR(TIMER3_COMPA_vect) | |||||
#endif | |||||
{ | |||||
static uint8_t index = 0; | |||||
static uint8_t step = 0; | |||||
step++; | |||||
if (step > breathing_led_duration) { | |||||
step = 0; | |||||
breathing_led_set_raw(pgm_read_byte(&breathing_table[index])); | |||||
index++; | |||||
} | |||||
} |
#ifndef BREATHING_LED_H | |||||
#define BREATHING_LED_H | |||||
#ifdef BREATHING_LED_ENABLE | |||||
void breathing_led_init(void); | |||||
void breathing_led_enable(void); | |||||
void breathing_led_disable(void); | |||||
void breathing_led_toggle(void); | |||||
void breathing_led_set_duration(uint8_t dur); | |||||
void breathing_led_set_raw(uint8_t raw); | |||||
#else | |||||
#define breathing_led_init() | |||||
#define breathing_led_enable() | |||||
#define breathing_led_disable() | |||||
#define breathing_led_toggle() | |||||
#define breathing_led_set_duration() | |||||
#define breathing_led_set_raw() | |||||
#endif | |||||
#endif |
/* | |||||
Copyright 2013,2014 Kai Ryu <[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 <avr/pgmspace.h> | |||||
#include <avr/eeprom.h> | |||||
#include "eeconfig.h" | |||||
#include "keymap_in_eeprom.h" | |||||
#include "matrix.h" | |||||
#include "debug.h" | |||||
#ifdef KEYMAP_IN_EEPROM_ENABLE | |||||
void keymap_in_eeprom_init(void) { | |||||
if (!check_keymap_in_eeprom()) { | |||||
write_keymap_to_eeprom(); | |||||
} | |||||
} | |||||
void keymap_in_eeprom_disable(void) { | |||||
eeprom_write_word(EECONFIG_KEYMAP_CHECKSUM, eeprom_read_word(EECONFIG_KEYMAP_CHECKSUM) + 1); | |||||
} | |||||
bool check_keymap_in_eeprom(void) { | |||||
uint16_t checksum_in_eeprom = eeprom_read_word(EECONFIG_KEYMAP_CHECKSUM); | |||||
uint16_t checksum = EECONFIG_MAGIC_NUMBER; | |||||
for (uint16_t i = 0; i < KEYMAP_SIZE; i++) { | |||||
uint8_t byte = eeprom_read_byte((uint8_t *)EECONFIG_KEYMAP_FN_ACTIONS + i); | |||||
uint16_t word = (i & 1) ? byte << 8 : byte; | |||||
checksum += word; | |||||
} | |||||
#ifdef DEBUG | |||||
eeprom_write_word(EECONFIG_KEYMAP_DEBUG, checksum); | |||||
#endif | |||||
return (checksum_in_eeprom == checksum); | |||||
} | |||||
void write_keymap_to_eeprom(void) { | |||||
uint16_t checksum = EECONFIG_MAGIC_NUMBER; | |||||
const uint16_t *fn_actions = fn_actions_pointer(); | |||||
const uint8_t *keymaps = keymaps_pointer(); | |||||
// write fn_actions | |||||
if (fn_actions != NULL) { | |||||
uint16_t fn_actions_count_in_flash = fn_actions_count(); | |||||
for (uint16_t i = 0; i < FN_ACTIONS_COUNT; i++) { | |||||
uint16_t fn_action = 0; | |||||
if (i < fn_actions_count_in_flash) { | |||||
fn_action = pgm_read_word(fn_actions + i); | |||||
} | |||||
eeconfig_write_keymap_fn_action(i, fn_action); | |||||
checksum += fn_action; | |||||
} | |||||
} | |||||
// write keymaps | |||||
if (keymaps != NULL) { | |||||
uint16_t keys_count_in_flash = keys_count(); | |||||
for (uint16_t i = 0; i < KEYS_COUNT; i++) { | |||||
uint8_t keymap = 0; | |||||
if (i < keys_count_in_flash) { | |||||
keymap = pgm_read_byte(keymaps + i); | |||||
} | |||||
eeconfig_write_keymap_key_by_index(i, keymap); | |||||
uint16_t keymap_word = keymap; | |||||
if (i & 1) { | |||||
keymap_word = keymap << 8; | |||||
} | |||||
checksum += keymap_word; | |||||
} | |||||
} | |||||
// write checksum | |||||
eeprom_write_word(EECONFIG_KEYMAP_CHECKSUM, checksum); | |||||
} | |||||
uint16_t eeconfig_read_keymap_fn_action(uint8_t index) { | |||||
return eeprom_read_word(EECONFIG_KEYMAP_FN_ACTIONS + index); | |||||
} | |||||
void eeconfig_write_keymap_fn_action(uint8_t index, uint16_t fn_action) { | |||||
return eeprom_write_word(EECONFIG_KEYMAP_FN_ACTIONS + index, fn_action); | |||||
} | |||||
uint8_t eeconfig_read_keymap_key(uint8_t layer, uint8_t row, uint8_t col) { | |||||
return eeprom_read_byte(EECONFIG_KEYMAP_KEYMAPS + KEY_OFFSET(layer, row, col)); | |||||
} | |||||
void eeconfig_write_keymap_key(uint8_t layer, uint8_t row, uint8_t col, uint8_t key) { | |||||
return eeprom_write_byte(EECONFIG_KEYMAP_KEYMAPS + KEY_OFFSET(layer, row, col), key); | |||||
} | |||||
uint8_t eeconfig_read_keymap_key_by_index(uint16_t index) { | |||||
return eeprom_read_byte(EECONFIG_KEYMAP_KEYMAPS + index); | |||||
} | |||||
void eeconfig_write_keymap_key_by_index(uint16_t index, uint8_t key) { | |||||
return eeprom_write_byte(EECONFIG_KEYMAP_KEYMAPS + index, key); | |||||
} | |||||
#endif |
/* | |||||
Copyright 2013,2014 Kai Ryu <[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 KEYMAP_IN_EEPROM_H | |||||
#define KEYMAP_IN_EEPROM_H | |||||
#ifdef KEYMAP_IN_EEPROM_ENABLE | |||||
#include <stdint.h> | |||||
#include <stdbool.h> | |||||
#ifndef EECONFIG_KEYMAP_IN_EEPROM | |||||
#define EECONFIG_KEYMAP_IN_EEPROM 0x10 | |||||
#endif | |||||
#ifndef FN_ACTIONS_COUNT | |||||
#define FN_ACTIONS_COUNT 32 | |||||
#endif | |||||
#ifndef KEYMAPS_COUNT | |||||
#define KEYMAPS_COUNT 1 | |||||
#endif | |||||
#ifndef MATRIX_SIZE | |||||
#define MATRIX_SIZE (matrix_rows() * matrix_cols()) | |||||
#endif | |||||
#define KEYS_COUNT (KEYMAPS_COUNT * MATRIX_SIZE) | |||||
typedef struct { | |||||
uint16_t checksum; | |||||
uint16_t fn_actions[FN_ACTIONS_COUNT]; | |||||
uint8_t keymaps[KEYMAPS_COUNT][MATRIX_ROWS][MATRIX_COLS]; | |||||
} keymap_in_eeprom_t; | |||||
#define EECONFIG_KEYMAP_CHECKSUM (uint16_t *)(EECONFIG_KEYMAP_IN_EEPROM) | |||||
#define EECONFIG_KEYMAP_FN_ACTIONS (uint16_t *)(EECONFIG_KEYMAP_CHECKSUM + 1) | |||||
#define EECONFIG_KEYMAP_KEYMAPS (uint8_t *)(EECONFIG_KEYMAP_FN_ACTIONS + FN_ACTIONS_COUNT) | |||||
#define EECONFIG_KEYMAP_DEBUG (uint16_t *)(EECONFIG_KEYMAP_CHECKSUM - 1) | |||||
#define KEYMAP_SIZE (sizeof(uint16_t) * FN_ACTIONS_COUNT + sizeof(uint8_t) * KEYS_COUNT) | |||||
#define KEYMAP_WORD_SIZE ((KEYMAP_SIZE + 1) / 2) | |||||
#define KEY_OFFSET(layer, row, col) (layer * matrix_rows() * matrix_cols() + row * matrix_cols() + col) | |||||
void keymap_in_eeprom_init(void); | |||||
void keymap_in_eeprom_disable(void); | |||||
bool check_keymap_in_eeprom(void); | |||||
void write_keymap_to_eeprom(void); | |||||
uint8_t eeconfig_read_keymap_key(uint8_t layer, uint8_t row, uint8_t col); | |||||
void eeconfig_write_keymap_key(uint8_t layer, uint8_t row, uint8_t col, uint8_t key); | |||||
uint8_t eeconfig_read_keymap_key_by_index(uint16_t index); | |||||
void eeconfig_write_keymap_key_by_index(uint16_t index, uint8_t key); | |||||
uint16_t eeconfig_read_keymap_fn_action(uint8_t index); | |||||
void eeconfig_write_keymap_fn_action(uint8_t index, uint16_t fn_action); | |||||
const uint8_t* keymaps_pointer(void); | |||||
const uint16_t* fn_actions_pointer(void); | |||||
uint16_t keys_count(void); | |||||
uint16_t fn_actions_count(void); | |||||
#endif | |||||
#endif |
/* | |||||
Copyright 2013,2014 Kai Ryu <[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 <avr/io.h> | |||||
#include <avr/interrupt.h> | |||||
#include <util/delay.h> | |||||
#include "led_matrix.h" | |||||
#define LED_MATRIX_TIMER_TOP F_CPU/(256*64)/LED_MATRIX_ROWS | |||||
static led_matrix_element_t led_matrix[LED_MATRIX_ROWS][LED_MATRIX_COLS]; | |||||
void led_matrix_init(void) | |||||
{ | |||||
led_matrix_unselect_rows(); | |||||
led_matrix_write_cols(0); | |||||
/* Timer1 setup */ | |||||
/* CTC mode */ | |||||
TCCR1B |= (1<<WGM12); | |||||
/* Clock selelct: clk/1 */ | |||||
TCCR1B |= (1<<CS10); | |||||
/* Set TOP value */ | |||||
uint8_t sreg = SREG; | |||||
cli(); | |||||
OCR1AH = (LED_MATRIX_TIMER_TOP >> 8) & 0xFF; | |||||
OCR1AL = LED_MATRIX_TIMER_TOP & 0xFF; | |||||
SREG = sreg; | |||||
} | |||||
void led_matrix_enable(void) | |||||
{ | |||||
/* Enable Compare Match Interrupt */ | |||||
TIMSK1 |= _BV(OCIE1A); | |||||
} | |||||
void led_matrix_disable(void) | |||||
{ | |||||
/* Disable Compare Match Interrupt */ | |||||
TIMSK1 &= ~_BV(OCIE1A); | |||||
} | |||||
inline | |||||
led_matrix_row_t led_matrix_make_cols(uint8_t row, uint8_t pwm) | |||||
{ | |||||
led_matrix_row_t cols = 0; | |||||
for (uint8_t i = 0; i < LED_MATRIX_COLS; i++) { | |||||
cols |= ((led_matrix[row][i].value < pwm ? 1 : 0) << i); | |||||
} | |||||
return cols; | |||||
} | |||||
inline | |||||
void led_matrix_set_value(uint8_t row, uint8_t col, uint8_t value) | |||||
{ | |||||
led_matrix[row][col].value = value; | |||||
} | |||||
inline | |||||
void led_matrix_set_delta(uint8_t row, uint8_t col, int8_t delta) | |||||
{ | |||||
led_matrix[row][col].delta = delta; | |||||
} | |||||
ISR(TIMER1_COMPA_vect) | |||||
{ | |||||
static uint8_t row = 0; | |||||
static uint8_t pwm = 0; | |||||
row = (row + 1) % LED_MATRIX_ROWS; | |||||
pwm++; | |||||
led_matrix_select_row(row); | |||||
_delay_us(10); | |||||
led_matrix_write_cols(led_matrix_make_cols(row, pwm)); | |||||
_delay_us(10); | |||||
led_matrix_unselect_rows(); | |||||
} |
/* | |||||
Copyright 2013,2014 Kai Ryu <[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 LED_MATRIX_H | |||||
#define LED_MATRIX_H | |||||
#include <stdint.h> | |||||
#include <stdbool.h> | |||||
#if (LED_MATRIX_COLS <= 8) | |||||
typedef uint8_t led_matrix_row_t; | |||||
#elif (LED_MATRIX_COLS <= 16) | |||||
typedef uint16_t led_matrix_row_t; | |||||
#elif (LED_MATRIX_COLS <= 32) | |||||
typedef uint32_t led_matrix_row_t; | |||||
#else | |||||
#error "LED_MATRIX_COLS: invalid value" | |||||
#endif | |||||
typedef struct { | |||||
union { | |||||
int8_t delta; | |||||
struct { | |||||
bool direction:1; | |||||
}; | |||||
}; | |||||
uint8_t value; | |||||
} led_matrix_element_t; | |||||
#ifdef LED_MATRIX_ENABLE | |||||
void led_matrix_init(void); | |||||
void led_matrix_enable(void); | |||||
void led_matrix_disable(void); | |||||
void led_matrix_init_cols(void); | |||||
led_matrix_row_t led_matrix_make_cols(uint8_t row, uint8_t pwm); | |||||
void led_matrix_set_value(uint8_t row, uint8_t col, uint8_t value); | |||||
void led_matrix_set_delta(uint8_t row, uint8_t col, int8_t delta); | |||||
extern void led_matrix_write_cols(led_matrix_row_t cols); | |||||
extern void led_matrix_unselect_rows(void); | |||||
extern void led_matrix_select_row(uint8_t row); | |||||
#else | |||||
#define led_matrix_init() | |||||
#define led_matrix_enable() | |||||
#define led_matrix_disable() | |||||
#define led_matrix_init_cols() | |||||
#define led_matrix_write_cols() | |||||
#define led_matrix_unselect_rows() | |||||
#define led_matrix_select_row() | |||||
#endif | |||||
#endif |
#include "ledmap.h" | |||||
#include "ledmap_in_eeprom.h" | |||||
#include "led.h" | |||||
#include "softpwm_led.h" | |||||
#include "action_layer.h" | |||||
#include "debug.h" | |||||
static led_state_t led_state_last = 0; | |||||
static led_binding_t usb_led_binding = 0; | |||||
static led_binding_t default_layer_binding = 0; | |||||
static led_binding_t layer_binding = 0; | |||||
static led_binding_t backlight_binding = 0; | |||||
static led_binding_t reverse_binding = 0; | |||||
static void update_led_state(led_state_t state, uint8_t force); | |||||
void ledmap_init(void) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
ledmap_t ledmap = ledmap_get_code(i); | |||||
if (ledmap.reverse) { | |||||
LED_BIT_SET(reverse_binding, i); | |||||
} | |||||
if (ledmap.backlight) { | |||||
LED_BIT_SET(backlight_binding, i); | |||||
} | |||||
switch (ledmap.binding) { | |||||
case LEDMAP_BINDING_DEFAULT_LAYER: | |||||
LED_BIT_SET(default_layer_binding, i); | |||||
break; | |||||
case LEDMAP_BINDING_LAYER: | |||||
LED_BIT_SET(layer_binding, i); | |||||
break; | |||||
case LEDMAP_BINDING_USB_LED: | |||||
LED_BIT_SET(usb_led_binding, i); | |||||
break; | |||||
} | |||||
} | |||||
ledmap_led_init(); | |||||
update_led_state(0, 1); | |||||
} | |||||
void led_set(uint8_t usb_led) | |||||
{ | |||||
if (usb_led_binding) { | |||||
led_state_t led_state = led_state_last; | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
if (usb_led_binding & LED_BIT(i)) { | |||||
uint8_t param = ledmap_get_code(i).param; | |||||
(usb_led & (1 << param)) ? LED_BIT_SET(led_state, i) : LED_BIT_CLEAR(led_state, i); | |||||
} | |||||
} | |||||
update_led_state(led_state, 0); | |||||
} | |||||
} | |||||
#ifndef NO_ACTION_LAYER | |||||
void default_layer_state_change(uint32_t state) | |||||
{ | |||||
if (default_layer_binding) { | |||||
led_state_t led_state = led_state_last; | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
if (default_layer_binding & LED_BIT(i)) { | |||||
uint8_t param = ledmap_get_code(i).param; | |||||
(state & (1UL << param)) ? LED_BIT_SET(led_state, i) : LED_BIT_CLEAR(led_state, i); | |||||
} | |||||
} | |||||
update_led_state(led_state, 0); | |||||
} | |||||
} | |||||
void layer_state_change(uint32_t state) | |||||
{ | |||||
if (layer_binding) { | |||||
led_state_t led_state = led_state_last; | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
if (layer_binding & LED_BIT(i)) { | |||||
uint8_t param = ledmap_get_code(i).param; | |||||
(state & (1UL << param)) ? LED_BIT_SET(led_state, i) : LED_BIT_CLEAR(led_state, i); | |||||
} | |||||
} | |||||
update_led_state(led_state, 0); | |||||
} | |||||
} | |||||
#endif | |||||
#ifdef SOFTPWM_LED_ENABLE | |||||
void softpwm_led_init(void) | |||||
{ | |||||
} | |||||
void softpwm_led_on(uint8_t index) | |||||
{ | |||||
if (backlight_binding & LED_BIT(index)) { | |||||
ledmap_led_on(index); | |||||
} | |||||
} | |||||
void softpwm_led_off(uint8_t index) | |||||
{ | |||||
if (backlight_binding & LED_BIT(index)) { | |||||
ledmap_led_off(index); | |||||
} | |||||
} | |||||
void softpwm_led_state_change(uint8_t state) | |||||
{ | |||||
if (state) { | |||||
} | |||||
else { | |||||
update_led_state(led_state_last, 1); | |||||
} | |||||
} | |||||
#endif | |||||
void update_led_state(led_state_t state, uint8_t force) | |||||
{ | |||||
led_state_t diff = led_state_last ^ state; | |||||
if (force || diff) { | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
if (softpwm_led_get_state() && (backlight_binding & LED_BIT(i))) { | |||||
continue; | |||||
} | |||||
if (force || diff & LED_BIT(i)) { | |||||
if ((state ^ reverse_binding) & LED_BIT(i)) { | |||||
ledmap_led_on(i); | |||||
} | |||||
else { | |||||
ledmap_led_off(i); | |||||
} | |||||
} | |||||
} | |||||
led_state_last = state; | |||||
} | |||||
} |
#ifndef LEDMAP_H | |||||
#define LEDMAP_H | |||||
#include "stdint.h" | |||||
#include "stdbool.h" | |||||
#include "led.h" | |||||
typedef led_pack_t led_state_t; | |||||
typedef led_pack_t led_binding_t; | |||||
enum ledmap_binding { | |||||
LEDMAP_BINDING_NO = 0, | |||||
LEDMAP_BINDING_DEFAULT_LAYER, | |||||
LEDMAP_BINDING_LAYER, | |||||
LEDMAP_BINDING_USB_LED | |||||
}; | |||||
enum ledmap_usb_led { | |||||
LEDMAP_USB_LED_NUM_LOCK = 0, | |||||
LEDMAP_USB_LED_CAPS_LOCK, | |||||
LEDMAP_USB_LED_SCROLL_LOCK, | |||||
LEDMAP_USB_LED_COMPOSE, | |||||
LEDMAP_USB_LED_KANA, | |||||
}; | |||||
typedef union { | |||||
uint16_t code; | |||||
struct { | |||||
uint8_t param: 8; | |||||
uint8_t binding: 4; | |||||
bool reverse: 1; | |||||
bool backlight: 1; | |||||
uint8_t reserved: 2; | |||||
}; | |||||
} ledmap_t; | |||||
#define LEDMAP_DEFAULT_LAYER(layer) (LEDMAP_BINDING_DEFAULT_LAYER<<8 | layer) | |||||
#define LEDMAP_LAYER(layer) (LEDMAP_BINDING_LAYER<<8 | layer ) | |||||
#define LEDMAP_NUM_LOCK (LEDMAP_BINDING_USB_LED<<8 | LEDMAP_USB_LED_NUM_LOCK) | |||||
#define LEDMAP_CAPS_LOCK (LEDMAP_BINDING_USB_LED<<8 | LEDMAP_USB_LED_CAPS_LOCK) | |||||
#define LEDMAP_SCROLL_LOCK (LEDMAP_BINDING_USB_LED<<8 | LEDMAP_USB_LED_SCROLL_LOCK) | |||||
#define LEDMAP_REVERSE (1<<12) | |||||
#define LEDMAP_BACKLIGHT (1<<13) | |||||
void ledmap_init(void); | |||||
#ifdef LEDMAP_ENABLE | |||||
ledmap_t ledmap_get_code(uint8_t index); | |||||
void ledmap_led_init(void); | |||||
void ledmap_led_on(uint8_t index); | |||||
void ledmap_led_off(uint8_t index); | |||||
#else | |||||
#define ledmap_get_code() | |||||
#define ledmap_led_init() | |||||
#define ledmap_led_on() | |||||
#define ledmap_led_off() | |||||
#endif | |||||
#endif |
#include <avr/pgmspace.h> | |||||
#include <avr/eeprom.h> | |||||
#include "ledmap_in_eeprom.h" | |||||
#ifdef LEDMAP_IN_EEPROM_ENABLE | |||||
#undef ledmap_get_code | |||||
static ledmap_t ledmap[LED_COUNT]; | |||||
void ledmap_in_eeprom_init(void) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
ledmap[i].code = eeprom_read_word(EECONFIG_LEDMAP + i); | |||||
/* ledmap[i].code = LEDMAP_UNCONFIGURED; */ | |||||
if (ledmap[i].code == LEDMAP_UNCONFIGURED) { | |||||
ledmap[i] = ledmap_get_code(i); | |||||
eeprom_write_word(EECONFIG_LEDMAP + i, ledmap[i].code); | |||||
} | |||||
} | |||||
} | |||||
void write_ledmap_to_eeprom(void) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
eeprom_write_word(EECONFIG_LEDMAP + i, ledmap_get_code(i).code); | |||||
} | |||||
} | |||||
ledmap_t ledmap_in_eeprom_get_code(uint8_t i) | |||||
{ | |||||
return ledmap[i]; | |||||
} | |||||
#endif |
#ifndef LEDMAP_IN_EEPROM_H | |||||
#define LEDMAP_IN_EEPROM_H | |||||
#include "ledmap.h" | |||||
#ifndef EECONFIG_LEDMAP_IN_EEPROM | |||||
#define EECONFIG_LEDMAP_IN_EEPROM 7 | |||||
#endif | |||||
#define EECONFIG_LEDMAP (uint16_t*)EECONFIG_LEDMAP_IN_EEPROM | |||||
#define LEDMAP_SIZE (sizeof(uint16_t) * LED_COUNT) | |||||
#define LEDMAP_UNCONFIGURED 0xFFFF | |||||
#ifdef LEDMAP_IN_EEPROM_ENABLE | |||||
#define ledmap_get_code ledmap_in_eeprom_get_code | |||||
void ledmap_in_eeprom_init(void); | |||||
void write_ledmap_to_eeprom(void); | |||||
ledmap_t ledmap_in_eeprom_get_code(uint8_t index); | |||||
#else | |||||
#define ledmap_in_eeprom_init() | |||||
#define write_ledmap_to_eeprom() | |||||
#define ledmap_in_eeprom_get_code() | |||||
#endif | |||||
#endif |
#include <avr/io.h> | |||||
#include <avr/interrupt.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "led.h" | |||||
#include "softpwm_led.h" | |||||
#include "debug.h" | |||||
#define SOFTPWM_LED_FREQ 64 | |||||
#define SOFTPWM_LED_TIMER_TOP F_CPU / (256 * SOFTPWM_LED_FREQ) | |||||
static uint8_t softpwm_led_state = 0; | |||||
static uint8_t softpwm_led_ocr[LED_COUNT] = {0}; | |||||
static uint8_t softpwm_led_ocr_buff[LED_COUNT] = {0}; | |||||
#ifdef FADING_LED_ENABLE | |||||
static void fading_led_proc(void); | |||||
#else | |||||
#define fading_led_proc() | |||||
#endif | |||||
#ifdef BREATHING_LED_ENABLE | |||||
static void breathing_led_proc(void); | |||||
#else | |||||
#define fading_led_proc() | |||||
#endif | |||||
void softpwm_init(void) | |||||
{ | |||||
#ifdef SOFTPWM_LED_TIMER3 | |||||
/* Timer3 setup */ | |||||
/* CTC mode */ | |||||
TCCR3B |= (1<<WGM32); | |||||
/* Clock selelct: clk/8 */ | |||||
TCCR3B |= (1<<CS30); | |||||
/* Set TOP value */ | |||||
uint8_t sreg = SREG; | |||||
cli(); | |||||
OCR3AH = (SOFTPWM_LED_TIMER_TOP >> 8) & 0xff; | |||||
OCR3AL = SOFTPWM_LED_TIMER_TOP & 0xff; | |||||
SREG = sreg; | |||||
#else | |||||
/* Timer1 setup */ | |||||
/* CTC mode */ | |||||
TCCR1B |= (1<<WGM12); | |||||
/* Clock selelct: clk/8 */ | |||||
TCCR1B |= (1<<CS10); | |||||
/* Set TOP value */ | |||||
uint8_t sreg = SREG; | |||||
cli(); | |||||
OCR1AH = (SOFTPWM_LED_TIMER_TOP >> 8) & 0xff; | |||||
OCR1AL = SOFTPWM_LED_TIMER_TOP & 0xff; | |||||
SREG = sreg; | |||||
#endif | |||||
softpwm_led_init(); | |||||
} | |||||
void softpwm_led_enable(void) | |||||
{ | |||||
/* Enable Compare Match Interrupt */ | |||||
#ifdef SOFTPWM_LED_TIMER3 | |||||
TIMSK3 |= (1<<OCIE3A); | |||||
//dprintf("softpwm led on: %u\n", TIMSK3 & (1<<OCIE3A)); | |||||
#else | |||||
TIMSK1 |= (1<<OCIE1A); | |||||
//dprintf("softpwm led on: %u\n", TIMSK1 & (1<<OCIE1A)); | |||||
#endif | |||||
softpwm_led_state = 1; | |||||
#ifdef LEDMAP_ENABLE | |||||
softpwm_led_state_change(softpwm_led_state); | |||||
#endif | |||||
} | |||||
void softpwm_led_disable(void) | |||||
{ | |||||
/* Disable Compare Match Interrupt */ | |||||
#ifdef SOFTPWM_LED_TIMER3 | |||||
TIMSK3 &= ~(1<<OCIE3A); | |||||
//dprintf("softpwm led off: %u\n", TIMSK3 & (1<<OCIE3A)); | |||||
#else | |||||
TIMSK1 &= ~(1<<OCIE1A); | |||||
//dprintf("softpwm led off: %u\n", TIMSK1 & (1<<OCIE1A)); | |||||
#endif | |||||
softpwm_led_state = 0; | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
softpwm_led_off(i); | |||||
} | |||||
#ifdef LEDMAP_ENABLE | |||||
softpwm_led_state_change(softpwm_led_state); | |||||
#endif | |||||
} | |||||
void softpwm_led_toggle(void) | |||||
{ | |||||
if (softpwm_led_state) { | |||||
softpwm_led_disable(); | |||||
} | |||||
else { | |||||
softpwm_led_enable(); | |||||
} | |||||
} | |||||
void softpwm_led_set(uint8_t index, uint8_t val) | |||||
{ | |||||
softpwm_led_ocr_buff[index] = val; | |||||
} | |||||
void softpwm_led_set_all(uint8_t val) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
softpwm_led_ocr_buff[i] = val; | |||||
} | |||||
} | |||||
void softpwm_led_increase(uint8_t index, uint8_t offset) | |||||
{ | |||||
if (softpwm_led_ocr_buff[index] > 0xFF - offset) { | |||||
softpwm_led_ocr_buff[index] = 0xFF; | |||||
} | |||||
else { | |||||
softpwm_led_ocr_buff[index] += offset; | |||||
} | |||||
} | |||||
void softpwm_led_increase_all(uint8_t offset) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
softpwm_led_increase(i, offset); | |||||
} | |||||
} | |||||
void softpwm_led_decrease(uint8_t index, uint8_t offset) | |||||
{ | |||||
if (softpwm_led_ocr_buff[index] < offset) { | |||||
softpwm_led_ocr_buff[index] = 0; | |||||
} | |||||
else { | |||||
softpwm_led_ocr_buff[index] -= offset; | |||||
} | |||||
} | |||||
void softpwm_led_decrease_all(uint8_t offset) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
softpwm_led_decrease(i, offset); | |||||
} | |||||
} | |||||
inline uint8_t softpwm_led_get_state(void) | |||||
{ | |||||
return softpwm_led_state; | |||||
} | |||||
#ifdef FADING_LED_ENABLE | |||||
static led_pack_t fading_led_state = 0; | |||||
static led_pack_t fading_led_direction = 0; | |||||
static uint8_t fading_led_duration = 0; | |||||
static uint8_t fading_led_delay[LED_COUNT] = {0}; | |||||
void fading_led_enable(uint8_t index) | |||||
{ | |||||
LED_BIT_SET(fading_led_state, index); | |||||
} | |||||
void fading_led_enable_all(void) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
LED_BIT_SET(fading_led_state, i); | |||||
} | |||||
} | |||||
void fading_led_disable(uint8_t index) | |||||
{ | |||||
LED_BIT_CLEAR(fading_led_state, index); | |||||
} | |||||
void fading_led_disable_all(void) | |||||
{ | |||||
fading_led_state = 0; | |||||
} | |||||
void fading_led_toggle(uint8_t index) | |||||
{ | |||||
LED_BIT_XOR(fading_led_state, index); | |||||
} | |||||
void fading_led_toggle_all(void) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
LED_BIT_XOR(fading_led_state, i); | |||||
} | |||||
} | |||||
void fading_led_set_direction(uint8_t index, uint8_t dir) | |||||
{ | |||||
if (dir) { | |||||
LED_BIT_SET(fading_led_direction, index); | |||||
} | |||||
else { | |||||
LED_BIT_CLEAR(fading_led_direction, index); | |||||
} | |||||
} | |||||
void fading_led_set_direction_all(uint8_t dir) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
fading_led_set_direction(i, dir); | |||||
} | |||||
} | |||||
void fading_led_set_duration(uint8_t dur) | |||||
{ | |||||
fading_led_duration = dur; | |||||
} | |||||
void fading_led_set_delay(uint8_t index, uint8_t delay) | |||||
{ | |||||
fading_led_delay[index] = delay; | |||||
} | |||||
void fading_led_set_delay_all(uint8_t delay) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
fading_led_delay[i] = delay; | |||||
} | |||||
} | |||||
#endif | |||||
#ifdef BREATHING_LED_ENABLE | |||||
/* Breathing LED brighness(PWM On period) table | |||||
* | |||||
* http://www.wolframalpha.com/input/?i=Table%5Bfloor%28%28exp%28sin%28x%2F256*2*pi%2B3%2F2*pi%29%29-1%2Fe%29*%28256%2F%28e-1%2Fe%29%29%29%2C+%7Bx%2C0%2C255%2C1%7D%5D | |||||
* Table[floor((exp(sin(x/256*2*pi+3/2*pi))-1/e)*(256/(e-1/e))), {x,0,255,1}] | |||||
* (0..255).each {|x| print ((exp(sin(x/256.0*2*PI+3.0/2*PI))-1/E)*(256/(E-1/E))).to_i, ', ' } | |||||
*/ | |||||
static const uint8_t breathing_table[128] PROGMEM = { | |||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 29, 30, 32, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 56, 58, 61, 63, 66, 68, 71, 74, 77, 80, 83, 86, 89, 92, 95, 98, 102, 105, 108, 112, 116, 119, 123, 126, 130, 134, 138, 142, 145, 149, 153, 157, 161, 165, 169, 173, 176, 180, 184, 188, 192, 195, 199, 203, 206, 210, 213, 216, 219, 223, 226, 228, 231, 234, 236, 239, 241, 243, 245, 247, 248, 250, 251, 252, 253, 254, 255, 255, 255 | |||||
}; | |||||
static led_pack_t breathing_led_state = 0; | |||||
static led_pack_t breathing_led_once = 0; | |||||
static uint8_t breathing_led_duration = 0; | |||||
static uint8_t breathing_led_index[LED_COUNT] = {0}; | |||||
static led_pack_t breathing_led_direction = 0; | |||||
void breathing_led_enable(uint8_t index) | |||||
{ | |||||
LED_BIT_SET(breathing_led_state, index); | |||||
} | |||||
void breathing_led_enable_once(uint8_t index) | |||||
{ | |||||
LED_BIT_SET(breathing_led_state, index); | |||||
LED_BIT_SET(breathing_led_once, index); | |||||
} | |||||
void breathing_led_enable_all(void) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
LED_BIT_SET(breathing_led_state, i); | |||||
} | |||||
} | |||||
void breathing_led_disable(uint8_t index) | |||||
{ | |||||
LED_BIT_CLEAR(breathing_led_state, index); | |||||
} | |||||
void breathing_led_disable_all(void) | |||||
{ | |||||
breathing_led_state = 0; | |||||
} | |||||
void breathing_led_toggle(uint8_t index) | |||||
{ | |||||
LED_BIT_XOR(breathing_led_state, index); | |||||
} | |||||
void breathing_led_toggle_all(void) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
LED_BIT_XOR(breathing_led_state, i); | |||||
} | |||||
} | |||||
void breathing_led_set_duration(uint8_t dur) | |||||
{ | |||||
breathing_led_duration = dur; | |||||
} | |||||
void breathing_led_set_index(uint8_t index, uint8_t value) | |||||
{ | |||||
if (value & 0x80) { | |||||
LED_BIT_SET(breathing_led_direction, index); | |||||
} | |||||
else { | |||||
LED_BIT_CLEAR(breathing_led_direction, index); | |||||
} | |||||
breathing_led_index[index] = value & 0x7F; | |||||
} | |||||
void breathing_led_set_index_all(uint8_t value) | |||||
{ | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
breathing_led_set_index(i, value); | |||||
} | |||||
} | |||||
#endif | |||||
#ifdef SOFTPWM_LED_TIMER3 | |||||
ISR(TIMER3_COMPA_vect) | |||||
#else | |||||
ISR(TIMER1_COMPA_vect) | |||||
#endif | |||||
{ | |||||
static uint8_t pwm = 0; | |||||
pwm++; | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
// LED on | |||||
if (pwm == 0) { | |||||
if (softpwm_led_ocr[i]) softpwm_led_on(i); | |||||
softpwm_led_ocr[i] = softpwm_led_ocr_buff[i]; | |||||
} | |||||
// LED off | |||||
if (pwm == softpwm_led_ocr[i]) { | |||||
softpwm_led_off(i); | |||||
} | |||||
} | |||||
#if defined(FADING_LED_ENABLE) || defined(BREATHING_LED_ENABLE) || defined(CUSTOM_LED_ENABLE) | |||||
static uint8_t counter = 0; | |||||
if (++counter >= SOFTPWM_LED_FREQ) { | |||||
counter = 0; | |||||
#ifdef FADING_LED_ENABLE | |||||
fading_led_proc(); | |||||
#endif | |||||
#ifdef BREATHING_LED_ENABLE | |||||
breathing_led_proc(); | |||||
#endif | |||||
#if CUSTOM_LED_ENABLE | |||||
softpwm_led_custom(); | |||||
#endif | |||||
} | |||||
#endif | |||||
} | |||||
#ifdef FADING_LED_ENABLE | |||||
void fading_led_proc(void) | |||||
{ | |||||
static uint8_t step = 0; | |||||
if (fading_led_state) { | |||||
if (++step > fading_led_duration) { | |||||
step = 0; | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
if (fading_led_state & LED_BIT(i)) { | |||||
if (fading_led_delay[i]) { | |||||
fading_led_delay[i]--; | |||||
} | |||||
else { | |||||
if (fading_led_direction & LED_BIT(i)) { | |||||
softpwm_led_decrease(i, 1); | |||||
} | |||||
else { | |||||
softpwm_led_increase(i, 1); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
#ifdef CUSTOM_LED_ENABLE | |||||
fading_led_custom(softpwm_led_ocr); | |||||
#endif | |||||
} | |||||
} | |||||
} | |||||
#endif | |||||
#ifdef BREATHING_LED_ENABLE | |||||
void breathing_led_proc(void) | |||||
{ | |||||
static uint8_t step = 0; | |||||
if (breathing_led_state) { | |||||
if (++step > breathing_led_duration) { | |||||
step = 0; | |||||
for (uint8_t i = 0; i < LED_COUNT; i++) { | |||||
if (breathing_led_state & LED_BIT(i)) { | |||||
softpwm_led_ocr_buff[i] = pgm_read_byte(&breathing_table[breathing_led_index[i]]); | |||||
if (breathing_led_direction & LED_BIT(i)) { | |||||
if (breathing_led_index[i] == 0) { | |||||
LED_BIT_CLEAR(breathing_led_direction, i); | |||||
if (breathing_led_once & LED_BIT(i)) { | |||||
LED_BIT_CLEAR(breathing_led_state, i); | |||||
LED_BIT_CLEAR(breathing_led_once, i); | |||||
} | |||||
} | |||||
else { | |||||
breathing_led_index[i]--; | |||||
} | |||||
} | |||||
else { | |||||
if (breathing_led_index[i] == 127) { | |||||
LED_BIT_SET(breathing_led_direction, i); | |||||
} | |||||
else { | |||||
breathing_led_index[i]++; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
#ifdef CUSTOM_LED_ENABLE | |||||
breathing_led_custom(softpwm_led_ocr); | |||||
#endif | |||||
} | |||||
} | |||||
} | |||||
#endif |
#ifndef SOFTPWM_LED_H | |||||
#define SOFTPWM_LED_H | |||||
#include "stdint.h" | |||||
#include "led.h" | |||||
#ifdef SOFTPWM_LED_ENABLE | |||||
void softpwm_init(void); | |||||
void softpwm_led_init(void); | |||||
void softpwm_led_enable(void); | |||||
void softpwm_led_disable(void); | |||||
void softpwm_led_toggle(void); | |||||
void softpwm_led_set(uint8_t index, uint8_t val); | |||||
void softpwm_led_set_all(uint8_t val); | |||||
void softpwm_led_increase(uint8_t index, uint8_t offset); | |||||
void softpwm_led_increase_all(uint8_t offset); | |||||
void softpwm_led_decrease(uint8_t index, uint8_t offset); | |||||
void softpwm_led_decrease_all(uint8_t offset); | |||||
void softpwm_led_on(uint8_t index); | |||||
void softpwm_led_off(uint8_t index); | |||||
uint8_t softpwm_led_get_state(void); | |||||
void softpwm_led_state_change(uint8_t state); | |||||
enum { | |||||
FADING_LED_FADE_IN = 0, | |||||
FADING_LED_FADE_OUT | |||||
}; | |||||
#ifdef FADING_LED_ENABLE | |||||
void fading_led_enable(uint8_t index); | |||||
void fading_led_enable_all(void); | |||||
void fading_led_disable(uint8_t index); | |||||
void fading_led_disable_all(void); | |||||
void fading_led_toggle(uint8_t index); | |||||
void fading_led_toggle_all(void); | |||||
void fading_led_set_direction(uint8_t index, uint8_t dir); | |||||
void fading_led_set_direction_all(uint8_t dir); | |||||
void fading_led_set_duration(uint8_t dur); | |||||
void fading_led_set_delay(uint8_t index, uint8_t delay); | |||||
void fading_led_set_delay_all(uint8_t delay); | |||||
#else | |||||
#define fading_led_enable() | |||||
#define fading_led_enable_all() | |||||
#define fading_led_disable() | |||||
#define fading_led_disable_all() | |||||
#define fading_led_toggle() | |||||
#define fading_led_toggle_all() | |||||
#define fading_led_set_direction() | |||||
#define fading_led_set_direction_all() | |||||
#define fading_led_set_duration() | |||||
#define fading_led_set_delay() | |||||
#define fading_led_set_delay_all() | |||||
#endif | |||||
#ifdef BREATHING_LED_ENABLE | |||||
#define breathing_led_init() | |||||
void breathing_led_enable(uint8_t index); | |||||
void breathing_led_enable_once(uint8_t index); | |||||
void breathing_led_enable_all(void); | |||||
void breathing_led_disable(uint8_t index); | |||||
void breathing_led_disable_all(void); | |||||
void breathing_led_toggle(uint8_t index); | |||||
void breathing_led_toggle_all(void); | |||||
void breathing_led_set_duration(uint8_t dur); | |||||
void breathing_led_set_index(uint8_t index, uint8_t value); | |||||
void breathing_led_set_index_all(uint8_t value); | |||||
void breathing_led_set_delay(uint8_t index, uint8_t delay); | |||||
void breathing_led_set_delay_all(uint8_t delay); | |||||
#else | |||||
#define breathing_led_init() | |||||
#define breathing_led_enable() | |||||
#define breathing_led_enable_all() | |||||
#define breathing_led_disable() | |||||
#define breathing_led_disable_all() | |||||
#define breathing_led_toggle() | |||||
#define breathing_led_toggle_all() | |||||
#define breathing_led_set_duration() | |||||
#define breathing_led_set_index() | |||||
#define breathing_led_set_index_all() | |||||
#define breathing_led_set_delay() | |||||
#define breathing_led_set_delay_all() | |||||
#endif | |||||
#ifdef CUSTOM_LED_ENABLE | |||||
void softpwm_led_custom(void); | |||||
void fading_led_custom(uint8_t *value); | |||||
void breathing_led_custom(uint8_t *value); | |||||
#else | |||||
#define custom_led_proc() | |||||
#endif | |||||
#else | |||||
#define softpwm_init() | |||||
#define softpwm_led_init() | |||||
#define softpwm_led_enable() | |||||
#define softpwm_led_disable() | |||||
#define softpwm_led_toggle() | |||||
#define softpwm_led_set() | |||||
#define softpwm_led_set_all() | |||||
#define softpwm_led_increase() | |||||
#define softpwm_led_increase_all() | |||||
#define softpwm_led_decrease() | |||||
#define softpwm_led_decrease_all() | |||||
#define softpwm_led_on() | |||||
#define softpwm_led_off() | |||||
#define softpwm_led_get_state() | |||||
#define softpwm_led_state_change() | |||||
#endif | |||||
#endif |
TARGET = adb_usb_lufa | TARGET = adb_usb_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
COMMAND_ENABLE = yes # Commands for debug and configuration | COMMAND_ENABLE = yes # Commands for debug and configuration | ||||
#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 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" | # Optimize size but this may cause error "relocation truncated to fit" | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = adb_usb_pjrc | TARGET = adb_usb_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
COMMAND_ENABLE = yes # Commands for debug and configuration | COMMAND_ENABLE = yes # Commands for debug and configuration | ||||
#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(+500) | #NKRO_ENABLE = yes # USB Nkey Rollover(+500) | ||||
ADB_MOUSE_ENABLE = yes | |||||
# ADB Mice need acceleration for todays much bigger screens. | |||||
OPT_DEFS += -DADB_MOUSE_MAXACC=8 | |||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
Discuss: http://geekhack.org/showwiki.php?title=Island:14290 | Discuss: http://geekhack.org/showwiki.php?title=Island:14290 | ||||
README FIRST | |||||
------------ | |||||
https://github.com/tmk/tmk_keyboard | |||||
https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb | |||||
Also check these when you are in trouble. | |||||
https://github.com/tmk/tmk_keyboard/wiki | |||||
https://github.com/tmk/tmk_keyboard/labels/NOTE | |||||
Wiring | Wiring | ||||
------ | ------ | ||||
0. Connect ADB keyboard to Teensy by 3 lines(Vcc, GND, Data). By default Data line uses port PD0. | |||||
This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. | |||||
The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended. | |||||
1. Define following macros for ADB connection in config.h if you use other than port PD0. | |||||
ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT | |||||
2. make | |||||
3. program Teensy | |||||
Connect ADB pins to controller just by 3 lines(Vcc, GND, Data). By default Data line uses port PD0. | |||||
ADB female socket from the front: | |||||
,--_--. | |||||
/ o4 3o \ 1: DATA | |||||
| o2 1o | 2: Power SW | |||||
- === - 3: VCC | |||||
`-___-' 4: GND | |||||
This converter uses AVR's internal pull-up, but it seems to be too weak, in particular when you want to use a long or coiled cable. The external pull-up resistor(1K-10K Ohm) on Data is strongly recommended.(It is almost must!) | |||||
https://github.com/tmk/tmk_keyboard/wiki/FAQ#pull-up-resistor | |||||
Pull-up resister: | |||||
Keyboard Conveter | |||||
,------. | |||||
5V------+------|VCC | | |||||
| | | | |||||
[R] | | | |||||
| | | | |||||
Signal--+------|PD0 | | |||||
| | | |||||
GND------------|GND | | |||||
`------' | |||||
R: 1K Ohm resistor | |||||
Define following macros for ADB connection in config.h if you use other than port PD0. | |||||
ADB_PORT, ADB_PIN, ADB_DDR, ADB_DATA_BIT | |||||
Build | Build | ||||
----- | ----- | ||||
Just make | |||||
See doc/build.md. In short, | |||||
$ make clean | $ make clean | ||||
$ make | $ make | ||||
If your keyboard is ISO layout | |||||
You can select keymap(ansi is default) like this: | |||||
$ make KEYMAP=iso | |||||
LOCKING CAPSLOCK | |||||
---------------- | |||||
Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature. | |||||
Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch. | |||||
http://www.youtube.com/watch?v=9wqnt2mGJ2Y | |||||
$ make KEYMAP=[ansi|iso|hasu] | |||||
Keymap | Keymap | ||||
------ | ------ | ||||
You can change a keymap by editing code of keymap.c like following. | |||||
This is a keymap for AEK, however, also used for other keyboards. | |||||
How to define the keymap is probably obvious. You can find key symbols in keycode.h. | |||||
If you want to define some keymaps than just one, see hhkb/keymap.c and | |||||
macway/keymap.c as examples. Keymap(layer) switching may needs a bit of | |||||
effort at this time. | |||||
/* Default Layer: plain keymap | |||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,---. | |||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr| | |||||
* `---' `---------------' `---------------' `---------------' `-----------' `---' | |||||
* ,-----------------------------------------------------------. ,-----------. ,---------------. | |||||
* | `| 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| +| | |||||
* |-----------------------------------------------------------| ,---. |---------------| | |||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | | |||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent| | |||||
* |Ctrl |Alt |Gui | Space |Gui |Alt |Ctrl | |Lef|Dow|Rig| | 0| .| | | |||||
* `-----------------------------------------------------------' `-----------' `---------------' | |||||
*/ | |||||
KEYMAP( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, PWR, | |||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, | |||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, | |||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, | |||||
LCTL,LGUI,LALT, SPC, LEFT,DOWN,RGHT, P0, PDOT,PENT | |||||
), | |||||
You can change a keymap by editing code of keymap_[ansi|iso|hasu|yours].c. | |||||
How to define the keymap is probably obvious. You can find key symbols in common/keycode.h. And see doc/keymap.md for more detail. | |||||
Magic command | Magic command | ||||
To get help press `h` holding Magic key. Magic key is `Power key`. | To get help press `h` holding Magic key. Magic key is `Power key`. | ||||
Locking CapsLock | |||||
---------------- | |||||
Many of old ADB keyboards have mechanical push-lock switch for Capslock key and this converter supports the locking Capslock key by default. See README in top directory for more detail about this feature. | |||||
https://github.com/tmk/tmk_keyboard/blob/master/README.md#mechanical-locking-support | |||||
Also you may want to remove locking pin from the push-lock switch to use capslock as a normal momentary switch. | |||||
Notes | Notes | ||||
----- | ----- | ||||
Not-extended ADB keyboards have no discrimination between right modifier and left one, | Not-extended ADB keyboards have no discrimination between right modifier and left one, |
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||
KEYMAP_EXT_ANSI( | KEYMAP_EXT_ANSI( | ||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR, | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO, | |||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, | ||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PMNS, | ||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, | LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, |
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO, | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO, | ||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,EQL, PSLS,PAST, | ||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN0, DEL, END, PGDN, P7, P8, P9, PMNS, | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,FN0, DEL, END, PGDN, P7, P8, P9, PMNS, | ||||
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, | |||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, | |||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, | LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, | ||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | LCTL,LGUI,LALT, SPC, RGUI,RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | ||||
), | ), | ||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO, | GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,BRK, NO, | ||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3, | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, INS, HOME,PGUP, NLCK,BTN1,BTN2,BTN3, | ||||
TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN0, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D, | TAB, Q, W, E, R, T, Y, U, PSCR,SLCK,PAUS,UP, INS, FN0, DEL, END, PGDN, WH_D,MS_U,WH_U,WH_D, | ||||
CAPS,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U, | |||||
LCAP,VOLD,VOLU,MUTE,F, G, H, J, HOME,PGUP,LEFT,RGHT, ENT, MS_L,MS_D,MS_R,WH_U, | |||||
LSFT,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R, | LSFT,Z, X, C, V, B, N, M, END, PGDN,DOWN, RSFT, PGUP, WH_L,MS_D,WH_R, | ||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3 | LCTL,LGUI,LALT, SPC, RGUI,RCTL, HOME,PGDN,END, BTN1, BTN2,BTN3 | ||||
), | ), |
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||
KEYMAP_EXT_ISO( | KEYMAP_EXT_ISO( | ||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, PWR, | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, NO, | |||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PEQL,PSLS,PAST, | ||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, DEL, END, PGDN, P7, P8, P9, PMNS, | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,ENT, DEL, END, PGDN, P7, P8, P9, PMNS, | ||||
LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, PPLS, | LCAP,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS, P4, P5, P6, PPLS, |
#include "debug.h" | #include "debug.h" | ||||
#include "adb.h" | #include "adb.h" | ||||
#include "matrix.h" | #include "matrix.h" | ||||
#include "report.h" | |||||
#include "host.h" | |||||
#if (MATRIX_COLS > 16) | #if (MATRIX_COLS > 16) | ||||
static bool is_modified = false; | static bool is_modified = false; | ||||
static report_mouse_t mouse_report = {}; | |||||
// matrix state buffer(1:on, 0:off) | // matrix state buffer(1:on, 0:off) | ||||
#if (MATRIX_COLS <= 8) | #if (MATRIX_COLS <= 8) | ||||
return; | return; | ||||
} | } | ||||
#ifdef ADB_MOUSE_ENABLE | |||||
#ifdef MAX | |||||
#undef MAX | |||||
#endif | |||||
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) | |||||
void adb_mouse_task(void) | |||||
{ | |||||
uint16_t codes; | |||||
int16_t x, y; | |||||
static int8_t mouseacc; | |||||
_delay_ms(12); // delay for preventing overload of poor ADB keyboard controller | |||||
codes = adb_host_mouse_recv(); | |||||
// If nothing received reset mouse acceleration, and quit. | |||||
if (!codes) { | |||||
mouseacc = 1; | |||||
return; | |||||
}; | |||||
// Bit sixteen is button. | |||||
if (~codes & (1 << 15)) | |||||
mouse_report.buttons |= MOUSE_BTN1; | |||||
if (codes & (1 << 15)) | |||||
mouse_report.buttons &= ~MOUSE_BTN1; | |||||
// lower seven bits are movement, as signed int_7. | |||||
// low byte is X-axis, high byte is Y. | |||||
y = (codes>>8 & 0x3F); | |||||
x = (codes>>0 & 0x3F); | |||||
// bit seven and fifteen is negative | |||||
// usb does not use int_8, but int_7 (measuring distance) with sign-bit. | |||||
if (codes & (1 << 6)) | |||||
x = (x-0x40); | |||||
if (codes & (1 << 14)) | |||||
y = (y-0x40); | |||||
// Accelerate mouse. (They weren't meant to be used on screens larger than 320x200). | |||||
x *= mouseacc; | |||||
y *= mouseacc; | |||||
// Cap our two bytes per axis to one byte. | |||||
// Easier with a MIN-function, but since -MAX(-a,-b) = MIN(a,b)... | |||||
// I.E. MIN(MAX(x,-127),127) = -MAX(-MAX(x, -127), -127) = MIN(-MIN(-x,127),127) | |||||
mouse_report.x = -MAX(-MAX(x, -127), -127); | |||||
mouse_report.y = -MAX(-MAX(y, -127), -127); | |||||
if (debug_mouse) { | |||||
print("adb_host_mouse_recv: "); print_bin16(codes); print("\n"); | |||||
print("adb_mouse raw: ["); | |||||
phex(mouseacc); print(" "); | |||||
phex(mouse_report.buttons); print("|"); | |||||
print_decs(mouse_report.x); print(" "); | |||||
print_decs(mouse_report.y); print("]\n"); | |||||
} | |||||
// Send result by usb. | |||||
host_mouse_send(&mouse_report); | |||||
// increase acceleration of mouse | |||||
mouseacc += ( mouseacc < ADB_MOUSE_MAXACC ? 1 : 0 ); | |||||
return; | |||||
} | |||||
#endif | |||||
uint8_t matrix_scan(void) | uint8_t matrix_scan(void) | ||||
{ | { | ||||
/* extra_key is volatile and more convoluted than necessary because gcc refused | /* extra_key is volatile and more convoluted than necessary because gcc refused |
TARGET = ascii_usb | TARGET = ascii_usb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = ibm4704_usb | TARGET = ibm4704_usb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
Keyboard initialization process takes a few seconds at start up. During that you will hear buzzer from the keyboard. **You need to plug USB cable after hooking up your keyboard to the converter.** | Keyboard initialization process takes a few seconds at start up. During that you will hear buzzer from the keyboard. **You need to plug USB cable after hooking up your keyboard to the converter.** | ||||
Update | |||||
------ | |||||
2015/05/05 Added keymaps for 107-key, 77-key and 50-key. Thanks, orihalcon @ geekhack! | |||||
2015/05/19 Fixed a protocol handling bug. | |||||
Supported Keyboard | Supported Keyboard | ||||
------------------ | ------------------ | ||||
### IBM capacitive switch models: | ### IBM capacitive switch models: | ||||
- 6019273 Model 100 50-key (grid layout) http://kishy.dyndns.org/?p=977 | |||||
- 6019284 Model 200 62-key Alpha(60% layout) http://kishy.dyndns.org/?p=894 | |||||
- 6019303 Model 300 77-key Expanded Alpha http://kbtalking.cool3c.com/article/23272 | |||||
- 6020218 Model 400 107-key Full key http://kishy.dyndns.org/?p=980 | |||||
- 6019273 Model 100 50-key (grid layout) http://kishy.ca/?p=894 | |||||
- 6019284 Model 200 62-key Alpha(60% layout) http://kishy.ca/?p=894 | |||||
- 6019303 Model 300 77-key Expanded Alpha http://deskthority.net/photos-f62/ibm-6019303-t8502.html | |||||
- 6020218 Model 400 107-key Full key http://kishy.ca/?p=894 | |||||
### Alps switch(vintage Green) models: | ### Alps switch(vintage Green) models: | ||||
/* | |||||
* Busywait | |||||
*/ | |||||
/* Pin configuration */ | |||||
#define IBM4704_CLOCK_PORT PORTD | #define IBM4704_CLOCK_PORT PORTD | ||||
#define IBM4704_CLOCK_PIN PIND | #define IBM4704_CLOCK_PIN PIND | ||||
#define IBM4704_CLOCK_DDR DDRD | #define IBM4704_CLOCK_DDR DDRD | ||||
#define IBM4704_DATA_DDR DDRD | #define IBM4704_DATA_DDR DDRD | ||||
#define IBM4704_DATA_BIT 0 | #define IBM4704_DATA_BIT 0 | ||||
/* | |||||
* Pin interrupt | |||||
*/ | |||||
#ifdef IBM4704_USE_INT | |||||
#define IBM4704_INT_INIT() do { \ | |||||
EICRA |= ((1<<ISC11) | \ | |||||
(0<<ISC10)); \ | |||||
} while (0) | |||||
#define IBM4704_INT_ON() do { \ | |||||
EIMSK |= (1<<INT1); \ | |||||
} while (0) | |||||
#define IBM4704_INT_OFF() do { \ | |||||
EIMSK &= ~(1<<INT1); \ | |||||
} while (0) | |||||
/* Pin interrupt on rising edge of clock */ | |||||
#define IBM4704_INT_INIT() do { EICRA |= ((1<<ISC11)|(1<<ISC10)); } while (0) | |||||
#define IBM4704_INT_ON() do { EIFR |= (1<<INTF1); EIMSK |= (1<<INT1); } while (0) | |||||
#define IBM4704_INT_OFF() do { EIMSK &= ~(1<<INT1); } while (0) | |||||
#define IBM4704_INT_VECT INT1_vect | #define IBM4704_INT_VECT INT1_vect | ||||
#endif | |||||
#endif | #endif |
IBM 4704 Keyboard | IBM 4704 Keyboard | ||||
================= | ================= | ||||
IBM capacitive switch models: | IBM capacitive switch models: | ||||
6019273 Model 100 50-key (grid layout) http://kishy.dyndns.org/?p=977 | |||||
6019284 Model 200 62-key Alpha(60% layout) http://kishy.dyndns.org/?p=894 | |||||
6019303 Model 300 77-key Expanded Alpha http://kbtalking.cool3c.com/article/23272 | |||||
6020218 Model 400 107-key Full key http://kishy.dyndns.org/?p=980 | |||||
6019273 Model 100 50-key (grid layout) http://kishy.ca/?p=894 | |||||
6019284 Model 200 62-key Alpha(60% layout) http://kishy.ca/?p=894 | |||||
6019303 Model 300 77-key Expanded Alpha http://deskthority.net/photos-f62/ibm-6019303-t8502.html | |||||
6020218 Model 400 107-key Full key http://kishy.ca/?p=894 | |||||
Alps switch(vintage Green) models: | Alps switch(vintage Green) models: | ||||
5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127 | 5954339 Japanese 102-key http://deskthority.net/post87127.html#p87127 | ||||
Model 100 50-key A2h | Model 100 50-key A2h | ||||
Model 200 62-key A3h | Model 200 62-key A3h | ||||
Model 300 77-key A4h | Model 300 77-key A4h | ||||
Model 400 107-key ?? | |||||
Model 400 107-key A5h | |||||
Japanese/Chinese 102-key A6h | Japanese/Chinese 102-key A6h | ||||
---------------- | ---------------- | ||||
Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part. | Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part. | ||||
____ __ __ __ __ __ __ __ __ __ ________ | |||||
Clock \____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ | |||||
____ __ __ __ __ __ __ __ __ __ _______ | |||||
Clock \_____/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ | |||||
____ ____ ____ ____ ____ ____ ____ ____ ____ ____ | ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ | ||||
Data ____/ X____X____X____X____X____X____X____X____X____X________ | Data ____/ X____X____X____X____X____X____X____X____X____X________ | ||||
Start 0 1 2 3 4 5 6 7 P Stop | Start 0 1 2 3 4 5 6 7 P Stop | ||||
Start bit: can be long as 300-350us. | Start bit: can be long as 300-350us. | ||||
Inhibit: Pull Data line down to inhibit keyboard to send. | Inhibit: Pull Data line down to inhibit keyboard to send. | ||||
Timing: Host reads bit while Clock is hi. | |||||
Timing: Host reads bit while Clock is hi.(rising edge) | |||||
Stop bit: Keyboard pulls down Data line to lo after 9th clock. | Stop bit: Keyboard pulls down Data line to lo after 9th clock. | ||||
| `-----`--- scan code | | `-----`--- scan code | ||||
`------------- enable bit(0: enable repeat, 1: enable break) | `------------- enable bit(0: enable repeat, 1: enable break) | ||||
00-77 Enable repeat(78-7F: invalid scancode) | |||||
80-F7 Enable break(F8-FF: invalid scancode) | |||||
00-79 Enable repeat | |||||
80-F9 Enable break(FA-FF are used as other commands, see above.) | |||||
FE Resend(011ah) no need to use | FE Resend(011ah) no need to use | ||||
FF End(0114h) exits FC command mode. | FF End(0114h) exits FC command mode. | ||||
Response from keyboard: | Response from keyboard: | ||||
FD Out of bound - Invalid scancode | FD Out of bound - Invalid scancode | ||||
-- OK - No response means that command is accepted. | |||||
Examples: | Examples: | ||||
To enable break code of all keys. | To enable break code of all keys. |
#include "keymap_common.h" | |||||
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
KEYMAP_50( | |||||
F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, \ | |||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, \ | |||||
Q, W, E, R, T, Y, U, I, O, P, \ | |||||
A, S, D, F, G, H, J, K, L, SCLN, \ | |||||
Z, X, C, V, B, N, M, COMM,DOT, SLSH \ | |||||
), | |||||
}; | |||||
const uint16_t PROGMEM fn_actions[] = { | |||||
}; | |||||
extern const uint16_t fn_actions[]; | extern const uint16_t fn_actions[]; | ||||
/* Original keys */ | |||||
/* 107-key */ | |||||
#define KEYMAP( \ | #define KEYMAP( \ | ||||
K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, \ | |||||
K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, \ | |||||
K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, \ | |||||
K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, \ | |||||
K31,K41,K3F, K40, K42,K2F \ | |||||
K46,K64, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, K47,K48,K49,K4A, \ | |||||
K56,K66, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, K4B,K4C,K4D,K4E, \ | |||||
K71,K77, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, K50,K51,K52,K53, \ | |||||
K44,K45, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, K5E,K58,K59,K5A, \ | |||||
K54,K55, K31,K41,K3F, K40, K42,K2F, K78,K67,K79, K5B,K5C,K5D,K57 \ | |||||
) { \ | ) { \ | ||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \ | |||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_NO }, \ | |||||
{ KC_##K08, KC_##K09, KC_##K0A, KC_NO, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ | { KC_##K08, KC_##K09, KC_##K0A, KC_NO, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ | ||||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ | { 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_##K1C, KC_##K1D, KC_NO, KC_##K1F }, \ | { KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_NO, KC_##K1F }, \ | ||||
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO, KC_##K2F }, \ | { KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_NO, KC_##K2F }, \ | ||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ | { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ | ||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ | { KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ | ||||
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ | |||||
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \ | |||||
{ KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_NO }, \ | |||||
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ | |||||
{ KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ | |||||
{ KC_NO, KC_NO, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \ | |||||
{ KC_##K70, KC_##K71, KC_##K72, KC_NO, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ | |||||
{ KC_##K78, KC_##K79, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \ | |||||
} | } | ||||
#endif | |||||
/* 77-key */ | |||||
#define KEYMAP_77( \ | |||||
K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, \ | |||||
K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, \ | |||||
K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, \ | |||||
K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, \ | |||||
K31,K41,K3F, K40, K42,K2F, K78,K67,K79 \ | |||||
) KEYMAP( \ | |||||
F1, F2, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, K6A,K6B,K6C, NLCK,PSLS,PAST,PMNS, \ | |||||
F3, F4, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, K6D,K6E,K6F, P7, P8, P9, PPLS, \ | |||||
F5, F6, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, K70,K65,K72, P4, P5, P6, PPLS, \ | |||||
F7, F8, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, K74,K75,K76, P1, P2, P3, PENT, \ | |||||
F9, F10, K31,K41,K3F, K40, K42,K2F, K78,K67,K79 P0, P0, PDOT,PENT \ | |||||
) | |||||
/* | |||||
{ K48, K49, K4A, K4B, K4C, K4D, K4E, K4F }, \ | |||||
{ K50, K51, K52, K53, K54, K55, K56, K57 }, \ | |||||
{ K58, K59, K5A, K5B, K5C, K5D, K5E, K5F }, \ | |||||
{ K60, K61, K62, K63, K64, K65, K66, K67 }, \ | |||||
{ K68, K69, K6A, K6B, K6C, K6D, K6E, K6F }, \ | |||||
{ K70, K71, K72, K73, K74, K75, K76, K77 }, \ | |||||
{ K78, K79, K7A, K7B, K7C, K7D, K7E, K7F }, \ | |||||
*/ | |||||
/* 62-key */ | |||||
#define KEYMAP_62( \ | |||||
K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, \ | |||||
K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, \ | |||||
K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, \ | |||||
K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, \ | |||||
K31,K41,K3F, K40, K42,K2F \ | |||||
) KEYMAP( \ | |||||
F1, F2, K00,K18,K19,K1A,K10,K11,K12,K08,K09,K0A,K0F,K1F,K0D,K0C,K0E, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \ | |||||
F3, F4, K04,K05,K06,K13,K14,K15,K16,K17,K01,K02,K03,K1B,K1C,K1D, DEL, END, PGDN, P7, P8, P9, PPLS, \ | |||||
F5, F6, K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K2A,K2B,K2C,K2D, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \ | |||||
F7, F8, K30,K3E,K32,K33,K34,K35,K36,K37,K38,K39,K3A,K3B,K3C,K3D, F11, UP, F12, P1, P2, P3, PENT, \ | |||||
F9, F10, K31,K41,K3F, K40, K42,K2F, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \ | |||||
) | |||||
/* 50-key */ | |||||
#define KEYMAP_50( \ | |||||
K00,K01,K02, K03,K04,K05, K20,K21,K22,K23, \ | |||||
K08,K09,K0A, K0B,K0C,K0D, K28,K29,K2A,K35, \ | |||||
K10,K11,K12, K13,K14,K15, K30,K31,K32,K36, \ | |||||
K18,K19,K1A, K1B,K1C,K1D, K38,K39,K3A,K37, \ | |||||
K16,K1E,K0E, K0F,K1F,K17, K33,K3B,K2B,K3F \ | |||||
) { \ | |||||
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_NO, KC_NO, }, \ | |||||
{ KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K0C, KC_##K0D, KC_##K0E, KC_##K0F }, \ | |||||
{ 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_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ | |||||
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \ | |||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_NO, KC_NO, KC_NO, KC_##K3F }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, } \ | |||||
} | |||||
#endif |
* |Ctrl |Gui|Alt | Space |Alt |Gui|Ctrl | | * |Ctrl |Gui|Alt | Space |Alt |Gui|Ctrl | | ||||
* `-----------------------------------------------------------' | * `-----------------------------------------------------------' | ||||
*/ | */ | ||||
KEYMAP( | |||||
KEYMAP_62( | |||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ | ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \ | ||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ | ||||
LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,NO, ENT, \ | LCTL,A, S, D, F, G, H, J, K, L, FN1, QUOT,NO, ENT, \ | ||||
LCTL,LGUI,LALT, FN3, RGUI,RCTL \ | LCTL,LGUI,LALT, FN3, RGUI,RCTL \ | ||||
), | ), | ||||
KEYMAP( | |||||
KEYMAP_62( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ||||
CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \ | CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, BSPC, \ | ||||
LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \ | LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \ | ||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL \ | LCTL,LGUI,LALT, SPC, RGUI,RCTL \ | ||||
), | ), | ||||
KEYMAP( | |||||
KEYMAP_62( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ||||
TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,WSTP,WBAK,WFWD,BSPC, \ | TAB, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,WSTP,WBAK,WFWD,BSPC, \ | ||||
LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,NO, NO, ENT, \ | LCTL,NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,TRNS,NO, NO, ENT, \ | ||||
LCTL,LGUI,LALT, BTN1, RGUI,RCTL \ | LCTL,LGUI,LALT, BTN1, RGUI,RCTL \ | ||||
), | ), | ||||
KEYMAP( | |||||
KEYMAP_62( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ||||
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \ | TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \ | ||||
LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, \ | LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, NO, ENT, \ | ||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL \ | LCTL,LGUI,LALT, SPC, RGUI,RCTL \ | ||||
), | ), | ||||
KEYMAP( | |||||
KEYMAP_62( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ||||
TAB, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN4, \ | TAB, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN4, \ | ||||
LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, NO, ENT, \ | LCTL,VOLD,VOLU,MUTE,NO, NO, BTN2,MS_L,MS_D,MS_R,BTN1,NO, NO, ENT, \ |
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | ||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '| #|Ret | | |||||
* |Ctrl | A| S| D| F| G| H| J| K| L| ;| '|Ret|Ret | | |||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Shif| \| Z| X| C| V| B| N| M| ,| ,| /|???|Shift | | |||||
* |Shif|Shf| Z| X| C| V| B| N| M| ,| ,| /|???|Shift | | |||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Ctrl |Gui|Alt | Space |Alt* |Gui|Ctrl | | |||||
* |Ctrl |Gui|Alt | Space |Alt* |Gui|Fn | | |||||
* `-----------------------------------------------------------' | * `-----------------------------------------------------------' | ||||
*/ | */ | ||||
KEYMAP( | KEYMAP( | ||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,BSPC, \ | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ | |||||
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,NUHS,ENT, \ | |||||
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, FN0, \ | |||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL \ | |||||
F1, F2, GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, NO, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \ | |||||
F3, F4, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, \ | |||||
F5, F6, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, ENT, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \ | |||||
F7, F8, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,NO, RSFT, F11, UP, F12, P1, P2, P3, PENT, \ | |||||
F9, F10, LCTL,LGUI,LALT, SPC, RGUI,FN0, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \ | |||||
), | ), | ||||
/* 1: HHKB */ | |||||
/* 1: HHKB | |||||
* ,-----------------------------------------------------------. | |||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|???|Del| | |||||
* |-----------------------------------------------------------| | |||||
* |Caps | | | | | | | |Psc|Slk|Pau| Up| | Ins| | |||||
* |-----------------------------------------------------------| | |||||
* |Ctrl |VoD|VoU|VoM| | | *| /|Hom|PgU|Lef|Rig|Ret|Ret | | |||||
* |-----------------------------------------------------------| | |||||
* |Shif|Shi| | | | | | +| -|End|PgD|Dow|???|Shift | | |||||
* |-----------------------------------------------------------| | |||||
* |Ctrl |Gui|Alt | Space |Alt* |Gui|Fn | | |||||
* `-----------------------------------------------------------' | |||||
*/ | |||||
KEYMAP( | KEYMAP( | ||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | |||||
CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, INS, \ | |||||
LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,NO, ENT, \ | |||||
LSFT,NO, NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, \ | |||||
LCTL,LGUI,LALT, SPC, RGUI,RCTL \ | |||||
F1, F2, ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, NO, DEL, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, \ | |||||
F3, F4, CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS, UP, NO, INS, DEL, END, PGDN, P7, P8, P9, PPLS, \ | |||||
F5, F6, TRNS,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, ENT, PSCR,SLCK,PAUS, P4, P5, P6, PPLS, \ | |||||
F7, F8, TRNS,TRNS,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,NO, TRNS, F11, UP, F12, P1, P2, P3, PENT, \ | |||||
F9, F10, TRNS,TRNS,TRNS, TRNS, TRNS,TRNS, LEFT,DOWN,RGHT, P0, P0, PDOT,PENT \ | |||||
), | ), | ||||
}; | }; | ||||
static void enable_break(void) | static void enable_break(void) | ||||
{ | { | ||||
uint8_t ret; | |||||
print("Enable break: "); | print("Enable break: "); | ||||
// valid scancode: 00-77h | |||||
for (uint8_t code = 0; code < 0x78; code++) { | |||||
while (ibm4704_send(0x80|code) != 0) { | |||||
print("z"); | |||||
_delay_us(500); | |||||
} | |||||
_delay_us(2000); | |||||
ret = ibm4704_recv(); | |||||
if (ret != 0xff) { | |||||
xprintf("c%02X:r%02X ", code, ret); | |||||
} | |||||
_delay_us(1000); | |||||
// valid scancode: 00-79h | |||||
for (uint8_t code = 0; code < 0x7A; code++) { | |||||
while (ibm4704_send(0x80|code)) _delay_ms(10); | |||||
_delay_ms(5); // wait for response | |||||
// No response(FF) when ok, FD when out of bound | |||||
xprintf("s%02X:r%02X ", code, ibm4704_recv()); | |||||
} | } | ||||
_delay_us(1000); | |||||
while (ibm4704_send(0xFF) != 0) { _delay_us(500); } // End | |||||
while (ibm4704_send(0xFF)) { _delay_ms(10); } // End | |||||
print("End\n"); | print("End\n"); | ||||
} | } | ||||
void matrix_init(void) | |||||
{ | |||||
uint8_t ret; | |||||
debug_enable = true; | |||||
void matrix_setup(void) | |||||
{ | |||||
ibm4704_init(); | ibm4704_init(); | ||||
matrix_clear(); | |||||
} | |||||
// read keyboard id | |||||
while ((ret = ibm4704_recv()) == 0xFF) { | |||||
ibm4704_send(0xFE); | |||||
_delay_us(100); | |||||
} | |||||
void matrix_init(void) | |||||
{ | |||||
debug_enable = true; | |||||
_delay_ms(2000); // wait for starting up debug console | |||||
print("IBM 4704 converter\n"); | print("IBM 4704 converter\n"); | ||||
xprintf("Keyboard ID: %02X\n", ret); | |||||
matrix_clear(); | |||||
_delay_ms(2000); // wait for keyboard starting up | |||||
xprintf("Keyboard ID: %02X\n", ibm4704_recv()); | |||||
enable_break(); | enable_break(); | ||||
} | } | ||||
if (code==0xFF) { | if (code==0xFF) { | ||||
// Not receivd | // Not receivd | ||||
return 0; | return 0; | ||||
} else if ((code&0x78)==0x78) { | |||||
// 0xFF-F8 and 0x7F-78 is not scancode | |||||
xprintf("Error: %0X\n", code); | |||||
} else if ((code&0x7F) >= 0x7A) { | |||||
// 0xFF-FA and 0x7F-7A is not scancode | |||||
xprintf("Error: %02X\n", code); | |||||
matrix_clear(); | matrix_clear(); | ||||
return 0; | return 0; | ||||
} else if (code&0x80) { | } else if (code&0x80) { | ||||
dprintf("%02X\n", code); | |||||
matrix_make(code); | matrix_make(code); | ||||
} else { | } else { | ||||
dprintf("%02X\n", code); | |||||
matrix_break(code); | matrix_break(code); | ||||
} | } | ||||
return 1; | return 1; |
TARGET = m0110_lufa | TARGET = m0110_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = m0110_pjrc | TARGET = m0110_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = m0110_lufa | TARGET = m0110_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = news_usb_pjrc | TARGET = news_usb_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = next_usb | TARGET = next_usb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = next_usb | TARGET = next_usb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = pc98_usb | TARGET = pc98_usb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = ps2_usb_lufa | TARGET = ps2_usb_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# PS/2 Options | # PS/2 Options | ||||
# | # | ||||
PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) | |||||
#PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin | |||||
#PS2_USE_USART = yes # uses hardware USART engine for PS/2 signal receive(recomened) | |||||
PS2_USE_INT = yes # uses external interrupt for falling edge of PS/2 clock pin | |||||
#PS2_USE_BUSYWAIT = yes # uses primitive reference code | #PS2_USE_BUSYWAIT = yes # uses primitive reference code | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
PROJECT = ps2_usb | PROJECT = ps2_usb | ||||
TMK_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
MBED_DIR = $(TMK_DIR)/mbed-sdk | MBED_DIR = $(TMK_DIR)/mbed-sdk | ||||
#VPATH += $(MBED_DIR):$(TMK_DIR) | #VPATH += $(MBED_DIR):$(TMK_DIR) |
TARGET = ps2_usb_pjrc | TARGET = ps2_usb_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = ps2_usb_tmk_rev1 | TARGET = ps2_usb_tmk_rev1 | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = ps2_usb_tmk_rev2 | TARGET = ps2_usb_tmk_rev2 | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = ps2_usb_vusb | TARGET = ps2_usb_vusb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/protocol/vusb.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/protocol/vusb.mk | |||||
include $(TMK_DIR)/rules.mk |
- **USART**: **Clock** is on `PD5` and **Data** on `PD2`. | - **USART**: **Clock** is on `PD5` and **Data** on `PD2`. | ||||
3. Optionally you need pull-up resistor. 1K-10K Ohm is OK. | 3. Optionally you need pull-up resistor. 1K-10K Ohm is OK. | ||||
To change pin configuration edit config.h. | |||||
To change pin configuration edit **config.h** and **Makefile**. | |||||
Build Firmware | Build Firmware |
#define PS2_CLOCK_PORT PORTD | #define PS2_CLOCK_PORT PORTD | ||||
#define PS2_CLOCK_PIN PIND | #define PS2_CLOCK_PIN PIND | ||||
#define PS2_CLOCK_DDR DDRD | #define PS2_CLOCK_DDR DDRD | ||||
#define PS2_CLOCK_BIT 5 | |||||
#define PS2_CLOCK_BIT 1 | |||||
#define PS2_DATA_PORT PORTD | #define PS2_DATA_PORT PORTD | ||||
#define PS2_DATA_PIN PIND | #define PS2_DATA_PIN PIND | ||||
#define PS2_DATA_DDR DDRD | #define PS2_DATA_DDR DDRD | ||||
#define PS2_DATA_BIT 2 | |||||
#define PS2_DATA_BIT 0 | |||||
#endif | #endif | ||||
/* | /* | ||||
#define PS2_DATA_PORT PORTD | #define PS2_DATA_PORT PORTD | ||||
#define PS2_DATA_PIN PIND | #define PS2_DATA_PIN PIND | ||||
#define PS2_DATA_DDR DDRD | #define PS2_DATA_DDR DDRD | ||||
#define PS2_DATA_BIT 2 | |||||
#define PS2_DATA_BIT 0 | |||||
#define PS2_INT_INIT() do { \ | #define PS2_INT_INIT() do { \ | ||||
EICRA |= ((1<<ISC11) | \ | EICRA |= ((1<<ISC11) | \ | ||||
(0<<ISC10)); \ | (0<<ISC10)); \ |
TARGET = serialmouse_usb | TARGET = serialmouse_usb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = sun_usb | TARGET = sun_usb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
Sun to USB keyboard protocol converter | Sun to USB keyboard protocol converter | ||||
====================================== | ====================================== | ||||
Target MCU is ATMega32u4 but other USB capable AVR will also work. | Target MCU is ATMega32u4 but other USB capable AVR will also work. | ||||
Supported keyboards: Sun Type 5 Keyboard, CTCSP SHORT TYPE KEYBOARD(CKUB) | |||||
CTCSP SHORT TYPE KEYBOARD: http://imgur.com/a/QIv6p | |||||
This converter will work with Sun Type 2-5 Keyboards. | |||||
Tested on: | |||||
Sun Type 3 Keyboard: http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html | |||||
CTCSP SHORT TYPE KEYBOARD(Type 5): http://imgur.com/a/QIv6p | |||||
Keymap of Type 3(keymap_sun3.c) were impoted from dastels's repository. | |||||
https://github.com/dastels/tmk_keyboard/tree/master/converter/sun3_usb | |||||
Connector | Connector |
/* | |||||
Copyright 2012 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 <stdbool.h> | |||||
#include <avr/pgmspace.h> | |||||
#include "keycode.h" | |||||
#include "util.h" | |||||
#include "keymap.h" | |||||
/* Sun type 3 keyboard | |||||
,-------. ,-----------------------------------------------------------. ,-----------. | |||||
| 01| 03| | 05| 06| 08| 0A| 0C| 0E| 10| 11| 12| 2B| | 15| 16| 17| | |||||
|-------| |-----------------------------------------------------------| |-----------| | |||||
| 19| 1A| | 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 58| 2A| | 2D| 2E| 2F| | |||||
|-------| |-----------------------------------------------------------| |-----------| | |||||
| 31| 33| | 35 | 36| 37| 38| 39| 3A| 3B| 3C| 3D| 3E| 3F| 40| 41| 42 | | 44| 45| 46| | |||||
|-------| |-----------------------------------------------------------| |-----------| | |||||
| 48| 49| | 4C | 4D| 4E| 4F| 50| 51| 52| 53| 54| 55| 56| 57| 59 | | 5B| 5C| 5D| | |||||
|-------| |-----------------------------------------------------------| |-----------| | |||||
| 5F| 61| | 63 | 64| 65| 66| 67| 68| 69| 6A| 6B| 6C| 6D| 6E| 6F| | 70| 71| 72| | |||||
`-------' |-----------------------------------------------------------| `-----------' | |||||
| 77 | 78 | 79 | 7A | 13 | | |||||
`-----------------------------------------------------------' | |||||
*/ | |||||
#define KEYMAP( \ | |||||
K01,K03, K05,K06, K08, K0A, K0C, K0E, K10,K11,K12,K2B, K15,K16,K17, \ | |||||
K19,K1A, K1D,K1E,K1F,K20,K21,K22,K23,K24,K25,K26,K27,K28,K29,K58,K2A, K2D,K2E,K2F, \ | |||||
K31,K33, K35, K36,K37,K38,K39,K3A,K3B,K3C,K3D,K3E,K3F,K40,K41, K42, K44,K45,K46, \ | |||||
K48,K49, K4C, K4D,K4E,K4F,K50,K51,K52,K53,K54,K55,K56,K57, K59, K5B,K5C,K5D, \ | |||||
K5F,K61, K63, K64,K65,K66,K67,K68,K69,K6A,K6B,K6C,K6D, K6E,K6F, K70,K71,K72, \ | |||||
K77,K78, K79, K7A,K13 \ | |||||
) { \ | |||||
{ KC_NO, KC_##K01, KC_NO, KC_##K03, KC_NO, KC_##K05, KC_##K06, KC_NO }, \ | |||||
{ KC_##K08, KC_NO, KC_##K0A, KC_NO, KC_##K0C, KC_NO, KC_##K0E, KC_NO }, \ | |||||
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_NO, KC_##K15, KC_##K16, KC_##K17 }, \ | |||||
{ KC_NO, KC_##K19, KC_##K1A, KC_NO, KC_NO, KC_##K1D, KC_##K1E, KC_##K1F }, \ | |||||
{ 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_NO, KC_##K2D, KC_##K2E, KC_##K2F }, \ | |||||
{ KC_NO, KC_##K31, KC_NO, KC_##K33, KC_NO, KC_##K35, KC_##K36, KC_##K37 }, \ | |||||
{ KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ | |||||
{ KC_##K40, KC_##K41, KC_##K42, KC_NO, KC_##K44, KC_##K45, KC_##K46, KC_NO }, \ | |||||
{ KC_##K48, KC_##K49, KC_NO, KC_NO, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \ | |||||
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ | |||||
{ KC_##K58, KC_##K59, KC_NO, KC_##K5B, KC_##K5C, KC_##K5D, KC_NO, KC_##K5F }, \ | |||||
{ KC_NO, KC_##K61, KC_NO, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ | |||||
{ KC_##K68, KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \ | |||||
{ KC_##K70, KC_##K71, KC_##K72, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K77 }, \ | |||||
{ KC_##K78, KC_##K79, KC_##K7A, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO } \ | |||||
} | |||||
// Assign Fn key(0-7) to a layer to which switch with the Fn key pressed. | |||||
static const uint8_t PROGMEM fn_layer[] = { | |||||
2, // Fn0 | |||||
3, // Fn1 | |||||
4, // Fn2 | |||||
0, // Fn3 | |||||
0, // Fn4 | |||||
0, // Fn5 | |||||
0, // Fn6 | |||||
0 // Fn7 | |||||
}; | |||||
// Assign Fn key(0-7) to a keycode sent when release Fn key without use of the layer. | |||||
// See layer.c for details. | |||||
static const uint8_t PROGMEM fn_keycode[] = { | |||||
KC_NO, // Fn0 | |||||
KC_SCLN, // Fn1 | |||||
KC_SLSH, // Fn2 | |||||
KC_NO, // Fn3 | |||||
KC_NO, // Fn4 | |||||
KC_NO, // Fn5 | |||||
KC_NO, // Fn6 | |||||
KC_NO // Fn7 | |||||
}; | |||||
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||||
KEYMAP( | |||||
F10, F11, F1, F2, F3, F4, F5, F6, F7, F8, F9, BSPC, VOLD, MUTE, VOLU, | |||||
F12, F13, ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,MINS, EQL, BSLS, GRV, MPRV, MPLY, MNXT, | |||||
F14, F15, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, DEL, HOME, UP, PGUP, | |||||
F16, F17, LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, LEFT, INSERT, RIGHT, | |||||
F18, F19, LSFT, Z, X, C, V, B, N, M, COMM,DOT,SLSH, RSFT,RCTL, END, DOWN, PGDOWN, | |||||
LGUI, LALT, SPC, RALT,RGUI | |||||
), | |||||
/* | |||||
// 0: default | |||||
SHORT_TYPE( | |||||
STOP, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP, | |||||
F7,F8,F9,F10,F11,F12, DEL, END, PGDN, | |||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC, | |||||
LCTL, A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, | |||||
LSFT, Z, X, C, V, B, N, M, COMM,DOT, SLSH, RALT,UP, RSFT, | |||||
CAPS,LALT,LGUI, SPC, RGUI,APP, NLCK,LEFT,DOWN,RGHT | |||||
), | |||||
// 1: with layer keys | |||||
SHORT_TYPE( | |||||
ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP, | |||||
F7,F8,F9,F10,F11,F12, DEL, END, PGDN, | |||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSPC, | |||||
LCTL, A, S, D, F, G, H, J, K, L, FN1, QUOT, ENT, | |||||
LSFT, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,UP, FN0, | |||||
CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, LEFT,DOWN,RGHT | |||||
), | |||||
// 2: HHKB | |||||
SHORT_TYPE( | |||||
ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP, | |||||
F7,F8,F9,F10,F11,F12, DEL, END, PGDN, | |||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, | |||||
CAPS, NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, BSPC, | |||||
LCTL, VOLD,VOLU,MUTE,NO, NO, NO, NO, HOME,PGUP,LEFT,RGHT, ENT, | |||||
LSFT, Z, X, C, V, B, NO, NO, END, PGDN,DOWN, RSFT,PGUP,FN0, | |||||
CAPS,LALT,LGUI, SPC, RGUI,RALT,FN0, HOME,PGDN,END | |||||
), | |||||
// 3: Mousekey | |||||
SHORT_TYPE( | |||||
ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP, | |||||
F7,F8,F9,F10,F11,F12, DEL, END, PGDN, | |||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, | |||||
CAPS, NO, NO, NO, NO, NO, WH_L,WH_D,WH_U,WH_R,NO, NO, NO, BSPC, | |||||
LCTL, NO, ACL0,ACL1,ACL2,NO, MS_L,MS_D,MS_U,MS_R,FN1, NO, ENT, | |||||
LSFT, NO, NO, NO, NO, BTN3,BTN2,BTN1,NO, NO, NO, RSFT,UP, NO, | |||||
CAPS,LALT,LGUI, BTN1, RGUI,RALT,NO, LEFT,DOWN,RGHT | |||||
), | |||||
// 4: Cursor | |||||
SHORT_TYPE( | |||||
ESC, F1,F2,F3,F4, F5, F6, CUT,PASTE,COPY,PWR, INS, HOME,PGUP, | |||||
F7,F8,F9,F10,F11,F12, DEL, END, PGDN, | |||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, | |||||
CAPS, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, | |||||
LCTL, NO, NO, NO, NO, NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, | |||||
LSFT, NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,UP, NO, | |||||
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]); | |||||
} |
TARGET = terminal_bluefruit | TARGET = terminal_bluefruit | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/bluefruit.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/bluefruit.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = terminal_lufa | TARGET = terminal_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
{ KC_NO, KC_NO, KC_NO, KC_##K83, KC_##K84, KC_NO, KC_NO, KC_NO, }, \ | { KC_NO, KC_NO, KC_NO, KC_##K83, KC_##K84, KC_NO, KC_NO, KC_NO, }, \ | ||||
} | } | ||||
/* | |||||
* IBM Terminal keyboard 1399625, 101-key | |||||
*/ | |||||
#define KEYMAP_101( \ | |||||
K08, K07,K0F,K17,K1F,K27,K2F,K37,K3F,K47,K4F,K56,K5E, K57,K5F,K62, \ | |||||
\ | |||||
K0E,K16,K1E,K26,K25,K2E,K36,K3D,K3E,K46,K45,K4E,K55,K66, K67,K6E,K6F, K76,K77,K7E,K84, \ | |||||
K0D,K15,K1D,K24,K2D,K2C,K35,K3C,K43,K44,K4D,K54,K5B,K5C, K64,K65,K6D, K6C,K75,K7D, \ | |||||
K14,K1C,K1B,K23,K2B,K34,K33,K3B,K42,K4B,K4C,K52, K5A, K6B,K73,K74,K7C, \ | |||||
K12, K1A,K22,K21,K2A,K32,K31,K3A,K41,K49,K4A, K59, K63, K69,K72,K7A, \ | |||||
K11, K19, K29, K39, K58, K61,K60,K6A, K70, K71,K79 \ | |||||
) { \ | |||||
{ KC_NO, KC_NO , KC_NO, KC_NO , KC_NO , KC_NO , KC_NO , KC_##K07 }, \ | |||||
{ KC_##K08, KC_NO , KC_NO , KC_NO , KC_NO , KC_##K0D, KC_##K0E, KC_##K0F }, \ | |||||
{ KC_NO , KC_##K11, KC_##K12, KC_NO , KC_##K14, KC_##K15, KC_##K16, KC_##K17 }, \ | |||||
{ KC_NO , KC_##K19, KC_##K1A, KC_##K1B, KC_##K1C, KC_##K1D, KC_##K1E, KC_##K1F }, \ | |||||
{ KC_NO , KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27 }, \ | |||||
{ KC_NO , KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2E, KC_##K2F }, \ | |||||
{ KC_NO , KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37 }, \ | |||||
{ KC_NO , KC_##K39, KC_##K3A, KC_##K3B, KC_##K3C, KC_##K3D, KC_##K3E, KC_##K3F }, \ | |||||
{ KC_NO , KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47 }, \ | |||||
{ KC_NO , KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4E, KC_##K4F }, \ | |||||
{ KC_NO , KC_NO , KC_##K52, KC_NO , KC_##K54, KC_##K55, KC_##K56, KC_##K57 }, \ | |||||
{ KC_##K58, KC_##K59, KC_##K5A, KC_##K5B, KC_##K5C, KC_NO , KC_##K5E, KC_##K5F }, \ | |||||
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67 }, \ | |||||
{ KC_NO , KC_##K69, KC_##K6A, KC_##K6B, KC_##K6C, KC_##K6D, KC_##K6E, KC_##K6F }, \ | |||||
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77 }, \ | |||||
{ KC_NO , KC_##K79, KC_##K7A, KC_NO , KC_##K7C, KC_##K7D, KC_##K7E, KC_NO }, \ | |||||
{ KC_NO, KC_NO, KC_NO, KC_NO , KC_##K84, KC_NO, KC_NO, KC_NO, }, \ | |||||
} | |||||
// 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[] = { | static const uint8_t PROGMEM fn_layer[] = { | ||||
APP, INT6, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, NO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT, | APP, INT6, LSFT,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, NO, RSFT, LEFT,INT2,RGHT, P1, P2, P3, PENT, | ||||
RGUI,LGUI, LCTL, LALT, SPC, LGUI, GRV, DOWN, NO, P0, PDOT,NO | RGUI,LGUI, LCTL, LALT, SPC, LGUI, GRV, DOWN, NO, P0, PDOT,NO | ||||
), | ), | ||||
/* 101-key keymaps | |||||
*/ | |||||
/* 0: default | |||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. | |||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| | |||||
* `---' `---------------' `---------------' `---------------' `-----------' | |||||
* ,-----------------------------------------------------------. ,-----------. ,---------------. | |||||
* | `| 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| | | |||||
* |-----------------------------------------------------------| ,---. |---------------| | |||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | |Up | | 1| 2| 3| | | |||||
* |-----------------------------------------------------------| ,-----------. |-----------|Ent| | |||||
* |Ctrl| |Alt | Space |Alt | |Ctrl| |Lef|Dow|Rig| | 0| .| | | |||||
* `----' `---------------------------------------' `----' `-----------' `---------------' | |||||
*/ | |||||
/* | |||||
KEYMAP_101( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK, BRK, | |||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,MINS, EQL,BSPC, INS,HOME,PGUP, NLCK,PSLS,PAST,PMNS, | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P,LBRC,RBRC,BSLS, DEL, END,PGDN, P7, P8, P9, | |||||
CAPS, A, S, D, F, G, H, J, K, L,SCLN,QUOT, ENT, P4, P5, P6,PPLS, | |||||
LSFT, Z, X, C, V, B, N, M,COMM, DOT,SLSH, RSFT, UP, P1, P2, P3, | |||||
LCTL, LALT, SPC, RALT, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | |||||
), | |||||
*/ | |||||
}; | }; | ||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP | # make flip-ee = Download the eeprom file to the device, using Atmel FLIP | ||||
# (must have Atmel FLIP installed). | # (must have Atmel FLIP installed). | ||||
# | # | ||||
# make debug = Start either simulavr or avarice as specified for debugging, | |||||
# make debug = Start either simulavr or avarice as specified for debugging, | |||||
# with avr-gdb or avr-insight as the front end 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.s = Just compile filename.c into the assembler code only. | ||||
# Target file name (without extension). | # Target file name (without extension). | ||||
TARGET = usb_usb | TARGET = usb_usb | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
MOUSEKEY_ENABLE = yes # Mouse keys | MOUSEKEY_ENABLE = yes # Mouse keys | ||||
EXTRAKEY_ENABLE = yes # Media control and System control | EXTRAKEY_ENABLE = yes # Media control and System control | ||||
CONSOLE_ENABLE = yes # Console for debug | CONSOLE_ENABLE = yes # Console for debug | ||||
#COMMAND_ENABLE = yes # Commands for debug and configuration | |||||
#NKRO_ENABLE = yes # USB Nkey Rollover | #NKRO_ENABLE = yes # USB Nkey Rollover | ||||
# Boot Section Size in bytes | # Boot Section Size in bytes | ||||
# LUFA bootloader 4096 | # LUFA bootloader 4096 | ||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||||
#LDFLAGS += -Wl,--relax | |||||
#OPT_DEFS += -DNO_ACTION_TAPPING | |||||
#OPT_DEFS += -DNO_ACTION_LAYER | |||||
#OPT_DEFS += -DNO_ACTION_MACRO | |||||
SRC = \ | SRC = \ | ||||
keymap_common.c \ | keymap_common.c \ | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/usb_hid.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/usb_hid.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||
/* 0: default | |||||
/* 0: plain Qwerty without layer switching | |||||
* ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. | * ,---. ,---------------. ,---------------. ,---------------. ,-----------. ,-----------. | ||||
* |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| | * |Esc| |F1 |F2 |F3 |F4 | |F5 |F6 |F7 |F8 | |F9 |F10|F11|F12| |PrS|ScL|Pau| |Pwr|Slp|Wak| | ||||
* `---' `---------------' `---------------' `---------------' `-----------' `-----------' | * `---' `---------------' `---------------' `---------------' `-----------' `-----------' | ||||
*/ | */ | ||||
KEYMAP( | KEYMAP( | ||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, | ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, | ||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, | |||||
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, | |||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT, UP, P1, P2, P3, | |||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, GRV, LEFT,DOWN,RGHT, P0, PDOT,PENT | |||||
), | |||||
/* 1: plain Qwerty without layer switching | |||||
* ,-----------------------------------------------------------. | |||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| | |||||
* |-----------------------------------------------------------| | |||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | |||||
* |-----------------------------------------------------------| | |||||
* |CapsLo| A| S| D| F| G| H| J| K| L| ;| '|Return | | |||||
* |-----------------------------------------------------------| | |||||
* |Shift | Z| X| C| V| B| N| M| ,| ,| /|Shift | | |||||
* |-----------------------------------------------------------| | |||||
* |Ctrl |Gui |Alt | Space |Alt |Gui |Menu|Ctrl| | |||||
* `-----------------------------------------------------------' | |||||
*/ | |||||
KEYMAP( | |||||
ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,SLCK,PAUS, | |||||
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, INS, HOME,PGUP, NLCK,PSLS,PAST,PMNS, | ||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, | TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, DEL, END, PGDN, P7, P8, P9, | ||||
CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, | CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT, ENT, P4, P5, P6, PPLS, | ||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | ||||
), | ), | ||||
/* 2: Colemak http://colemak.com | |||||
/* 1: Colemak http://colemak.com | |||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| | * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| | ||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | ||||
), | ), | ||||
/* 3: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard | |||||
/* 2: Dvorak http://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard | |||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| | * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| [| ]|Backspa| | ||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | LCTL,LGUI,LALT, SPC, RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT | ||||
), | ), | ||||
/* 4: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ | |||||
/* 3: Workman http://viralintrospection.wordpress.com/2010/09/06/a-different-philosophy-in-designing-keyboard-layouts/ | |||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| | * | `| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backspa| | ||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| |
#include "debug.h" | #include "debug.h" | ||||
#include "keyboard.h" | #include "keyboard.h" | ||||
#include "leonardo_led.h" | |||||
/* LED ping configuration */ | |||||
#define TMK_LED | |||||
//#define LEONARDO_LED | |||||
#if defined(TMK_LED) | |||||
// For TMK converter and Teensy | |||||
#define LED_TX_INIT (DDRD |= (1<<6)) | |||||
#define LED_TX_ON (PORTD |= (1<<6)) | |||||
#define LED_TX_OFF (PORTD &= ~(1<<6)) | |||||
#define LED_TX_TOGGLE (PORTD ^= (1<<6)) | |||||
#elif defined(LEONARDO_LED) | |||||
// For Leonardo(TX LED) | |||||
#define LED_TX_INIT (DDRD |= (1<<5)) | |||||
#define LED_TX_ON (PORTD &= ~(1<<5)) | |||||
#define LED_TX_OFF (PORTD |= (1<<5)) | |||||
#define LED_TX_TOGGLE (PORTD ^= (1<<5)) | |||||
#else | |||||
#define LED_TX_INIT | |||||
#define LED_TX_ON | |||||
#define LED_TX_OFF | |||||
#define LED_TX_TOGGLE | |||||
#endif | |||||
static USB usb_host; | static USB usb_host; | ||||
static void HID_setup() | static void HID_setup() | ||||
{ | { | ||||
if (usb_host.Init() == -1) { | if (usb_host.Init() == -1) { | ||||
debug("HID init: failed\n"); | |||||
LED_TX_OFF; | LED_TX_OFF; | ||||
} | } | ||||
_delay_ms(200); | _delay_ms(200); | ||||
kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); | kbd.SetReportParser(0, (HIDReportParser*)&kbd_parser); | ||||
} | } | ||||
LED_TX_ON; | LED_TX_ON; | ||||
debug_enable = true; | debug_enable = true; | ||||
/* | |||||
debug_matrix = true; | |||||
debug_keyboard = true; | |||||
debug_mouse = true; | |||||
*/ | |||||
host_set_driver(&lufa_driver); | host_set_driver(&lufa_driver); | ||||
keyboard_init(); | keyboard_init(); | ||||
LUFA_setup(); | LUFA_setup(); | ||||
HID_setup(); | |||||
/* NOTE: Don't insert time consuming job here. | |||||
* It'll cause unclear initialization failure when DFU reset(worm start). | |||||
*/ | |||||
sei(); | sei(); | ||||
uint8_t ret; | |||||
// wait for startup of sendchar routine | // wait for startup of sendchar routine | ||||
while (USB_DeviceState != DEVICE_STATE_Configured) ; | while (USB_DeviceState != DEVICE_STATE_Configured) ; | ||||
if (debug_enable) { | if (debug_enable) { | ||||
_delay_ms(1000); | _delay_ms(1000); | ||||
} | } | ||||
debug("init: start\n"); | |||||
HID_setup(); | |||||
debug("init: done\n"); | debug("init: done\n"); | ||||
uint16_t timer; | uint16_t timer; | ||||
// to see loop pulse with oscillo scope | |||||
DDRF = (1<<7); | |||||
for (;;) { | for (;;) { | ||||
PORTF ^= (1<<7); | |||||
keyboard_task(); | keyboard_task(); | ||||
timer = timer_read(); | timer = timer_read(); | ||||
USB_USBTask(); | USB_USBTask(); | ||||
#endif | #endif | ||||
} | } | ||||
return 0; | return 0; | ||||
} | } |
TARGET = x68k_usb_pjrc | TARGET = x68k_usb_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
KC_CRSEL A3 Keyboard CrSel/Props | KC_CRSEL A3 Keyboard CrSel/Props | ||||
KC_EXSEL A4 Keyboard ExSel | KC_EXSEL A4 Keyboard ExSel | ||||
/* Modifiers */ | /* Modifiers */ | ||||
KC_LCTRL KC_LCTRL E0 Keyboard LeftControl | |||||
KC_LCTRL KC_LCTL E0 Keyboard LeftControl | |||||
KC_LSHIFT KC_LSFT E1 Keyboard LeftShift | KC_LSHIFT KC_LSFT E1 Keyboard LeftShift | ||||
KC_LALT E2 Keyboard LeftAlt | KC_LALT E2 Keyboard LeftAlt | ||||
KC_LGUI E3 Keyboard Left GUI(Windows/Apple/Meta key) | KC_LGUI E3 Keyboard Left GUI(Windows/Apple/Meta key) |
See keycode table in [`doc/keycode.txt`](./keycode.txt) for description of keycodes. | See keycode table in [`doc/keycode.txt`](./keycode.txt) for description of keycodes. | ||||
In regard to implementation side most of keycodes are identical with [HID usage][HID_usage](pdf) sent to host for real and some virtual keycodes are defined to support special actions. | In regard to implementation side most of keycodes are identical with [HID usage][HID_usage](pdf) sent to host for real and some virtual keycodes are defined to support special actions. | ||||
[HID_usage]: http://www.usb.org/developers/devclass_docs/Hut1_11.pdf | |||||
[HID_usage]: http://www.usb.org/developers/hidpage/Hut1_12v2.pdf | |||||
TARGET = IIgs_Standard | TARGET = IIgs_Standard | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = alps64 | TARGET = alps64 | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||
/* Default Layer | /* Default Layer | ||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | | |||||
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | | |||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | |||||
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]|Bspc | | |||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|FN1 | | * |Ctrl | A| S| D| F| G| H| J| K| L|Fn3| '|FN1 | | ||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* `-----------------------------------------------------------' | * `-----------------------------------------------------------' | ||||
*/ | */ | ||||
[0] = KEYMAP_AEK( \ | [0] = KEYMAP_AEK( \ | ||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, \ | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, \ | |||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, \ | |||||
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \ | |||||
LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN1, \ | LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN1, \ | ||||
LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, \ | LSFT,Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT, \ | ||||
LCTL,LGUI,LALT, FN4, RALT,FN5, RCTL), | |||||
LCTL,LGUI,LALT, FN4, RALT,FN5, FN0), | |||||
/* HHKB mode[HHKB Fn] | /* HHKB mode[HHKB Fn] | ||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|Del | | |||||
* |Esc| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12| ` | | |||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Backs| | |||||
* |Caps | | | | | | | |Psc|Slk|Pus|Up | |Del | | |||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | | * |Contro|VoD|VoU|Mut| | | *| /|Hom|PgU|Lef|Rig|Enter | | ||||
* |-----------------------------------------------------------| | * |-----------------------------------------------------------| | ||||
* `-----------------------------------------------------------' | * `-----------------------------------------------------------' | ||||
*/ | */ | ||||
[1] = KEYMAP_AEK( \ | [1] = KEYMAP_AEK( \ | ||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \ | |||||
CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, BSPC, \ | |||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ | |||||
CAPS,NO, NO, NO, NO, NO, NO, NO, PSCR,SLCK,PAUS,UP, NO, DEL, \ | |||||
LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \ | LCTL,VOLD,VOLU,MUTE,NO, NO, PAST,PSLS,HOME,PGUP,LEFT,RGHT,TRNS, \ | ||||
LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT, \ | LSFT,NO, NO, NO, NO, NO, PPLS,PMNS,END, PGDN,DOWN,RSFT, \ | ||||
LCTL,LGUI,LALT, TRNS, RALT,RGUI,RCTL), | |||||
LCTL,LGUI,LALT, TRNS, RALT,RGUI,TRNS), | |||||
/* Vi mode[Slash] | /* Vi mode[Slash] | ||||
* ,-----------------------------------------------------------. | * ,-----------------------------------------------------------. | ||||
* `-----------------------------------------------------------' | * `-----------------------------------------------------------' | ||||
*/ | */ | ||||
[2] = KEYMAP_AEK( \ | [2] = KEYMAP_AEK( \ | ||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \ | |||||
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \ | |||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ | |||||
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, DEL, \ | |||||
LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \ | LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \ | ||||
LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT, \ | LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT, \ | ||||
LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL), | LCTL,LGUI,LALT, SPC, RALT,RGUI,RCTL), | ||||
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel | * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel | ||||
*/ | */ | ||||
[3] = KEYMAP_AEK( \ | [3] = KEYMAP_AEK( \ | ||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \ | |||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ | |||||
FN8, NO, NO, NO, NO, NO, NO, WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \ | FN8, NO, NO, NO, NO, NO, NO, WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \ | ||||
LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,NO, ENT, \ | LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,TRNS,NO, ENT, \ | ||||
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT, \ | LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT, \ | ||||
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel | * Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel | ||||
*/ | */ | ||||
[4] = KEYMAP_AEK( \ | [4] = KEYMAP_AEK( \ | ||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, DEL, \ | |||||
GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, GRV, \ | |||||
FN8, NO, NO, NO, NO, NO, NO, WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \ | FN8, NO, NO, NO, NO, NO, NO, WH_D,MS_U,WH_U,RGHT,FN9, FN10,FN8, \ | ||||
LCTL,VOLD,VOLU,MUTE,NO, NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, \ | LCTL,VOLD,VOLU,MUTE,NO, NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, \ | ||||
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT, \ | LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT, \ | ||||
* Fn action definition | * Fn action definition | ||||
*/ | */ | ||||
const uint16_t PROGMEM fn_actions[] = { | const uint16_t PROGMEM fn_actions[] = { | ||||
[0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used) | |||||
[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* | ||||
[3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon* | [3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon* |
TARGET = gh60_lufa | TARGET = gh60_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = gh60_pjrc | TARGET = gh60_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
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 |
TARGET = ghostsquid_lufa | TARGET = ghostsquid_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = hbkb_lufa | TARGET = hbkb_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = hhkb_lufa | TARGET = hhkb_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
#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 | ||||
#OPT_DEFS += -DNO_ACTION_TAPPING | |||||
#OPT_DEFS += -DNO_ACTION_LAYER | |||||
#OPT_DEFS += -DNO_ACTION_MACRO | |||||
# | # | ||||
# Keymap file | # Keymap file | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION | debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION | ||||
debug-on: all | debug-on: all |
TARGET = hhkb_pjrc | TARGET = hhkb_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = hhkb_rn42 | TARGET = hhkb_rn42 | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include rn42.mk | include rn42.mk | ||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION | debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION | ||||
debug-on: all | debug-on: all |
Vcc and GND use 3(2) lines each, other lines are for keyboard signaling. | Vcc and GND use 3(2) lines each, other lines are for keyboard signaling. | ||||
HHKB connector lines: | HHKB connector lines: | ||||
JP Pro2 Pro Function Description Teensy++ pins | |||||
JP Pro2 Pro Function Description TMK pin usage | |||||
-------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ||||
1 Vcc(5V) 5V | 1 Vcc(5V) 5V | ||||
1 1 2 Vcc(5V) 5V | 1 1 2 Vcc(5V) 5V | ||||
2 2 3 Vcc(5V) 5V | 2 2 3 Vcc(5V) 5V | ||||
3 3 4 TP1684 KEY: Low(0) when key pressed PE6 input(with pullup) | |||||
4 4 5 TP1684 KEY_PREV: make threshold PE7 output | |||||
3 3 4 TP1684 ~KEY: Low(0) when key is pressed PD7 input(with pullup) | |||||
4 4 5 TP1684 HYS: High(1) when key is pressed PB7 output | |||||
5 5 6 HC4051 A(bit0)\ PB0 output | 5 5 6 HC4051 A(bit0)\ PB0 output | ||||
6 6 7 HC4051 B(bit1) > select row 0-7 PB1 output | 6 6 7 HC4051 B(bit1) > select row 0-7 PB1 output | ||||
7 7 8 HC4051 C(bit2)/ PB2 output | 7 7 8 HC4051 C(bit2)/ PB2 output | ||||
8 8 9 LS145 A(bit0)\ PB3 output | 8 8 9 LS145 A(bit0)\ PB3 output | ||||
9 9 10 LS145 B(bit1) > select column 0-7 PB4 output | 9 9 10 LS145 B(bit1) > select column 0-7 PB4 output | ||||
10 10 11 LS145 C(bit2)/ PB5 output | 10 10 11 LS145 C(bit2)/ PB5 output | ||||
11 11 12 LS145 D(enable) Low(0) enables selected column PB6 output | |||||
11 11 12 LS145 ~D(enable) Low(0) enables selected column PB6 output | |||||
12 12 13 GND GND | 12 12 13 GND GND | ||||
13 13 14 GND GND | 13 13 14 GND GND | ||||
15 GND | 15 GND | ||||
14 HC4051(Z2) ~Enable of Z2 row0-7 | |||||
15 HC4051(Z3) ~Enable of Z3 row8-15 | |||||
14 HC4051(Z2) ~Enable of Z2 row0-7 PC6 | |||||
15 HC4051(Z3) ~Enable of Z3 row8-15 PC7 | |||||
NOTE: guessing pin5(KEY_PREV) may work for hysteresis of capacitive sensing. | |||||
NOTE: Probably HYS changes threshold for upstroke and makes hysteresis in the result. | |||||
NOTE: HYS should be given High(1) when previous KEY state is Low(0). | |||||
NOTE: 1KOhm didn't work as pullup resistor on KEY. AVR internal pullup or 10KOhm resistor was OK. | NOTE: 1KOhm didn't work as pullup resistor on KEY. AVR internal pullup or 10KOhm resistor was OK. | ||||
NOTE: JP has two HC4051(Z2,Z3) and line 5, 6 and 7 are connected to both of them. | NOTE: JP has two HC4051(Z2,Z3) and line 5, 6 and 7 are connected to both of them. | ||||
| <-+ | <6-------|-|-|-|-|-|-|-|--|R|-+ | | <-+ | <6-------|-|-|-|-|-|-|-|--|R|-+ | ||||
| 1 4 | | | <7-------|-|-|-|-|-|-|-|--|R|-+ | | 1 4 | | | <7-------|-|-|-|-|-|-|-|--|R|-+ | ||||
+---V---^-+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8 | +---V---^-+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8 | ||||
KEY PREV | A B C +-----------------+ | |||||
KEY HYS | A B C +-----------------+ | |||||
| | +-^----+ | | | | LS145 | | | | +-^----+ | | | | LS145 | | ||||
Vcc | | |BU9831| | | | +-^--^--^--^------+ | Vcc | | |BU9831| | | | +-^--^--^--^------+ | ||||
--- | | +------+ | | | A B C D +-------+ | --- | | +------+ | | | A B C D +-------+ | ||||
| | +----> <6-----------|-|-|-|-|----|R|-+ | | | +----> <6-----------|-|-|-|-|----|R|-+ | ||||
| | | | | A B C <7-----------|-|-|-|-|----|R|-+ | | | | | | A B C <7-----------|-|-|-|-|----|R|-+ | ||||
+---V---^-+ | | +-^-^-^--+ | | | | | | | +---V---^-+ | | +-^-^-^--+ | | | | | | | ||||
KEY PREV | | | | | | | | | | | | |||||
KEY HYS | | | | | | | | | | | | |||||
| | | | +--------+ | | | | | | | | | | | +--------+ | | | | | | | ||||
| | | | | HC4051 <8-----------|-|-|-|-|----|R|-+ | | | | | | HC4051 <8-----------|-|-|-|-|----|R|-+ | ||||
| | | | | Z3 <9-----------|-|-|-|-|----|R|-+ | | | | | | Z3 <9-----------|-|-|-|-|----|R|-+ | ||||
0123456701234567 selected column | 0123456701234567 selected column | ||||
3) Wait 5us after column select, then set prev, strobe colD to spit out key status and read it. | 3) Wait 5us after column select, then set prev, strobe colD to spit out key status and read it. | ||||
prev _~~~~_____ 20us if previous key state is low | |||||
hys _~~~~_____ 20us if previous key state is low | |||||
colD ~~~__~~~~~ 10us strobe | colD ~~~__~~~~~ 10us strobe | ||||
key ~~~____~~~ 22us indicates current state of the key | key ~~~____~~~ 22us indicates current state of the key | ||||
#ifdef HHKB_JP | #ifdef HHKB_JP | ||||
/* row extention for HHKB JP */ | /* row extention for HHKB JP */ | ||||
DDRC |= (1<<6|1<<7); | DDRC |= (1<<6|1<<7); | ||||
PORTC &= ~(1<<6|1<<7); | |||||
PORTC |= (1<<6|1<<7); | |||||
#endif | #endif | ||||
KEY_UNABLE(); | KEY_UNABLE(); | ||||
KEY_PREV_OFF(); | KEY_PREV_OFF(); |
/* | |||||
/* | |||||
* HHKB Layout | * HHKB Layout | ||||
*/ | */ | ||||
#include "keymap_common.h" | #include "keymap_common.h" | ||||
* `-----------------------------------------------------------' | * `-----------------------------------------------------------' | ||||
* | | | | | | | * | | | | | | | ||||
* `-------------------------------------------' | * `-------------------------------------------' | ||||
*/ | |||||
*/ | |||||
KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \ | ||||
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \ | CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \ | ||||
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \ | TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \ | ||||
*/ | */ | ||||
#ifdef KEYMAP_SECTION_ENABLE | #ifdef KEYMAP_SECTION_ENABLE | ||||
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = { | ||||
[0] = ACTION_LAYER_MOMENTARY(1), | |||||
[1] = ACTION_LAYER_MOMENTARY(2), | |||||
[2] = ACTION_LAYER_MOMENTARY(3), | |||||
[3] = ACTION_LAYER_MOMENTARY(4), | |||||
[4] = ACTION_LAYER_MOMENTARY(5), | |||||
[5] = ACTION_LAYER_MOMENTARY(6), | |||||
[6] = ACTION_LAYER_MOMENTARY(7), | |||||
[7] = ACTION_LAYER_TOGGLE(1), | |||||
[8] = ACTION_LAYER_TOGGLE(2), | |||||
[9] = ACTION_LAYER_TOGGLE(3), | |||||
[10] = ACTION_LAYER_TAP_TOGGLE(1), | |||||
[11] = ACTION_LAYER_TAP_TOGGLE(2), | |||||
[12] = ACTION_LAYER_TAP_TOGGLE(3), | |||||
[13] = ACTION_LAYER_TAP_KEY(1, KC_A), | |||||
[14] = ACTION_LAYER_TAP_KEY(2, KC_F), | |||||
[15] = ACTION_LAYER_TAP_KEY(3, KC_J), | |||||
[16] = ACTION_LAYER_TAP_KEY(4, KC_SPACE), | |||||
[17] = ACTION_LAYER_TAP_KEY(5, KC_SCOLON), | |||||
[18] = ACTION_LAYER_TAP_KEY(6, KC_QUOTE), | |||||
[19] = ACTION_LAYER_TAP_KEY(7, KC_SLASH), | |||||
[20] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_SPACE), | |||||
[21] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_SPACE), | |||||
[22] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_QUOTE), | |||||
[23] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENTER), | |||||
[24] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_ESC), | |||||
[25] = ACTION_MODS_TAP_KEY(MOD_LCTL, KC_BSPACE), | |||||
[26] = ACTION_MODS_ONESHOT(MOD_LCTL), | |||||
[27] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_ESC), | |||||
[28] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_BSPACE), | |||||
[29] = ACTION_MODS_ONESHOT(MOD_LSFT), | |||||
[30] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_ESC), | |||||
[31] = ACTION_MODS_TAP_KEY(MOD_RSFT, KC_BSPACE), | |||||
}; | |||||
#else | #else | ||||
const uint16_t fn_actions[] PROGMEM = { | const uint16_t fn_actions[] PROGMEM = { | ||||
#endif | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | |||||
[0] = ACTION_LAYER_MOMENTARY(1), | |||||
}; | }; | ||||
#endif |
// NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE. | // NOTE: KEY_STATE keep its state in 20us after KEY_ENABLE. | ||||
// This takes 25us or more to make sure KEY_STATE returns to idle state. | // This takes 25us or more to make sure KEY_STATE returns to idle state. | ||||
#ifdef HHKB_JP | |||||
// Looks like JP needs faster scan due to its twice larger matrix | |||||
// or it can drop keys in fast key typing | |||||
_delay_us(30); | |||||
#else | |||||
_delay_us(75); | _delay_us(75); | ||||
#endif | |||||
} | } | ||||
if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32(); | if (matrix[row] ^ matrix_prev[row]) matrix_last_modified = timer_read32(); | ||||
} | } |
TARGET = hhkb_iwrap | TARGET = hhkb_iwrap | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/iwrap.mk | |||||
include $(TMK_DIR)/protocol/iwrap.mk | |||||
# TODO: to be selectable: V-USB, LUFA or PJRC | # TODO: to be selectable: V-USB, LUFA or PJRC | ||||
#include $(TOP_DIR)/protocol/vusb.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
#include $(TMK_DIR)/protocol/vusb.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = hhkb_vusb | TARGET = hhkb_vusb | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/vusb.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/vusb.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
debug-on: EXTRAFLAGS += -DDEBUG | debug-on: EXTRAFLAGS += -DDEBUG | ||||
debug-on: all | debug-on: all |
TARGET = hid_liber_lufa | TARGET = hid_liber_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
ansi: OPT_DEFS += -DLAYOUT_ANSI | ansi: OPT_DEFS += -DLAYOUT_ANSI | ||||
ansi: all | ansi: all |
TARGET = hid_liber_pjrc | TARGET = hid_liber_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
ansi: OPT_DEFS += -DLAYOUT_ANSI | ansi: OPT_DEFS += -DLAYOUT_ANSI | ||||
ansi: all | ansi: all |
PROJECT = infinity | PROJECT = infinity | ||||
TMK_DIR = ../.. | |||||
MBED_DIR = $(TMK_DIR)/mbed-sdk | |||||
TMK_DIR = ../../tmk_core | |||||
MBED_DIR = $(TMK_DIR)/tool/mbed/mbed-sdk | |||||
#VPATH += $(MBED_DIR):$(TMK_DIR) | #VPATH += $(MBED_DIR):$(TMK_DIR) | ||||
vpath %.s .:$(MBED_DIR):$(TMK_DIR) | vpath %.s .:$(MBED_DIR):$(TMK_DIR) |
$(OBJDIR)/mbed-infinity/system_MK20D5.o \ | $(OBJDIR)/mbed-infinity/system_MK20D5.o \ | ||||
$(OBJDIR)/mbed-infinity/USBHAL_KL25Z.o \ | $(OBJDIR)/mbed-infinity/USBHAL_KL25Z.o \ | ||||
$(OBJDIR)/mbed-infinity/startup_MK20D5.o \ | $(OBJDIR)/mbed-infinity/startup_MK20D5.o \ | ||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/analogin_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/gpio_irq_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/i2c_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pinmap.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/port_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/pwmout_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/rtc_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/serial_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/sleep.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/spi_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.o | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/analogin_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/gpio_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/gpio_irq_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/i2c_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/pinmap.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/port_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/pwmout_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/rtc_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/serial_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/sleep.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/spi_api.o \ | |||||
$(OBJDIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/us_ticker.o | |||||
INCLUDE_PATHS += \ | INCLUDE_PATHS += \ | ||||
-Imbed \ | -Imbed \ | ||||
-I$(MBED_DIR)/libraries/mbed/targets \ | -I$(MBED_DIR)/libraries/mbed/targets \ | ||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis \ | -I$(MBED_DIR)/libraries/mbed/targets/cmsis \ | ||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale \ | -I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale \ | ||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M \ | |||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \ | |||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX \ | |||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M \ | |||||
-I$(MBED_DIR)/libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M/TOOLCHAIN_GCC_ARM \ | |||||
-I$(MBED_DIR)/libraries/mbed/targets/hal \ | -I$(MBED_DIR)/libraries/mbed/targets/hal \ | ||||
-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \ | -I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale \ | ||||
-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M | |||||
-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX \ | |||||
-I$(MBED_DIR)/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20XX/TARGET_K20D50M | |||||
LINKER_SCRIPT = mbed-infinity/infinity.ld | LINKER_SCRIPT = mbed-infinity/infinity.ld |
TARGET = kittenpaw_lufa | TARGET = kittenpaw_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = kmac_lufa | TARGET = kmac_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
winkey: OPT_DEFS += -DLAYOUT_WINKEY | winkey: OPT_DEFS += -DLAYOUT_WINKEY | ||||
winkey: all | winkey: all |
TARGET = kmac_pjrc | TARGET = kmac_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
winkey: OPT_DEFS += -DLAYOUT_WINKEY | winkey: OPT_DEFS += -DLAYOUT_WINKEY | ||||
winkey: all | winkey: all |
TARGET = lightpad_lufa | TARGET = lightpad_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = lightsaber_lufa | TARGET = lightsaber_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
winkey: OPT_DEFS += -DLAYOUT_WINKEY | winkey: OPT_DEFS += -DLAYOUT_WINKEY | ||||
winkey: all | winkey: all |
TARGET = lightsaber_pjrc | TARGET = lightsaber_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
winkey: OPT_DEFS += -DLAYOUT_WINKEY | winkey: OPT_DEFS += -DLAYOUT_WINKEY | ||||
winkey: all | winkey: all |
TARGET = macway_lufa | TARGET = macway_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = macway_pjrc | TARGET = macway_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
PROJECT = mbed_onekey | PROJECT = mbed_onekey | ||||
TMK_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
MBED_DIR = $(TMK_DIR)/mbed-sdk | MBED_DIR = $(TMK_DIR)/mbed-sdk | ||||
#VPATH += $(MBED_DIR):$(TMK_DIR) | #VPATH += $(MBED_DIR):$(TMK_DIR) |
TARGET = nerd_lufa | TARGET = nerd_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = onekey_lufa | TARGET = onekey_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = onekey_pjrc | TARGET = onekey_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/protocol.mk | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/protocol.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/rules.mk |
TARGET = phantom_lufa | TARGET = phantom_lufa | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/lufa.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/lufa.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
ansi: OPT_DEFS += -DLAYOUT_ANSI | ansi: OPT_DEFS += -DLAYOUT_ANSI | ||||
ansi: all | ansi: all |
TARGET = phantom_pjrc | TARGET = phantom_pjrc | ||||
# Directory common source filess exist | # Directory common source filess exist | ||||
TOP_DIR = ../.. | |||||
TMK_DIR = ../../tmk_core | |||||
# Directory keyboard dependent files exist | # Directory keyboard dependent files exist | ||||
TARGET_DIR = . | TARGET_DIR = . | ||||
# Search Path | # Search Path | ||||
VPATH += $(TARGET_DIR) | VPATH += $(TARGET_DIR) | ||||
VPATH += $(TOP_DIR) | |||||
VPATH += $(TMK_DIR) | |||||
include $(TOP_DIR)/protocol/pjrc.mk | |||||
include $(TOP_DIR)/common.mk | |||||
include $(TOP_DIR)/rules.mk | |||||
include $(TMK_DIR)/protocol/pjrc.mk | |||||
include $(TMK_DIR)/common.mk | |||||
include $(TMK_DIR)/rules.mk | |||||
ansi: OPT_DEFS += -DLAYOUT_ANSI | ansi: OPT_DEFS += -DLAYOUT_ANSI | ||||
ansi: all | ansi: all |
# | |||||
# LUFA Library | |||||
# Copyright (C) Dean Camera, 2012. | |||||
# | |||||
# dean [at] fourwalledcubicle [dot] com | |||||
# www.lufa-lib.org | |||||
# | |||||
LUFA_BUILD_MODULES += SOURCES | |||||
LUFA_BUILD_TARGETS += | |||||
LUFA_BUILD_MANDATORY_VARS += LUFA_PATH ARCH | |||||
LUFA_BUILD_OPTIONAL_VARS += | |||||
LUFA_BUILD_PROVIDED_VARS += LUFA_SRC_USB LUFA_SRC_USBCLASS LUFA_SRC_TEMPERATURE LUFA_SRC_SERIAL LUFA_SRC_TWI LUFA_SRC_PLATFORM | |||||
LUFA_BUILD_PROVIDED_MACROS += | |||||
# ----------------------------------------------------------------------------- | |||||
# LUFA Sources Buildsystem Makefile Module. | |||||
# ----------------------------------------------------------------------------- | |||||
# DESCRIPTION: | |||||
# Provides a set of makefile variables for the various LUFA module sources. | |||||
# Once included, the sources required to use a given LUFA module will become | |||||
# available using the makefile variable names listed in the LUFA project | |||||
# documentation. | |||||
# ----------------------------------------------------------------------------- | |||||
# TARGETS: | |||||
# | |||||
# (None) | |||||
# | |||||
# MANDATORY PARAMETERS: | |||||
# | |||||
# LUFA_PATH - Path to the LUFA library core | |||||
# ARCH - Device architecture name | |||||
# | |||||
# OPTIONAL PARAMETERS: | |||||
# | |||||
# (None) | |||||
# | |||||
# PROVIDED VARIABLES: | |||||
# | |||||
# LUFA_SRC_USB - List of LUFA USB driver source files | |||||
# LUFA_SRC_USBCLASS - List of LUFA USB Class driver source files | |||||
# LUFA_SRC_TEMPERATURE - List of LUFA temperature sensor driver source | |||||
# files | |||||
# LUFA_SRC_SERIAL - List of LUFA Serial U(S)ART driver source files | |||||
# LUFA_SRC_TWI - List of LUFA TWI driver source files | |||||
# LUFA_SRC_PLATFORM - List of LUFA architecture specific platform | |||||
# management source files | |||||
# | |||||
# PROVIDED MACROS: | |||||
# | |||||
# (None) | |||||
# | |||||
# ----------------------------------------------------------------------------- | |||||
SHELL = /bin/sh | |||||
ERROR_IF_UNSET ?= $(if $(filter undefined, $(origin $(strip $(1)))), $(error Makefile $(strip $(1)) value not set)) | |||||
ERROR_IF_EMPTY ?= $(if $(strip $($(strip $(1)))), , $(error Makefile $(strip $(1)) option cannot be blank)) | |||||
ERROR_IF_NONBOOL ?= $(if $(filter Y N, $($(strip $(1)))), , $(error Makefile $(strip $(1)) option must be Y or N)) | |||||
# Sanity check user supplied values | |||||
$(foreach MANDATORY_VAR, $(LUFA_BUILD_MANDATORY_VARS), $(call ERROR_IF_UNSET, $(MANDATORY_VAR))) | |||||
$(call ERROR_IF_EMPTY, LUFA_PATH) | |||||
$(call ERROR_IF_EMPTY, ARCH) | |||||
# Allow LUFA_ROOT_PATH to be overridden elsewhere to support legacy LUFA makefiles | |||||
LUFA_ROOT_PATH ?= $(patsubst %/,%,$(LUFA_PATH)) | |||||
# Construct LUFA module source variables | |||||
LUFA_SRC_USB := $(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Device_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Endpoint_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Host_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/Pipe_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBController_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/USBInterrupt_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/EndpointStream_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/$(ARCH)/PipeStream_$(ARCH).c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/ConfigDescriptors.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/DeviceStandardReq.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/Events.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/HostStandardReq.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Core/USBTask.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Common/HIDParser.c | |||||
LUFA_SRC_USBCLASS := $(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/AudioClassDevice.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/CDCClassDevice.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/HIDClassDevice.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MassStorageClassDevice.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/MIDIClassDevice.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Device/RNDISClassDevice.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/AudioClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/CDCClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/HIDClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MassStorageClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/MIDIClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/PrinterClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/RNDISClassHost.c \ | |||||
$(LUFA_ROOT_PATH)/Drivers/USB/Class/Host/StillImageClassHost.c | |||||
LUFA_SRC_TEMPERATURE := $(LUFA_ROOT_PATH)/Drivers/Board/Temperature.c | |||||
LUFA_SRC_SERIAL := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/Serial_$(ARCH).c | |||||
LUFA_SRC_TWI := $(LUFA_ROOT_PATH)/Drivers/Peripheral/$(ARCH)/TWI_$(ARCH).c | |||||
ifeq ($(ARCH), UC3) | |||||
LUFA_SRC_PLATFORM := $(LUFA_ROOT_PATH)/Platform/UC3/Exception.S \ | |||||
$(LUFA_ROOT_PATH)/Platform/UC3/InterruptManagement.c | |||||
else | |||||
LUFA_SRC_PLATFORM := | |||||
endif | |||||
# Build a list of all available module sources | |||||
LUFA_SRC_ALL_FILES := $(LUFA_SRC_USB) \ | |||||
$(LUFA_SRC_USBCLASS) \ | |||||
$(LUFA_SRC_TEMPERATURE) \ | |||||
$(LUFA_SRC_SERIAL) \ | |||||
$(LUFA_SRC_TWI) \ | |||||
$(LUFA_SRC_PLATFORM) |
/** \file | |||||
* | |||||
* This file contains special DoxyGen information for the generation of the main page and other special | |||||
* documentation pages. It is not a project source file. | |||||
*/ | |||||
/** \page Page_TokenSummary Summary of Compile Tokens | |||||
* | |||||
* The following lists all the possible tokens which can be defined in a project makefile, and passed to the | |||||
* compiler via the -D switch, to alter the LUFA library code. These tokens may alter the library behaviour, | |||||
* or remove features unused by a given application in order to save flash space. | |||||
* | |||||
* \note If the \c USE_LUFA_CONFIG_HEADER token is defined, the library will include a header file named \c LUFAConfig.h located | |||||
* in the user directory where the below compile time tokens may be defined. This allows for an alternative to makefile | |||||
* defined tokens for configuring the library. | |||||
* | |||||
* \section Sec_SummaryNonUSBTokens Non USB Related Tokens | |||||
* This section describes compile tokens which affect non-USB sections of the LUFA library. | |||||
* | |||||
* - <b>DISABLE_TERMINAL_CODES</b> - (\ref Group_Terminal) - <i>All Architectures</i> \n | |||||
* If an application contains ANSI terminal control codes listed in TerminalCodes.h, it might be desired to remove them | |||||
* at compile time for use with a terminal which is non-ANSI control code aware, without modifying the source code. If | |||||
* this token is defined, all ANSI control codes in the application code from the TerminalCodes.h header are removed from | |||||
* the source code at compile time. | |||||
* | |||||
* | |||||
* \section Sec_SummaryUSBClassTokens USB Class Driver Related Tokens | |||||
* This section describes compile tokens which affect USB class-specific drivers in the LUFA library. | |||||
* | |||||
* - <b>HID_HOST_BOOT_PROTOCOL_ONLY</b> - (\ref Group_USBClassHIDHost) - <i>All Architectures</i> \n | |||||
* By default, the USB HID Host class driver is designed to work with HID devices using either the Boot or Report HID | |||||
* communication protocols. On devices where the Report protocol is not used (i.e. in applications where only basic | |||||
* Mouse or Keyboard operation is desired, using boot compatible devices), the code responsible for the Report protocol | |||||
* mode can be removed to save space in the compiled application by defining this token. When defined, it is still necessary | |||||
* to explicitly put the attached device into Boot protocol mode via a call to \ref HID_Host_SetBootProtocol(). | |||||
* | |||||
* - <b>HID_STATETABLE_STACK_DEPTH</b>=<i>x</i> - (\ref Group_HIDParser) - <i>All Architectures</i> \n | |||||
* HID reports may contain PUSH and POP elements, to store and retrieve the current HID state table onto a stack. This | |||||
* allows for reports to save the state table before modifying it slightly for a data item, and then restore the previous | |||||
* state table in a compact manner. This token may be defined to a non-zero 8-bit value to give the maximum depth of the state | |||||
* table stack. If not defined, this defaults to the value indicated in the HID.h file documentation. | |||||
* | |||||
* - <b>HID_USAGE_STACK_DEPTH</b>=<i>x</i> - (\ref Group_HIDParser) - <i>All Architectures</i> \n | |||||
* HID reports generally contain many USAGE elements, which are assigned to INPUT, OUTPUT and FEATURE items in succession | |||||
* when multiple items are defined at once (via REPORT COUNT elements). This allows for several items to be defined with | |||||
* different usages in a compact manner. This token may be defined to a non-zero 8-bit value to set the maximum depth of the | |||||
* usage stack, indicating the maximum number of USAGE items which can be stored temporarily until the next INPUT, OUTPUT | |||||
* and FEATURE item. If not defined, this defaults to the value indicated in the HID.h file documentation. | |||||
* | |||||
* - <b>HID_MAX_COLLECTIONS</b>=<i>x</i> - (\ref Group_HIDParser) - <i>All Architectures</i> \n | |||||
* HID reports generally contain several COLLECTION elements, used to group related data items together. Collection information | |||||
* is stored separately in the processed usage structure (and referred to by the data elements in the structure) to save space. | |||||
* This token may be defined to a non-zero 8-bit value to set the maximum number of COLLECTION items which can be processed by the | |||||
* parser into the resultant processed report structure. If not defined, this defaults to the value indicated in the HID.h file | |||||
* documentation. | |||||
* | |||||
* - <b>HID_MAX_REPORTITEMS</b>=<i>x</i> - (\ref Group_HIDParser) - <i>All Architectures</i> \n | |||||
* All HID reports contain one or more INPUT, OUTPUT and/or FEATURE items describing the data which can be sent to and from the HID | |||||
* device. Each item has associated usages, bit offsets in the item reports and other associated data indicating the manner in which | |||||
* the report data should be interpreted by the host. This token may be defined to a non-zero 8-bit value to set the maximum number of | |||||
* data elements which can be stored in the processed HID report structure, including INPUT, OUTPUT and (if enabled) FEATURE items. | |||||
* If a item has a multiple count (i.e. a REPORT COUNT of more than 1), each item in the report count is placed separately in the | |||||
* processed HID report table. If not defined, this defaults to the value indicated in the HID.h file documentation. | |||||
* | |||||
* - <b>HID_MAX_REPORT_IDS</b>=<i>x</i> - (\ref Group_HIDParser) - <i>All Architectures</i> \n | |||||
* HID reports may contain several report IDs, to logically distinguish grouped device data from one another - for example, a combination | |||||
* keyboard and mouse might use report IDs to separate the keyboard reports from the mouse reports. In order to determine the size of each | |||||
* report, and thus know how many bytes must be read or written, the size of each report (IN, OUT and FEATURE) must be calculated and | |||||
* stored. This token may be defined to a non-zero 8-bit value to set the maximum number of report IDs in a device which can be processed | |||||
* and their sizes calculated/stored into the resultant processed report structure. If not defined, this defaults to the value indicated in | |||||
* the HID.h file documentation. | |||||
* | |||||
* - <b>NO_CLASS_DRIVER_AUTOFLUSH</b> - (\ref Group_USBClassDrivers) - <i>All Architectures</i> \n | |||||
* Many of the device and host mode class drivers automatically flush any data waiting to be written to an interface, when the corresponding | |||||
* USB management task is executed. This is usually desirable to ensure that any queued data is sent as soon as possible once and new data is | |||||
* constructed in the main program loop. However, if flushing is to be controlled manually by the user application via the *_Flush() commands, | |||||
* the compile time token may be defined in the application's makefile to disable automatic flushing during calls to the class driver USB | |||||
* management tasks. | |||||
* | |||||
* | |||||
* \section Sec_SummaryUSBTokens General USB Driver Related Tokens | |||||
* This section describes compile tokens which affect USB driver stack as a whole in the LUFA library. | |||||
* | |||||
* - <b>ORDERED_EP_CONFIG</b> - (\ref Group_EndpointManagement , \ref Group_PipeManagement) - <i>AVR8, UC3</i> \n | |||||
* The USB AVRs do not allow for Endpoints and Pipes to be configured out of order; they <i>must</i> be configured in an ascending order to | |||||
* prevent data corruption issues. However, by default LUFA employs a workaround to allow for unordered Endpoint/Pipe initialization. This compile | |||||
* time token may be used to restrict the initialization order to ascending indexes only in exchange for a smaller compiled binary size. Use | |||||
* caution when applied to applications using the library USB Class drivers; the user application must ensure that all endpoints and pipes are | |||||
* allocated sequentially. | |||||
* | |||||
* - <b>USE_STATIC_OPTIONS</b>=<i>x</i> - (\ref Group_USBManagement) - <i>All Architectures</i> \n | |||||
* By default, the USB_Init() function accepts dynamic options at runtime to alter the library behaviour, including whether the USB pad | |||||
* voltage regulator is enabled, and the device speed when in device mode. By defining this token to a mask comprised of the USB options | |||||
* mask defines usually passed as the Options parameter to USB_Init(), the resulting compiled binary can be decreased in size by removing | |||||
* the dynamic options code, and replacing it with the statically set options. When defined, the USB_Init() function no longer accepts an | |||||
* Options parameter. | |||||
* | |||||
* - <b>USB_DEVICE_ONLY</b> - (\ref Group_USBManagement) - <i>All Architectures</i> \n | |||||
* For the USB AVR models supporting both device and host USB modes, the USB_Init() function contains a Mode parameter which specifies the | |||||
* mode the library should be initialized to. If only device mode is required, the code for USB host mode can be removed from the binary to | |||||
* save space. When defined, the USB_Init() function no longer accepts a Mode parameter. This define is irrelevant on smaller USB AVRs which | |||||
* do not support host mode. | |||||
* | |||||
* - <b>USB_HOST_ONLY</b> - (\ref Group_USBManagement) - <i>All Architectures</i> \n | |||||
* Same as USB_DEVICE_ONLY, except the library is fixed to USB host mode rather than USB device mode. Not available on some USB AVR models. | |||||
* | |||||
* - <b>USB_STREAM_TIMEOUT_MS</b>=<i>x</i> - (\ref Group_USBManagement) - <i>All Architectures</i> \n | |||||
* When endpoint and/or pipe stream functions are used, by default there is a timeout between each transfer which the connected device or host | |||||
* must satisfy, or the stream function aborts the remaining data transfer. This token may be defined to a non-zero 16-bit value to set the timeout | |||||
* period for stream transfers, specified in milliseconds. If not defined, the default value specified in LowLevel.h is used instead. | |||||
* | |||||
* - <b>NO_LIMITED_CONTROLLER_CONNECT</b> - (\ref Group_Events) - <i>AVR8 Only</i> \n | |||||
* On the smaller USB AVRs, the USB controller lacks VBUS events to determine the physical connection state of the USB bus to a host. In lieu of | |||||
* VBUS events, the library attempts to determine the connection state via the bus suspension and wake up events instead. This however may be | |||||
* slightly inaccurate due to the possibility of the host suspending the bus while the device is still connected. If accurate connection status is | |||||
* required, the VBUS line of the USB connector should be routed to an AVR pin to detect its level, so that the USB_DeviceState global | |||||
* can be accurately set and the \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events manually raised by the RAISE_EVENT macro. | |||||
* When defined, this token disables the library's auto-detection of the connection state by the aforementioned suspension and wake up events. | |||||
* | |||||
* - <b>NO_SOF_EVENTS</b> - (\ref Group_Events) - <i>All Architectures</i> \n | |||||
* By default, there exists a LUFA application event for the start of each USB frame while the USB bus is not suspended in either host or device mode. | |||||
* This event can be selectively enabled or disabled by calling the appropriate device or host mode function. When this compile time token is defined, | |||||
* the ability to receive USB Start of Frame events via the \ref EVENT_USB_Device_StartOfFrame() or \ref EVENT_USB_Host_StartOfFrame() events is removed, | |||||
* reducing the compiled program's binary size. | |||||
* | |||||
* | |||||
* \section Sec_SummaryUSBDeviceTokens USB Device Mode Driver Related Tokens | |||||
* This section describes compile tokens which affect USB driver stack of the LUFA library when used in Device mode. | |||||
* | |||||
* - <b>USE_RAM_DESCRIPTORS</b> - (\ref Group_StdDescriptors) - <i>AVR8 Only</i> \n | |||||
* Define this token to indicate to the USB driver that all device descriptors are stored in RAM, rather than being located in any one | |||||
* of the AVR's memory spaces. RAM descriptors may be desirable in applications where the descriptors need to be modified at runtime. | |||||
* | |||||
* - <b>USE_FLASH_DESCRIPTORS</b> - (\ref Group_StdDescriptors) - <i>AVR8 Only</i> \n | |||||
* Similar to USE_RAM_DESCRIPTORS, but all descriptors are stored in the AVR's FLASH memory rather than RAM. | |||||
* | |||||
* - <b>USE_EEPROM_DESCRIPTORS</b> - (\ref Group_StdDescriptors) - <i>AVR8 Only</i> \n | |||||
* Similar to USE_RAM_DESCRIPTORS, but all descriptors are stored in the AVR's EEPROM memory rather than RAM. | |||||
* | |||||
* - <b>NO_INTERNAL_SERIAL</b> - (\ref Group_StdDescriptors) - <i>All Architectures</i> \n | |||||
* Some AVR models contain a unique serial number which can be used as the device serial number, while in device mode. This allows | |||||
* the host to uniquely identify the device regardless of if it is moved between USB ports on the same computer, allowing allocated | |||||
* resources (such as drivers, COM Port number allocations) to be preserved. This is not needed in many apps, and so the code that | |||||
* performs this task can be disabled by defining this option and passing it to the compiler via the -D switch. | |||||
* | |||||
* - <b>FIXED_CONTROL_ENDPOINT_SIZE</b>=<i>x</i> - (\ref Group_EndpointManagement) - <i>All Architectures</i> \n | |||||
* By default, the library determines the size of the control endpoint (when in device mode) by reading the device descriptor. | |||||
* Normally this reduces the amount of configuration required for the library, allows the value to change dynamically (if | |||||
* descriptors are stored in EEPROM or RAM rather than flash memory) and reduces code maintenance. However, this token can be | |||||
* defined to a non-zero value instead to give the size in bytes of the control endpoint, to reduce the size of the compiled | |||||
* binary. | |||||
* | |||||
* - <b>DEVICE_STATE_AS_GPIOR</b> - (\ref Group_Device) - <i>AVR8 Only</i> \n | |||||
* One of the most frequently used global variables in the stack is the USB_DeviceState global, which indicates the current state of | |||||
* the Device State Machine. To reduce the amount of code and time required to access and modify this global in an application, this token | |||||
* may be defined to a value between 0 and 2 to fix the state variable into one of the three general purpose IO registers inside the AVR | |||||
* reserved for application use. When defined, the corresponding GPIOR register should not be used within the user application except | |||||
* implicitly via the library APIs. | |||||
* | |||||
* - <b>FIXED_NUM_CONFIGURATIONS</b>=<i>x</i> - (\ref Group_Device) - <i>All Architectures</i> \n | |||||
* By default, the library determines the number of configurations a USB device supports by reading the device descriptor. This reduces | |||||
* the amount of configuration required to set up the library, and allows the value to change dynamically (if descriptors are stored in | |||||
* EEPROM or RAM rather than flash memory) and reduces code maintenance. However, this value may be fixed via this token in the project | |||||
* makefile to reduce the compiled size of the binary at the expense of flexibility. | |||||
* | |||||
* - <b>CONTROL_ONLY_DEVICE</b> - (\ref Group_Device) - <i>All Architectures</i> \n | |||||
* In some limited USB device applications, there are no device endpoints other than the control endpoint; i.e. all device communication | |||||
* is through control endpoint requests. Defining this token will remove several features related to the selection and control of device | |||||
* endpoints internally, saving space. Generally, this is usually only useful in (some) bootloaders and is best avoided. | |||||
* | |||||
* - <b>MAX_ENDPOINT_INDEX</b> - (\ref Group_Device) - <i>XMEGA Only</i> \n | |||||
* Defining this value to the highest index (not address - this excludes the direction flag) endpoint within the device will restrict the | |||||
* number of FIFOs created internally for the endpoint buffers, reducing the total RAM usage. | |||||
* | |||||
* - <b>INTERRUPT_CONTROL_ENDPOINT</b> - (\ref Group_USBManagement) - <i>All Architectures</i> \n | |||||
* Some applications prefer to not call the USB_USBTask() management task regularly while in device mode, as it can complicate code significantly. | |||||
* Instead, when device mode is used this token can be passed to the library via the -D switch to allow the library to manage the USB control | |||||
* endpoint entirely via USB controller interrupts asynchronously to the user application. When defined, USB_USBTask() does not need to be called | |||||
* when in USB device mode. | |||||
* | |||||
* - <b>NO_DEVICE_REMOTE_WAKEUP</b> - (\ref Group_Device) - <i>All Architectures</i> \n | |||||
* Many devices do not require the use of the Remote Wakeup features of USB, used to wake up the USB host when suspended. On these devices, | |||||
* the code required to manage device Remote Wakeup can be disabled by defining this token and passing it to the library via the -D switch. | |||||
* | |||||
* - <b>NO_DEVICE_SELF_POWER</b> - (\ref Group_Device) - <i>All Architectures</i> \n | |||||
* USB devices may be bus powered, self powered, or a combination of both. When a device can be both bus powered and self powered, the host may | |||||
* query the device to determine the current power source, via \ref USB_Device_CurrentlySelfPowered. For solely bus powered devices, this global | |||||
* and the code required to manage it may be disabled by passing this token to the library via the -D switch. | |||||
* | |||||
* | |||||
* \section Sec_SummaryUSBHostTokens USB Host Mode Driver Related Tokens | |||||
* | |||||
* This section describes compile tokens which affect USB driver stack of the LUFA library when used in Host mode. | |||||
* | |||||
* - <b>HOST_STATE_AS_GPIOR</b> - (\ref Group_Host) - <i>AVR8 Only</i> \n | |||||
* One of the most frequently used global variables in the stack is the USB_HostState global, which indicates the current state of | |||||
* the Host State Machine. To reduce the amount of code and time required to access and modify this global in an application, this token | |||||
* may be defined to a value between 0 and 2 to fix the state variable into one of the three general purpose IO registers inside the AVR | |||||
* reserved for application use. When defined, the corresponding GPIOR register should not be used within the user application except | |||||
* implicitly via the library APIs. | |||||
* | |||||
* - <b>USB_HOST_TIMEOUT_MS</b>=<i>x</i> - (\ref Group_Host) - <i>All Architectures</i> \n | |||||
* When a control transfer is initiated in host mode to an attached device, a timeout is used to abort the transfer if the attached | |||||
* device fails to respond within the timeout period. This token may be defined to a non-zero 16-bit value to set the timeout period for | |||||
* control transfers, specified in milliseconds. If not defined, the default value specified in Host.h is used instead. | |||||
* | |||||
* - <b>HOST_DEVICE_SETTLE_DELAY_MS</b>=<i>x</i> - (\ref Group_Host) - <i>All Architectures</i> \n | |||||
* Some devices require a delay of up to 5 seconds after they are connected to VBUS before the enumeration process can be started, or | |||||
* they will fail to enumerate correctly. By placing a delay before the enumeration process, it can be ensured that the bus has settled | |||||
* back to a known idle state before communications occur with the device. This token may be defined to a 16-bit value to set the device | |||||
* settle period, specified in milliseconds. If not defined, the default value specified in Host.h is used instead. | |||||
* | |||||
* - <b>INVERTED_VBUS_ENABLE_LINE</b> - (\ref Group_Host) - <i>All Architectures</i> \n | |||||
* If enabled, this will indicate that the USB target VBUS line polarity is inverted; i.e. it should be pulled low to enable VBUS to the | |||||
* target, and pulled high to stop the target VBUS generation. | |||||
* | |||||
* \attention On AVR8 architecture devices, this compile time option requires \c NO_AUTO_VBUS_MANAGEMENT to be set. | |||||
* | |||||
* - <b>NO_AUTO_VBUS_MANAGEMENT</b> - (\ref Group_Host) - <i>All Architectures</i> \n | |||||
* Disables the automatic management of VBUS to the target, i.e. automatic shut down in the even of an overcurrent situation. When enabled, VBUS | |||||
* is enabled while the USB controller is initialized in USB Host mode. | |||||
*/ | |||||
/** \file | |||||
* | |||||
* This file contains special DoxyGen information for the generation of the main page and other special | |||||
* documentation pages. It is not a project source file. | |||||
*/ | |||||
/** \page Page_KnownIssues Known Issues | |||||
* The following are known issues present in each official LUFA release. This list should contain all known | |||||
* issues in the library. Most of these issues should be corrected in the future release - see | |||||
* \ref Page_FutureChanges for a list of planned changes in future releases. | |||||
* | |||||
* \section Sec_KnownIssues120730 Version 120730 | |||||
* - AVR8 Architecture | |||||
* - No known issues. | |||||
* - UC3 Architecture | |||||
* \warning The UC3 device support is currently <b>experimental</b> (incomplete and/or non-functional), and is included for preview purposes only. \n | |||||
* | |||||
* - No demos, bootloaders or projects have been ported for the UC3 devices in the current release, | |||||
* although the architecture is supported in the LUFA core library. | |||||
* - DMA transfers to and from the USB controller are not yet implemented for this release. | |||||
* - The UC3C, UC3D and UC3L sub-families of UC3 are not currently supported by the library due to their | |||||
* altered USB controller design. | |||||
* - The various \c CreateStream() functions for creating standard \c <stdio.h> compatible virtual file | |||||
* streams are not available on the UC3 architecture, due to a lack of suitable library support. | |||||
* - XMEGA Architecture | |||||
* \warning The XMEGA device support is currently <b>experimental</b> (incomplete and/or non-functional), and is included for preview purposes only. | |||||
* | |||||
* - No demos, bootloaders or projects have been ported for the XMEGA devices in the current release, | |||||
* although the architecture is supported in the LUFA core library. | |||||
* - Endpoints of more than 64 bytes are not currently supported in this release. | |||||
* - Isochronous endpoints are not currently supported in this release. As a result, the audio class | |||||
* cannot be used on XMEGA devices. | |||||
* - Multiple-bank endpoints are not currently supported in this release. | |||||
* - Early revisions of the ATXMEGA128A1U are incompatible with LUFA, due to their various errata | |||||
* relating to the USB controller. | |||||
* - Architecture Independent | |||||
* - The HID parser fails for array type elements that have a MIN and MAX usage applied; each element | |||||
* in the array will receive a unique incrementing usage from the MIN value, up to MAX. | |||||
* - The LUFA library is not watchdog aware, and thus timeouts are possible if short periods are used | |||||
* and a lengthy USB operation is initiated. | |||||
* - Build System | |||||
* - No known issues. | |||||
*/ | |||||
/** \file | |||||
* | |||||
* This file contains special DoxyGen information for the generation of the main page and other special | |||||
* documentation pages. It is not a project source file. | |||||
*/ | |||||
/** | |||||
* \page Page_LicenseInfo Source Code License | |||||
* | |||||
* The LUFA library is currently released under the MIT license, included below. | |||||
* | |||||
* Commercial entities can opt out of the public disclosure clause in this license | |||||
* for a one-time US$1500 payment. This provides a non-exclusive modified MIT licensed which | |||||
* allows for the free use of the LUFA library, bootloaders and (where the sole copyright | |||||
* is attributed to Dean Camera) demos without public disclosure within an organization, in | |||||
* addition to three free hours of consultation with the library author, and priority support. | |||||
* Please visit the Commercial License link on \ref Page_Resources for more information on | |||||
* ordering a commercial license for your company. | |||||
* | |||||
* \verbinclude License.txt | |||||
*/ | |||||