2013-01-28 11:06:42 +06:00
|
|
|
/*
|
|
|
|
Copyright 2012,2013 Jun Wako <wakojun@gmail.com>
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
2012-12-15 23:32:07 +06:00
|
|
|
#ifndef ACTION_H
|
|
|
|
#define ACTION_H
|
|
|
|
|
2013-03-28 21:56:34 +06:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2012-12-15 23:32:07 +06:00
|
|
|
#include "keyboard.h"
|
2013-01-31 14:50:53 +06:00
|
|
|
#include "keycode.h"
|
2013-04-04 12:16:03 +06:00
|
|
|
#include "action_code.h"
|
2013-02-25 12:30:37 +06:00
|
|
|
#include "action_macro.h"
|
2012-12-15 23:32:07 +06:00
|
|
|
|
2013-01-27 13:38:19 +06:00
|
|
|
|
2013-04-05 00:27:10 +06:00
|
|
|
/* tapping count and state */
|
|
|
|
typedef struct {
|
|
|
|
bool interrupted :1;
|
|
|
|
bool reserved2 :1;
|
|
|
|
bool reserved1 :1;
|
|
|
|
bool reserved0 :1;
|
|
|
|
uint8_t count :4;
|
|
|
|
} tap_t;
|
|
|
|
|
2013-04-04 12:16:03 +06:00
|
|
|
/* Key event container for recording */
|
2013-03-28 21:56:34 +06:00
|
|
|
typedef struct {
|
|
|
|
keyevent_t event;
|
|
|
|
#ifndef NO_ACTION_TAPPING
|
2013-04-05 00:27:10 +06:00
|
|
|
tap_t tap;
|
2013-03-28 21:56:34 +06:00
|
|
|
#endif
|
2013-02-01 11:48:11 +06:00
|
|
|
} keyrecord_t;
|
|
|
|
|
2013-02-13 08:47:19 +06:00
|
|
|
|
|
|
|
/* Execute action per keyevent */
|
|
|
|
void action_exec(keyevent_t event);
|
|
|
|
|
|
|
|
/* action for key */
|
|
|
|
action_t action_for_key(uint8_t layer, key_t key);
|
|
|
|
|
2013-02-25 12:30:37 +06:00
|
|
|
/* macro */
|
2013-05-20 19:42:29 +06:00
|
|
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
|
2013-02-25 12:30:37 +06:00
|
|
|
|
2013-02-13 08:47:19 +06:00
|
|
|
/* user defined special function */
|
|
|
|
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
|
|
|
|
|
2013-03-28 21:56:34 +06:00
|
|
|
/* Utilities for actions. */
|
|
|
|
void process_action(keyrecord_t *record);
|
2013-01-23 20:53:51 +06:00
|
|
|
void register_code(uint8_t code);
|
|
|
|
void unregister_code(uint8_t code);
|
2013-10-04 00:30:09 +06:00
|
|
|
void register_mods(uint8_t mods);
|
|
|
|
void unregister_mods(uint8_t mods);
|
|
|
|
//void set_mods(uint8_t mods);
|
2013-01-23 20:53:51 +06:00
|
|
|
void clear_keyboard(void);
|
|
|
|
void clear_keyboard_but_mods(void);
|
|
|
|
void layer_switch(uint8_t new_layer);
|
2013-01-26 23:42:48 +06:00
|
|
|
bool is_tap_key(key_t key);
|
2013-03-28 21:56:34 +06:00
|
|
|
|
|
|
|
/* debug */
|
|
|
|
void debug_event(keyevent_t event);
|
|
|
|
void debug_record(keyrecord_t record);
|
|
|
|
void debug_action(action_t action);
|
2013-01-23 20:53:51 +06:00
|
|
|
|
2012-12-15 23:32:07 +06:00
|
|
|
#endif /* ACTION_H */
|