Skip to content
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

Bigger combo index #9318

Merged
merged 2 commits into from
Jul 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/ChangeLog/20200829/PR9318.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Bigger integer type when looping over combos.

[#9318](https://github.com/qmk/qmk_firmware/pull/9318)

Changes `uint8_t` to `uint16_t` so it is possible have more than 256 combos.

Any fork that uses `process_combo_event` needs to update the function's first argument to `uint16_t`.

| Old function | New Function |
|---------------------------------------------------------------|----------------------------------------------------------------|
| `void process_combo_event(uint8_t combo_index, bool pressed)` | `void process_combo_event(uint16_t combo_index, bool pressed)` |
2 changes: 1 addition & 1 deletion keyboards/ashpil/modelm_usbc/keymaps/ashpil/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ combo_t key_combos[COMBO_COUNT] = {
[CTRL_PAUS_RESET] = COMBO_ACTION(reset_combo),
};

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
switch(combo_index) {
case CTRL_PAUS_RESET:
if (pressed) {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/converter/usb_usb/keymaps/chriskopher/combo.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ combo_t key_combos[COMBO_COUNT] = {
};

// Called after a combo event is triggered
void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
switch (combo_index) {
case SD_LAYER_COMBO:
if (pressed) {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/converter/usb_usb/keymaps/narze/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void matrix_setup(void) {
set_superduper_key_combos();
}

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
if (pressed) {
switch(combo_index) {
case CB_SUPERDUPER:
Expand Down
2 changes: 1 addition & 1 deletion keyboards/ergodox_infinity/keymaps/narze/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ void matrix_scan_user(void) {

// Combos

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
if (pressed) {
switch(combo_index) {
case CB_SUPERDUPER:
Expand Down
2 changes: 1 addition & 1 deletion keyboards/gboards/g/keymap_combo.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ int COMBO_LEN = sizeof(key_combos) / sizeof(key_combos[0]);
#define COMB BLANK
#define SUBS A_ACTI
#define TOGG A_TOGG
void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
switch (combo_index) {
#include "combos.def"
}
Expand Down
2 changes: 1 addition & 1 deletion keyboards/maxr1998/pulse4k/pulse4k.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ combo_t key_combos[COMBO_COUNT] = {

bool led_adjust_active = false;

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
if (combo_index == LED_ADJUST) {
led_adjust_active = pressed;
}
Expand Down
2 changes: 1 addition & 1 deletion keyboards/minidox/keymaps/rsthd_combos/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ combo_t key_combos[COMBO_COUNT] = {
[BOT_CTR] = COMBO_ACTION(bx_combo),
};

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
switch(combo_index) {
case MID_R:
if (pressed) {
Expand Down
2 changes: 1 addition & 1 deletion keyboards/planck/keymaps/narze/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ void matrix_setup(void) {
void matrix_scan_user(void) {
}

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
if (pressed) {
switch(combo_index) {
case CB_SUPERDUPER:
Expand Down
2 changes: 1 addition & 1 deletion keyboards/xd75/keymaps/4sstylz/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
switch(combo_index) {
case SCR_LCK:
if (pressed) {
Expand Down
6 changes: 3 additions & 3 deletions quantum/process_keycode/process_combo.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ extern combo_t key_combos[];
extern int COMBO_LEN;
#endif

__attribute__((weak)) void process_combo_event(uint8_t combo_index, bool pressed) {}
__attribute__((weak)) void process_combo_event(uint16_t combo_index, bool pressed) {}

static uint16_t timer = 0;
static uint8_t current_combo_index = 0;
static uint16_t current_combo_index = 0;
static bool drop_buffer = false;
static bool is_active = false;
static bool b_combo_enable = true; // defaults to enabled
Expand Down Expand Up @@ -83,7 +83,7 @@ static inline void dump_key_buffer(bool emit) {

static bool process_single_combo(combo_t *combo, uint16_t keycode, keyrecord_t *record) {
uint8_t count = 0;
uint8_t index = -1;
uint16_t index = -1;
/* Find index of keycode and number of combo keys */
for (const uint16_t *keys = combo->keys;; ++count) {
uint16_t key = pgm_read_word(&keys[count]);
Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_combo.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef struct {

bool process_combo(uint16_t keycode, keyrecord_t *record);
void matrix_scan_combo(void);
void process_combo_event(uint8_t combo_index, bool pressed);
void process_combo_event(uint16_t combo_index, bool pressed);

void combo_enable(void);
void combo_disable(void);
Expand Down
2 changes: 1 addition & 1 deletion users/issmirnov/issmirnov.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ combo_t key_combos[COMBO_COUNT] = {
};


void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
switch(combo_index) {
case XC_COPY:
if (pressed) {
Expand Down
2 changes: 1 addition & 1 deletion users/kuchosauronad0/combo.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "combo.h"

void process_combo_event(uint8_t combo_index, bool pressed){
void process_combo_event(uint16_t combo_index, bool pressed){
switch(combo_index) {
case ZV_COPY:
if (pressed) {
Expand Down
2 changes: 1 addition & 1 deletion users/ninjonas/combos.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ combo_t key_combos[COMBO_COUNT] = {
[XV_PASTE] = COMBO_ACTION(paste_combo),
};

void process_combo_event(uint8_t combo_index, bool pressed) {
void process_combo_event(uint16_t combo_index, bool pressed) {
switch(combo_index) {
case EQ_QUIT:
if (pressed) {
Expand Down
2 changes: 1 addition & 1 deletion users/yet-another-developer/combo.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "combo.h"

void process_combo_event(uint8_t combo_index, bool pressed){
void process_combo_event(uint16_t combo_index, bool pressed){
switch(combo_index) {
case ZV_COPY:
if (pressed) {
Expand Down