2013-01-27 21:06:42 -08: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 09:32:07 -08:00
|
|
|
#ifndef ACTION_H
|
|
|
|
#define ACTION_H
|
|
|
|
|
2013-03-28 08:56:34 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2012-12-15 09:32:07 -08:00
|
|
|
#include "keyboard.h"
|
2013-01-31 00:50:53 -08:00
|
|
|
#include "keycode.h"
|
2013-04-03 23:16:03 -07:00
|
|
|
#include "action_code.h"
|
2013-02-24 22:30:37 -08:00
|
|
|
#include "action_macro.h"
|
2012-12-15 09:32:07 -08:00
|
|
|
|
2013-01-26 23:38:19 -08:00
|
|
|
|
2013-04-04 11:27:10 -07: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-03 23:16:03 -07:00
|
|
|
/* Key event container for recording */
|
2013-03-28 08:56:34 -07:00
|
|
|
typedef struct {
|
|
|
|
keyevent_t event;
|
|
|
|
#ifndef NO_ACTION_TAPPING
|
2013-04-04 11:27:10 -07:00
|
|
|
tap_t tap;
|
2013-03-28 08:56:34 -07:00
|
|
|
#endif
|
2013-01-31 21:48:11 -08:00
|
|
|
} keyrecord_t;
|
|
|
|
|
2013-02-12 18:47:19 -08: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-24 22:30:37 -08:00
|
|
|
/* macro */
|
2013-05-20 06:42:29 -07:00
|
|
|
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
|
2013-02-24 22:30:37 -08:00
|
|
|
|
2013-02-12 18:47:19 -08:00
|
|
|
/* user defined special function */
|
|
|
|
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
|
|
|
|
|
2013-03-28 08:56:34 -07:00
|
|
|
/* Utilities for actions. */
|
|
|
|
void process_action(keyrecord_t *record);
|
2013-01-23 06:53:51 -08:00
|
|
|
void register_code(uint8_t code);
|
|
|
|
void unregister_code(uint8_t code);
|
2013-10-03 11:30:09 -07:00
|
|
|
void register_mods(uint8_t mods);
|
|
|
|
void unregister_mods(uint8_t mods);
|
|
|
|
//void set_mods(uint8_t mods);
|
2013-01-23 06:53:51 -08:00
|
|
|
void clear_keyboard(void);
|
|
|
|
void clear_keyboard_but_mods(void);
|
|
|
|
bool sending_anykey(void);
|
|
|
|
void layer_switch(uint8_t new_layer);
|
2013-01-26 09:42:48 -08:00
|
|
|
bool is_tap_key(key_t key);
|
2013-03-28 08:56:34 -07:00
|
|
|
|
|
|
|
/* debug */
|
|
|
|
void debug_event(keyevent_t event);
|
|
|
|
void debug_record(keyrecord_t record);
|
|
|
|
void debug_action(action_t action);
|
2013-01-23 06:53:51 -08:00
|
|
|
|
2012-12-15 09:32:07 -08:00
|
|
|
#endif /* ACTION_H */
|