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