mirror of
https://github.com/osiweb/unified_retro_keyboard.git
synced 2024-12-21 15:29:21 +00:00
minor hook cleanups
- Rename asdf_hook_do() to asdf_hook_execute() - asdf.c: Call asdf_hook_execute() for ASDF_HOOK_EACH_SCAN hook call in the scan routine, instead of getting then calling the function via hook_get() - asdf.c: move the fetch of scan function hook outside the scan loop.
This commit is contained in:
parent
b3b2a93cdb
commit
25d0693eda
@ -512,9 +512,11 @@ static void asdf_handle_key_held_pressed(uint8_t row, uint8_t col)
|
|||||||
//
|
//
|
||||||
void asdf_keyscan(void)
|
void asdf_keyscan(void)
|
||||||
{
|
{
|
||||||
asdf_hook_get(ASDF_HOOK_EACH_SCAN)();
|
asdf_cols_t (*row_reader)(uint8_t) = (asdf_cols_t(*)(uint8_t)) asdf_hook_get(ASDF_HOOK_SCANNER);
|
||||||
|
|
||||||
|
asdf_hook_execute(ASDF_HOOK_EACH_SCAN);
|
||||||
|
|
||||||
for (uint8_t row = 0; row < ASDF_NUM_ROWS; row++) {
|
for (uint8_t row = 0; row < ASDF_NUM_ROWS; row++) {
|
||||||
asdf_cols_t (*row_reader)(uint8_t) = (asdf_cols_t(*)(uint8_t)) asdf_hook_get(ASDF_HOOK_SCANNER);
|
|
||||||
asdf_cols_t row_key_state = (*row_reader)(row);
|
asdf_cols_t row_key_state = (*row_reader)(row);
|
||||||
|
|
||||||
asdf_cols_t changed = row_key_state ^ last_stable_key_state[row];
|
asdf_cols_t changed = row_key_state ^ last_stable_key_state[row];
|
||||||
|
@ -77,7 +77,7 @@ static uint8_t asdf_hook_valid_id(asdf_hook_id_t id)
|
|||||||
return (id > ASDF_HOOK_NULL && id < ASDF_NUM_HOOKS);
|
return (id > ASDF_HOOK_NULL && id < ASDF_NUM_HOOKS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PROCEDURE: asdf_hook_do
|
// PROCEDURE: asdf_hook_execute
|
||||||
// INPUTS: (asdf_hook_id_t) hook_id: The hook for which to execute the attached
|
// INPUTS: (asdf_hook_id_t) hook_id: The hook for which to execute the attached
|
||||||
// function.
|
// function.
|
||||||
//
|
//
|
||||||
@ -93,7 +93,7 @@ static uint8_t asdf_hook_valid_id(asdf_hook_id_t id)
|
|||||||
//
|
//
|
||||||
// COMPLEXITY: 2
|
// COMPLEXITY: 2
|
||||||
//
|
//
|
||||||
void asdf_hook_do(asdf_hook_id_t hook_id)
|
void asdf_hook_execute(asdf_hook_id_t hook_id)
|
||||||
{
|
{
|
||||||
if (asdf_hook_valid_id(hook_id)) {
|
if (asdf_hook_valid_id(hook_id)) {
|
||||||
hook_map[hook_id]();
|
hook_map[hook_id]();
|
||||||
|
@ -48,12 +48,12 @@ typedef struct {
|
|||||||
} asdf_hook_initializer_t;
|
} asdf_hook_initializer_t;
|
||||||
|
|
||||||
|
|
||||||
// PROCEDURE: asdf_hook_do
|
// PROCEDURE: asdf_hook_execute
|
||||||
// INPUTS: (asdf_hook_id_t) hook_id: The hook for which to execute attache functions.
|
// INPUTS: (asdf_hook_id_t) hook_id: The hook for which to execute attache functions.
|
||||||
// OUTPUTS: none
|
// OUTPUTS: none
|
||||||
// DESCRIPTION: if the hook ID is valid, then execute the function attached to the hook.
|
// DESCRIPTION: if the hook ID is valid, then execute the function attached to the hook.
|
||||||
// SIDE EFFECTS: variable depending on the hooks.
|
// SIDE EFFECTS: variable depending on the hooks.
|
||||||
void asdf_hook_do(asdf_hook_id_t hook_id);
|
void asdf_hook_execute(asdf_hook_id_t hook_id);
|
||||||
|
|
||||||
// PROCEDURE: asdf_hook_get
|
// PROCEDURE: asdf_hook_get
|
||||||
// INPUTS: (asdf_hook_id_t) hook_id: The hook for which to retrieve the attached
|
// INPUTS: (asdf_hook_id_t) hook_id: The hook for which to retrieve the attached
|
||||||
|
Loading…
Reference in New Issue
Block a user