forked from mirrors/qmk_userspace
Programmable Button API refactor and improve docs (#18641)
This commit is contained in:
parent
19aed5e999
commit
f0b2bfd5ca
6 changed files with 220 additions and 86 deletions
|
@ -24,27 +24,38 @@ static uint32_t programmable_button_report = 0;
|
|||
|
||||
void programmable_button_clear(void) {
|
||||
programmable_button_report = 0;
|
||||
programmable_button_flush();
|
||||
}
|
||||
|
||||
void programmable_button_send(void) {
|
||||
host_programmable_button_send(programmable_button_report);
|
||||
}
|
||||
|
||||
void programmable_button_on(uint8_t index) {
|
||||
void programmable_button_add(uint8_t index) {
|
||||
programmable_button_report |= REPORT_BIT(index);
|
||||
}
|
||||
|
||||
void programmable_button_off(uint8_t index) {
|
||||
void programmable_button_remove(uint8_t index) {
|
||||
programmable_button_report &= ~REPORT_BIT(index);
|
||||
}
|
||||
|
||||
void programmable_button_register(uint8_t index) {
|
||||
programmable_button_add(index);
|
||||
programmable_button_flush();
|
||||
}
|
||||
|
||||
void programmable_button_unregister(uint8_t index) {
|
||||
programmable_button_remove(index);
|
||||
programmable_button_flush();
|
||||
}
|
||||
|
||||
bool programmable_button_is_on(uint8_t index) {
|
||||
return !!(programmable_button_report & REPORT_BIT(index));
|
||||
};
|
||||
}
|
||||
|
||||
void programmable_button_flush(void) {
|
||||
host_programmable_button_send(programmable_button_report);
|
||||
}
|
||||
|
||||
uint32_t programmable_button_get_report(void) {
|
||||
return programmable_button_report;
|
||||
};
|
||||
}
|
||||
|
||||
void programmable_button_set_report(uint32_t report) {
|
||||
programmable_button_report = report;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue