using hid_listen, when i connect the keyboard to the usb i get this output:
Code: Select all
Listening:
done.
Keyboard start.
am i missing something really basic or could this be some spooky weird stuff ?
Code: Select all
Listening:
done.
Keyboard start.
it does now, but not with my code.. i used this tool to generate a compiled hex file and it worked: http://kb.sized.io/Eric-T wrote: ↑@sphinx Does your keyboard register keystrokes?
thanks! right now I don't have much time to work on it, probably will pick it up again by the end of the month..rddm wrote: ↑@sphinx if you want I can speak with you in Portuguese via skype, mobile, etc and tell you how to do it, but it is 4 am so lets say tomorrow.
You can use macro. The document is always sparse and not updated you will have to read code or look into other's keymap files.Cortes wrote: ↑How I can do that by pressing a key, type "hello"?
this must be the silliest question, but how do you assign the macro to a key? you just use "HELLO" in the key matrix?hasu wrote: ↑You can use macro. The document is always sparse and not updated you will have to read code or look into other's keymap files.Cortes wrote: ↑How I can do that by pressing a key, type "hello"?
https://github.com/tmk/tmk_keyboard/blo ... cro-action
Code: Select all
return (record->event.pressed ?
MACRO( D(LALT), D(TAB), END ) :
MACRO( U(TAB), END ));
Code: Select all
if (record->event_pressed) {
a = foo;
} else {
a = bar;
}
return a;
Code: Select all
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPC)
Code: Select all
/*
* HHKB Layout
*/
#include "keymap_common.h"
#ifdef KEYMAP_SECTION_ENABLE
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] __attribute__ ((section (".keymap.keymaps"))) = {
#else
const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
#endif
[0] = \
KEYMAP(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,RSFT, MPLY, \
LALT,LGUI, FN0, RGUI,RALT),
[1] = \
KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
CAPS, WH_U, MS_U, WH_D, TRNS, MSTP, TRNS, TRNS, PSCR, SLCK, PAUS, MPRV, MNXT, BSPC, \
LCTL, MS_L, MS_D, MS_R, BTN2, BTN3, LEFT, DOWN, UP, RIGHT, TRNS, TRNS, ENT, \
LSFT,VOLD,VOLU,MUTE,FN1,FN2,HOME,PGDN, PGUP, END, TRNS, RSFT, TRNS, \
LALT,LGUI, TRNS, RGUI,RALT),
};
enum macro_id {
M1,
M2,
};
/*
* Fn action definition
*/
#ifdef KEYMAP_SECTION_ENABLE
const uint16_t fn_actions[] __attribute__ ((section (".keymap.fn_actions"))) = {
#else
const uint16_t fn_actions[] PROGMEM = {
#endif
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPC),
[1] = ACTION_MACRO(M1), // F1 = =>
[2] = ACTION_MACRO(M2), // F2 = ->
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch (id) {
case M1:
return (record->event.pressed ?
MACRO( T(EQL), D(LSHIFT), T(DOT), END ) :
MACRO_NONE );
case M2:
return (record->event.pressed ?
MACRO( T(MINS), D(LSHIFT), T(DOT), END ) :
MACRO_NONE );
}
return MACRO_NONE;
}
Code: Select all
#----------------------------------------------------------------------------
# Target file name (without extension).
TARGET = hhkb_lufa
# Directory common source filess exist
TMK_DIR = ../../tmk_core
# Directory keyboard dependent files exist
TARGET_DIR = .
# List C source files here. (C dependencies are automatically generated.)
SRC += keymap_common.c \
matrix.c \
led.c
CONFIG_H = config.h
# MCU name
# PJRC Teensy++ 2.0
#MCU = at90usb1286
# TMK Alt Controller or PJRC Teensy 2.0
MCU = atmega32u4
F_CPU = 16000000
#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8
F_USB = $(F_CPU)
# Interrupt driven control endpoint task
#OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 1024
# Atmel DFU loader 4096 (TMK Alt Controller)
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options
# comment out to disable the options.
#
# BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
# MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
# CONSOLE_ENABLE = yes # Console for debug
# COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # USB Nkey Rollover
#KEYMAP_SECTION_ENABLE = yes # fixed address keymap for keymap editor
#HHKB_JP = yes # HHKB JP support
#OPT_DEFS += -DNO_ACTION_TAPPING
#OPT_DEFS += -DNO_ACTION_LAYER
#OPT_DEFS += -DNO_ACTION_MACRO
#
# Keymap file
#
ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC)
else
ifdef HHKB_JP
SRC := keymap_jp.c $(SRC)
else
SRC := keymap_hhkb.c $(SRC)
endif
endif
ifneq (, $(or $(findstring keymap_jp.c, $(SRC)), $(findstring yes, $(HHKB_JP))))
OPT_DEFS += -DHHKB_JP
endif
# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TMK_DIR)
include $(TMK_DIR)/protocol/lufa.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk
debug-on: EXTRAFLAGS += -DDEBUG -DDEBUG_ACTION
debug-on: all
debug-off: EXTRAFLAGS += -DNO_DEBUG -DNO_PRINT
debug-off: OPT_DEFS := $(filter-out -DCONSOLE_ENABLE,$(OPT_DEFS))
debug-off: all
Code: Select all
#define KEYMAP( \
K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, K0F,\
K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1F,\
K20, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2F, \
K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F, \
K40, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4F, \
K50, K52, K53, K56, K5B, K5C, K5D, K5E, K5F \
) { \
{KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##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_##K1F}, \
{KC_##K20, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K2C, KC_##K2D, KC_##K2F }, \
{KC_##K30,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_##K40, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_##K48, KC_##K49, KC_##K4A, KC_##K4B, KC_##K4C, KC_##K4D, KC_##K4F }, \
{KC_##K50, KC_NO, KC_##K52, KC_##K53, KC_NO, KC_NO, KC_##K56, KC_NO, KC_NO, KC_NO ,KC_NO, KC_##K5B, KC_##K5C, KC_##K5D, KC_##K5E, KC_##K5F} \
}
Matrix.c
static void init_cols(void)
{
// Input with pull-up(DDR:0, PORT:1)
DDRD &= ~(1<<7 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
PORTD |= (1<<7 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0);
DDRC &= ~(1<<7 | 1<<6);
PORTC |= (1<<7 | 1<<6);
DDRE &= ~(1<<6);
PORTE |= (1<<6);
DDRB &= ~(1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 |1<<2);
PORTB |= (1<<7 | 1<<6 | 1<< 5 | 1<<4 | 1<<3 |1<<2);
}
static matrix_row_t read_cols(void)
{
return (PINB&(1<<6) ? 0 : (1<<15)) |
(PINB&(1<<5) ? 0 : (1<<14)) |
(PINB&(1<<4) ? 0 : (1<<13)) |
(PIND&(1<<7) ? 0 : (1<<12)) |
(PIND&(1<<4) ? 0 : (1<<11)) |
(PIND&(1<<5) ? 0 : (1<<10)) |
(PINC&(1<<6) ? 0 : (1<<9)) |
(PIND&(1<<3) ? 0 : (1<<8)) |
(PIND&(1<<2) ? 0 : (1<<7)) |
(PIND&(1<<1) ? 0 : (1<<6)) |
(PIND&(1<<0) ? 0 : (1<<5)) |
(PINB&(1<<7) ? 0 : (1<<4)) |
(PINB&(1<<3) ? 0 : (1<<3)) |
(PINB&(1<<2) ? 0 : (1<<2)) |
(PINC&(1<<7) ? 0 : (1<<1)) |
(PINE&(1<<6) ? 0 : (1<<0));
}
/* Row pin configuration
* row: 0 1 2 3 4
* pin: D0 D1 D2 D3 D5
*/
static void unselect_rows(void)
{
// Hi-Z(DDR:0, PORT:0) to unselect
DDRF &= ~0b11110011;
PORTF &= ~0b11110011;
}
static void select_row(uint8_t row)
{
// Output low(DDR:1, PORT:0) to select
switch (row) {
case 0:
DDRF |= (1<<0);
PORTF &= ~(1<<0);
break;
case 1:
DDRF |= (1<<1);
PORTF &= ~(1<<1);
break;
case 2:
DDRF |= (1<<4);
PORTF &= ~(1<<4);
break;
case 3:
DDRF |= (1<<5);
PORTF &= ~(1<<5);
break;
case 4:
DDRF |= (1<<6);
PORTF &= ~(1<<6);
break;
case 5:
DDRF |= (1<<7);
PORTF &= ~(1<<7);
break;
}
Keymap_poker.c
#include "keymap_common.h"
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KEYMAP(ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR, SLCK, PGUP, \
GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, NUBS, EQL, BSPC,PGDN, \
TAB, Q, W, E, R, T, Y, U, I , O ,P, LBRC, RBRC, ENT, HOME, \
CAPS, A, S, D, F, G, H, J, K, L, O, SCLN, QUOT, END, \
LSFT, BSLS, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, \
LCTL, FN1, LALT, SPC, RALT, FN2, LEFT, RIGHT, DOWN),
};
const uint16_t PROGMEM fn_actions[] = {
};
Try this patch and I didn't test it well but it compiles at least.MrMen wrote: ↑Hi guys. Sorry Salt it's not an answer but another question about TMK.
Actually I have a HHKB with the awesome Bluetooth version of Hasu. I'd like to use actionmap with it. I found some info about it with AEK, but I'm absolutely not able to use it with Makefile.rn42.
I think my files are ok excepting the Makefile. Does anybody here have an idea about this ? Any hints would be great;-)
Code: Select all
$ make -f Makefile.rn42 KEYMAP=<your_actionmap>
Code: Select all
iff --git a/keyboard/hhkb/Makefile.rn42 b/keyboard/hhkb/Makefile.rn42
index 8cb4435..e913b4c 100644
--- a/keyboard/hhkb/Makefile.rn42
+++ b/keyboard/hhkb/Makefile.rn42
@@ -49,8 +49,7 @@ TARGET_DIR = .
# List C source files here. (C dependencies are automatically generated.)
-SRC += keymap_common.c \
- matrix.c \
+SRC += matrix.c \
led.c
CONFIG_H = config_rn42.h
@@ -121,13 +120,19 @@ NKRO_ENABLE = yes # USB Nkey Rollover
#
# Keymap file
#
+ifdef ACTIONMAP_ENABLE
+ KEYMAP_FILE = actionmap
+else
+ KEYMAP_FILE = keymap
+ SRC := keymap_common.c $(SRC)
+endif
ifdef KEYMAP
- SRC := keymap_$(KEYMAP).c $(SRC)
+ SRC := $(KEYMAP_FILE)_$(KEYMAP).c $(SRC)
else
ifdef HHKB_JP
- SRC := keymap_jp.c $(SRC)
+ SRC := $(KEYMAP_FILE)_jp.c $(SRC)
else
- SRC := keymap_hhkb.c $(SRC)
+ SRC := $(KEYMAP_FILE)_hhkb.c $(SRC)
endif
endif
diff --git a/keyboard/hhkb/Makefile.rn42.actionmap b/keyboard/hhkb/Makefile.rn42.actionmap
new file mode 100644
index 0000000..aa35f6c
--- /dev/null
+++ b/keyboard/hhkb/Makefile.rn42.actionmap
@@ -0,0 +1,2 @@
+ACTIONMAP_ENABLE = yes # Use 16bit action codes in keymap instead of 8bit keycodes
+include Makefile
Code: Select all
[1] = ACTION_LAYER_MODS(3, MOD_LSFT)
Code: Select all
[10] = ACTION_FUNCTION_TAP(CTRL_CLICK)
Code: Select all
case CTRL_CLICK:
mousekey_clear();
register_mods(MOD_BIT(KC_LCTL));
send_keyboard_report();
mousekey_on(KC_BTN1);
mousekey_send();
mousekey_off(KC_BTN1);
mousekey_send();
unregister_mods(MOD_BIT(KC_LCTL));
send_keyboard_report();
break;
It would be helpful to see how mouse and key events occur actullay with tool like 'xev' or something. But my wild guess is it needs delay between key and mouse send functions.kitten_paw wrote: ↑I am trying to work out a way to bind Ctrl+left click to a key on my mouse layer.
So far I have this in fn_actions:where CTRL_CLICK is part of an enum.Code: Select all
[10] = ACTION_FUNCTION_TAP(CTRL_CLICK)
The relevant part of action_function looks like this:This does not work, hence this post XD. I tried this in a text editor, and when this code is executed, the resulting behavior is as if I had done CTRL+ left double-click. Doing this in Chrome, where ctrl+left click would open a link in a new tab, the link simply opens in the same tab. This is apparently not really consistent, so I either need help debugging this, or maybe somebody can spot my mistake by looking at the code snippets.Code: Select all
case CTRL_CLICK: mousekey_clear(); register_mods(MOD_BIT(KC_LCTL)); send_keyboard_report(); mousekey_on(KC_BTN1); mousekey_send(); mousekey_off(KC_BTN1); mousekey_send(); unregister_mods(MOD_BIT(KC_LCTL)); send_keyboard_report(); break;
I added a delay, but it did not help (at least not by itself, see below). Still, your idea of using xev was a good one. By checking the xev output I could verify that one keypress did indeed send Ctrl+left click twice. The solution was to think more before I write half-assed code: I did not check record->event.pressed, so I guess I was sending the keycodes upon press and release. This solution worked in the text editor, but in Chrome the link still wasn't opened in a new tab. I then added a few milliseconds of delay between each keypress which solved this problem as well.hasu wrote: ↑ It would be helpful to see how mouse and key events occur actullay with tool like 'xev' or something. But my wild guess is it needs delay between key and mouse send functions.