-
-
Notifications
You must be signed in to change notification settings - Fork 40.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Keyboard] Add FancyAlice66 #17491
[Keyboard] Add FancyAlice66 #17491
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if the only difference in the encoder
keymaps are support for the encoders, then they should be removed.
keyboards/fancytech/fancyalice66/keymaps/default_encoder/keymap.c
Outdated
Show resolved
Hide resolved
moved encoder definition to keyboard.c Co-authored-by: Drashna Jaelre <drashna@live.com>
I've removed the extra keymaps and added encoder support to kb.c as requested. I've managed to keep the encoder support for via, please let me know if that's acceptable |
Please let me know if my implementation is acceptable |
Smaller image size Co-authored-by: Drashna Jaelre <drashna@live.com>
@fauxpark can you review the changes please |
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE) | ||
|
||
# ifdef ENCODERS | ||
static uint8_t encoder_state[ENCODERS] = {0}; | ||
static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY; | ||
static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY; | ||
# endif | ||
|
||
void encoder_action_unregister(void) { | ||
# ifdef ENCODERS | ||
for (int index = 0; index < ENCODERS; ++index) { | ||
if (encoder_state[index]) { | ||
keyevent_t encoder_event = (keyevent_t) { | ||
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index], | ||
.pressed = false, | ||
.time = (timer_read() | 1) | ||
}; | ||
encoder_state[index] = 0; | ||
action_exec(encoder_event); | ||
} | ||
} | ||
# endif | ||
} | ||
|
||
void encoder_action_register(uint8_t index, bool clockwise) { | ||
# ifdef ENCODERS | ||
keyevent_t encoder_event = (keyevent_t) { | ||
.key = clockwise ? encoder_cw[index] : encoder_ccw[index], | ||
.pressed = true, | ||
.time = (timer_read() | 1) | ||
}; | ||
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1); | ||
action_exec(encoder_event); | ||
# endif | ||
} | ||
|
||
void matrix_scan_kb(void) { | ||
encoder_action_unregister(); | ||
matrix_scan_user(); | ||
} | ||
|
||
bool encoder_update_kb(uint8_t index, bool clockwise) { | ||
encoder_action_register(index, clockwise); | ||
// don't return user actions, because they are in the keymap | ||
// encoder_update_user(index, clockwise); | ||
return true; | ||
}; | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be replaced with the new Encoder Map feature.
Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Thank you for your contribution! |
Thank you for your contribution! |
@chent7 any chance of openning another pull request? probably the maintainers didnt have time to review previosly, so it was automatically closed |
I didn't have time to continue working on the new changes. But feel free to continue with new PR if you would like to work on it. |
Added FancyAlice66 by Fancytech, with optional rotary encoder slot.
Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist