diff options
Diffstat (limited to 'common/action.h')
| -rw-r--r-- | common/action.h | 39 |
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 | /* | ||
| 2 | Copyright 2012,2013 Jun Wako <wakojun@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along 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 */ |
| 55 | typedef struct { | 71 | typedef 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 | */ | ||
| 65 | extern uint8_t tap_count; | ||
| 66 | |||
| 67 | /* current tap key event */ | ||
| 68 | extern keyevent_t tapping_event; | ||
| 69 | |||
| 70 | |||
| 71 | /* action function */ | ||
| 72 | typedef void (*action_func_t)(keyevent_t event, uint8_t opt); | ||
| 73 | |||
| 74 | // TODO: legacy keymap support | ||
| 75 | void action_exec(keyevent_t event); | 78 | void action_exec(keyevent_t event); |
| 76 | void action_call_function(keyevent_t event, uint8_t id); | 79 | typedef void (*action_func_t)(keyevent_t event, uint8_t opt); // TODO:no need? |
| 80 | void 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 | |||
| 198 | enum action_kind_id { | 201 | enum action_kind_id { |
| 199 | ACT_LMODS = 0b0000, | 202 | ACT_LMODS = 0b0000, |
| 200 | ACT_RMODS = 0b0001, | 203 | ACT_RMODS = 0b0001, |
