aboutsummaryrefslogtreecommitdiff
path: root/common/action.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/action.h')
-rw-r--r--common/action.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/common/action.h b/common/action.h
index bdd2d2f54..ed3fff6c2 100644
--- a/common/action.h
+++ b/common/action.h
@@ -1,3 +1,19 @@
1/*
2Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
1#ifndef ACTION_H 17#ifndef ACTION_H
2#define ACTION_H 18#define ACTION_H
3 19
@@ -9,7 +25,7 @@
9 * In avr-gcc bit field seems to be assigned from LSB(bit0) to MSB(bit15). 25 * In avr-gcc bit field seems to be assigned from LSB(bit0) to MSB(bit15).
10 * AVR looks like a little endian in avr-gcc. 26 * AVR looks like a little endian in avr-gcc.
11 * 27 *
12 * TODO: not portable across compiler/endianness? 28 * NOTE: not portable across compiler/endianness?
13 * Byte order and bit order of 0x1234: 29 * Byte order and bit order of 0x1234:
14 * Big endian: 15 ... 8 7 ... 210 30 * Big endian: 15 ... 8 7 ... 210
15 * | 0x12 | 0x34 | 31 * | 0x12 | 0x34 |
@@ -51,29 +67,17 @@ typedef union {
51 } func; 67 } func;
52} action_t; 68} action_t;
53 69
54/* Action record. For internal use. */ 70/* Struct to record action and tap count */
55typedef struct { 71typedef struct {
56 keyevent_t event; 72 keyevent_t event;
57 uint8_t tap_count; 73 uint8_t tap_count;
58} keyrecord_t; 74} keyrecord_t;
59 75
60 76
61/* Tap count: Tap is comprised of press and release within TAP_TERM. 77/* execute action per keyevent */
62 * 0 means no tap.
63 * >1 means tap.
64 */
65extern uint8_t tap_count;
66
67/* current tap key event */
68extern keyevent_t tapping_event;
69
70
71/* action function */
72typedef void (*action_func_t)(keyevent_t event, uint8_t opt);
73
74// TODO: legacy keymap support
75void action_exec(keyevent_t event); 78void action_exec(keyevent_t event);
76void action_call_function(keyevent_t event, uint8_t id); 79typedef void (*action_func_t)(keyevent_t event, uint8_t opt); // TODO:no need?
80void action_call_function(keyevent_t event, uint8_t id); // TODO: action function
77 81
78 82
79/* 83/*
@@ -194,7 +198,6 @@ TODO: modifier + function by tap?
194 for example: LShift + '('[Shift+9] and RShift + ')'[Shift+0] 198 for example: LShift + '('[Shift+9] and RShift + ')'[Shift+0]
195 http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478.html#p90052 199 http://deskthority.net/workshop-f7/tmk-keyboard-firmware-collection-t4478.html#p90052
196 */ 200 */
197
198enum action_kind_id { 201enum action_kind_id {
199 ACT_LMODS = 0b0000, 202 ACT_LMODS = 0b0000,
200 ACT_RMODS = 0b0001, 203 ACT_RMODS = 0b0001,