Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (93 commits)
  Add ISO keymap(issue tmk#35) and use new keymap API
  Fix set LED for NKRO keyboard interface
  Unused endpoint of console OUT is commentout'd
  Add Makefiles for TMK converters.
  Fix remotewakeup of PJRC stack(Fix tmk#121)
  Check if LUFA-git really exists(Fix tmk#118)
  NKRO is disable when SET_PROTOCOL(boot)
  Make NKRO deafult when it is available
  Change MCU setting to ATmega32U2
  Fix description of pin usage
  Add LUFA git repository(release 140302)
  Move macro definitions from lufa.c to lufa.h
  Fix 'Shift Parentheses' example
  Change LUFA build options
  Return when ready check loop is timeouted(Fix tmk#115)
  Change PollingIntervalMS to 10ms(Fix tmk#114)
  New macro: ACTION_BACKLIGHT_LEVEL(level)
  Show correct function name for default layer set
  Added Lightsaber FN-layer
  Lightsaber clean ups
  ...
  • Loading branch information
argyakrivos committed May 29, 2014
2 parents 4db3332 + ed8cf12 commit 0c68f2c
Show file tree
Hide file tree
Showing 157 changed files with 8,447 additions and 2,367 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "protocol/usb_hid/USB_Host_Shield_2.0"]
path = protocol/usb_hid/USB_Host_Shield_2.0
url = git@github.com:tmk/USB_Host_Shield_2.0.git
[submodule "protocol/lufa/LUFA-git"]
path = protocol/lufa/LUFA-git
url = https://github.com/abcminiuser/lufa.git
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
### converter
* [ps2_usb](converter/ps2_usb/) - [PS/2 keyboard to USB][GH_ps2]
* [adb_usb](converter/adb_usb/) - [ADB keyboard to USB][GH_adb]
* [m0110_usb](converter/m0110_usb) - [Machintosh 128K/512K/Plus keyboard to USB][GH_m0110]
* [m0110_usb](converter/m0110_usb) - [Macintosh 128K/512K/Plus keyboard to USB][GH_m0110]
* [terminal_usb](converter/terminal_usb/) - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
* [news_usb](converter/news_usb/) - [Sony NEWS keyboard to USB][GH_news]
* [x68k_usb](converter/x68k_usb/) - [Sharp X68000 keyboard to USB][GH_x68k]
* [sun_usb](converter/sun_usb/) - [Sun] to USB(type4, 5 and 3?)
* [pc98_usb](converter/pc98_usb/) - [PC98] to USB
* [usb_usb](converter/usb_usb/) - USB to USB(experimental)
* [ascii_usb](converter/ascii_usb/) - ASCII(Serial console terminal) to USB
* [ibm4704_usb](converter/ibm4704_usb) - [IBM 4704 keyboard Converter][GH_ibm4704]

### keyboard
* [hhkb](keyboard/hhkb/) - [Happy Hacking Keyboard pro][GH_hhkb] **my main board**
Expand All @@ -50,6 +52,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
* [IIgs_Standard](keyboard/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung)
* [macway](keyboard/macway/) - [Compact keyboard mod][GH_macway] [retired]
* [KMAC](keyboard/kmac/) - Korean custom keyboard
* [Lightsaber](keyboard/lightsaber/) - Korean custom keyboard

[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
Expand All @@ -61,6 +64,7 @@ You can find some keyboard specific projects under `converter` and `keyboard` di
[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
[GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0
[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
[Phantom]: http://geekhack.org/index.php?topic=26742
[GH60]: http://geekhack.org/index.php?topic=34959
Expand Down Expand Up @@ -90,7 +94,7 @@ See [doc/keymap.md](doc/keymap.md).



Magic Comannds
Magic Commands
--------------
To see help press `Magic` + `H`.

Expand Down Expand Up @@ -121,7 +125,7 @@ Following commands can be also executed with `Magic` + key. In console mode `Mag
**TBD**

### Boot Magic Configuration - Virtual DIP Switch
Boot Magic are executed during boot up time. Press Magic key below then pulgin 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.

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).
Expand All @@ -141,7 +145,7 @@ To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be

#### Keymap
- Swap Control and CapsLock(`Left Control`)
- Change CapsLock to Control(`Casp Lock`)
- Change CapsLock to Control(`Caps Lock`)
- Swap LeftAlt and Gui(`Left Alt`)
- Swap RightAlt and Gui(`Right Alt`)
- Disable Gui(`Left Gui`)
Expand Down Expand Up @@ -210,7 +214,7 @@ Architecture



Debuging
Debugging
--------
Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack.

Expand All @@ -227,7 +231,7 @@ Files and Directories
* converter/ - protocol converter projects
* doc/ - documents
* common.mk - Makefile for common
* protoco.mk - Makefile for protocol
* protocol.mk - Makefile for protocol
* rules.mk - Makefile for build rules

### Common
Expand Down Expand Up @@ -263,7 +267,7 @@ Files and Directories



Conding Style
Coding Style
-------------
- Doesn't use Tab to indent, use 4-spaces instead.

Expand Down
11 changes: 1 addition & 10 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endif
ifdef MOUSEKEY_ENABLE
SRC += $(COMMON_DIR)/mousekey.c
OPT_DEFS += -DMOUSEKEY_ENABLE
OPT_DEFS += -DMOUSE_ENABLE
endif

ifdef EXTRAKEY_ENABLE
Expand All @@ -47,16 +48,6 @@ ifdef NKRO_ENABLE
OPT_DEFS += -DNKRO_ENABLE
endif

ifdef PS2_MOUSE_ENABLE
SRC += $(COMMON_DIR)/ps2.c \
$(COMMON_DIR)/ps2_mouse.c
OPT_DEFS += -DPS2_MOUSE_ENABLE
endif

ifdef $(or MOUSEKEY_ENABLE, PS2_MOUSE_ENABLE)
OPT_DEFS += -DMOUSE_ENABLE
endif

ifdef SLEEP_LED_ENABLE
SRC += $(COMMON_DIR)/sleep_led.c
OPT_DEFS += -DSLEEP_LED_ENABLE
Expand Down
22 changes: 15 additions & 7 deletions common/action.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ void process_action(keyrecord_t *record)
}
break;
#endif
case MODS_TAP_TOGGLE:
if (event.pressed) {
if (tap_count <= TAPPING_TOGGLE) {
register_mods(mods);
}
} else {
if (tap_count < TAPPING_TOGGLE) {
unregister_mods(mods);
}
}
break;
default:
if (event.pressed) {
if (tap_count > 0) {
Expand Down Expand Up @@ -283,7 +294,7 @@ void process_action(keyrecord_t *record)
#ifdef BACKLIGHT_ENABLE
case ACT_BACKLIGHT:
if (!event.pressed) {
switch (action.backlight.id) {
switch (action.backlight.opt) {
case BACKLIGHT_INCREASE:
backlight_increase();
break;
Expand All @@ -296,6 +307,9 @@ void process_action(keyrecord_t *record)
case BACKLIGHT_STEP:
backlight_step();
break;
case BACKLIGHT_LEVEL:
backlight_level(action.backlight.level);
break;
}
}
break;
Expand Down Expand Up @@ -485,12 +499,6 @@ void clear_keyboard_but_mods(void)
#endif
}

bool sending_anykey(void)
{
return (has_anykey() || host_mouse_in_use() ||
host_last_sysytem_report() || host_last_consumer_report());
}

bool is_tap_key(key_t key)
{
action_t action = layer_switch_get_action(key);
Expand Down
1 change: 0 additions & 1 deletion common/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ void unregister_mods(uint8_t mods);
//void set_mods(uint8_t mods);
void clear_keyboard(void);
void clear_keyboard_but_mods(void);
bool sending_anykey(void);
void layer_switch(uint8_t new_layer);
bool is_tap_key(key_t key);

Expand Down
29 changes: 18 additions & 11 deletions common/action_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ACT_MODS_TAP(001r):
* 001r|mods|0000 0000 Modifiers with OneShot
* 001r|mods|0000 0001 Modifiers with tap toggle
* 001r|mods|0000 00xx (reserved)
* 001r|mods| keycode Modifiers with Tap Key(Dual role)
*
Expand Down Expand Up @@ -86,7 +87,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
* 1100|1111| id(8) Macro record?
*
* ACT_BACKLIGHT(1101):
* 1101|xxxx| id(8) Backlight commands
* 1101|opt |level(8) Backlight commands
*
* ACT_COMMAND(1110):
* 1110|opt | id(8) Built-in Command exec
Expand Down Expand Up @@ -162,7 +163,9 @@ typedef union {
uint8_t kind :4;
} usage;
struct action_backlight {
uint8_t id :8;
uint8_t level :8;
uint8_t opt :4;
uint8_t kind :4;
} backlight;
struct action_command {
uint8_t id :8;
Expand Down Expand Up @@ -205,12 +208,14 @@ enum mods_bit {
};
enum mods_codes {
MODS_ONESHOT = 0x00,
MODS_TAP_TOGGLE = 0x01,
};
#define ACTION_KEY(key) ACTION(ACT_MODS, (key))
#define ACTION_MODS(mods) ACTION(ACT_MODS, (mods&0x1f)<<8 | 0)
#define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, (mods&0x1f)<<8 | (key))
#define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | (key))
#define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, (mods&0x1f)<<8 | MODS_ONESHOT)
#define ACTION_MODS(mods) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | 0)
#define ACTION_MODS_KEY(mods, key) ACTION(ACT_MODS, ((mods)&0x1f)<<8 | (key))
#define ACTION_MODS_TAP_KEY(mods, key) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | (key))
#define ACTION_MODS_ONESHOT(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_ONESHOT)
#define ACTION_MODS_TAP_TOGGLE(mods) ACTION(ACT_MODS_TAP, ((mods)&0x1f)<<8 | MODS_TAP_TOGGLE)


/*
Expand Down Expand Up @@ -279,21 +284,23 @@ enum layer_pram_tap_op {
/*
* Extensions
*/
enum backlight_id {
enum backlight_opt {
BACKLIGHT_INCREASE = 0,
BACKLIGHT_DECREASE = 1,
BACKLIGHT_TOGGLE = 2,
BACKLIGHT_STEP = 3,
BACKLIGHT_LEVEL = 4,
};
/* Macro */
#define ACTION_MACRO(id) ACTION(ACT_MACRO, (id))
#define ACTION_MACRO_TAP(id) ACTION(ACT_MACRO, FUNC_TAP<<8 | (id))
#define ACTION_MACRO_OPT(id, opt) ACTION(ACT_MACRO, (opt)<<8 | (id))
/* Backlight */
#define ACTION_BACKLIGHT_INCREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_INCREASE)
#define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE)
#define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE)
#define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP)
#define ACTION_BACKLIGHT_INCREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_INCREASE << 8)
#define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE << 8)
#define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE << 8)
#define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8)
#define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | level)
/* Command */
#define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (addr))
/* Function */
Expand Down
13 changes: 11 additions & 2 deletions common/action_macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <util/delay.h>
#include "action.h"
#include "action_util.h"
#include "action_macro.h"

#ifdef DEBUG_ACTION
Expand All @@ -39,12 +40,20 @@ void action_macro_play(const macro_t *macro_p)
case KEY_DOWN:
MACRO_READ();
dprintf("KEY_DOWN(%02X)\n", macro);
register_code(macro);
if (IS_MOD(macro)) {
add_weak_mods(MOD_BIT(macro));
} else {
register_code(macro);
}
break;
case KEY_UP:
MACRO_READ();
dprintf("KEY_UP(%02X)\n", macro);
unregister_code(macro);
if (IS_MOD(macro)) {
del_weak_mods(MOD_BIT(macro));
} else {
unregister_code(macro);
}
break;
case WAIT:
MACRO_READ();
Expand Down
1 change: 1 addition & 0 deletions common/action_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ACTION_UTIL_H

#include <stdint.h>
#include "report.h"

extern report_keyboard_t *keyboard_report;

Expand Down
8 changes: 8 additions & 0 deletions common/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ void backlight_step(void)
dprintf("backlight step: %u\n", backlight_config.level);
backlight_set(backlight_config.level);
}

void backlight_level(uint8_t level)
{
backlight_config.level ^= level;
backlight_config.enable = !!backlight_config.level;
eeconfig_write_backlight(backlight_config.raw);
backlight_set(backlight_config.level);
}
7 changes: 3 additions & 4 deletions common/backlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
typedef union {
uint8_t raw;
struct {
bool enable:1;
uint8_t level:7;
bool enable :1;
uint8_t level :7;
};
} backlight_config_t;

void backlight_init(void);

void backlight_increase(void);
void backlight_decrease(void);
void backlight_toggle(void);
void backlight_step(void);

void backlight_set(uint8_t level);
void backlight_level(uint8_t level);

#endif
4 changes: 2 additions & 2 deletions common/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ static bool command_common(uint8_t code)
case KC_S:
print("\n\n----- Status -----\n");
print_val_hex8(host_keyboard_leds());
print_val_hex8(keyboard_protocol);
print_val_hex8(keyboard_idle);
#ifdef PROTOCOL_PJRC
print_val_hex8(UDCON);
print_val_hex8(UDIEN);
print_val_hex8(UDINT);
print_val_hex8(usb_keyboard_leds);
print_val_hex8(usb_keyboard_protocol);
print_val_hex8(usb_keyboard_idle_config);
print_val_hex8(usb_keyboard_idle_count);
#endif

Expand Down
10 changes: 1 addition & 9 deletions common/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.


#ifdef NKRO_ENABLE
bool keyboard_nkro = false;
bool keyboard_nkro = true;
#endif

report_mouse_t mouse_report = {};


static host_driver_t *driver;
static uint16_t last_system_report = 0;
static uint16_t last_consumer_report = 0;
Expand Down Expand Up @@ -89,11 +86,6 @@ void host_consumer_send(uint16_t report)
(*driver->send_consumer)(report);
}

uint8_t host_mouse_in_use(void)
{
return (mouse_report.buttons | mouse_report.x | mouse_report.y | mouse_report.v | mouse_report.h);
}

uint16_t host_last_sysytem_report(void)
{
return last_system_report;
Expand Down
7 changes: 2 additions & 5 deletions common/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ extern "C" {
extern bool keyboard_nkro;
#endif

/* report */
extern report_mouse_t mouse_report;
uint8_t keyboard_idle;
uint8_t keyboard_protocol;


/* host driver */
Expand All @@ -47,9 +47,6 @@ void host_mouse_send(report_mouse_t *report);
void host_system_send(uint16_t data);
void host_consumer_send(uint16_t data);

/* mouse report utils */
uint8_t host_mouse_in_use(void);

uint16_t host_last_sysytem_report(void);
uint16_t host_last_consumer_report(void);

Expand Down
Loading

0 comments on commit 0c68f2c

Please sign in to comment.