Skip to content

Question: How to toggle layer in ACTION_FUNCTION? #446

@tywtyw2002

Description

@tywtyw2002

Is someone give me some example for how to toggle a layer in ACTION_FUNCTION?

I would like to change some LEDs then toggle a layer.

The follow code did not work.

void action_function(keyrecord_t *record, uint8_t id, uint8_t opt){

    static bool led = false;
    switch (id) {
        case TOGGLE_ARROW_LAYER:
            if (led) {
                gh60_esc_led_off();
            }else{
                gh60_esc_led_on();
                led = true;
            }
            return (action_t) ACTION_LAYER_TOGGLE(2);
            break;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions