Skip to content

Commit

Permalink
Update led_update_kb example (qmk#7451)
Browse files Browse the repository at this point in the history
* Update led_update_kb example

* Update comment to explain pin behavior

* wordsmith

* wordsmithing 2
  • Loading branch information
yanfali authored and zvecr committed Nov 23, 2019
1 parent 7bc7215 commit 61f49dc
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions docs/custom_quantum_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,16 @@ Some examples include:
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
if (led_state.num_lock) {
writePinLow(B0);
} else {
writePinHigh(B0);
}
if (led_state.caps_lock) {
writePinLow(B1);
} else {
writePinHigh(B1);
}
if (led_state.scroll_lock) {
writePinLow(B2);
} else {
writePinHigh(B2);
}
if (led_state.compose) {
writePinLow(B3);
} else {
writePinHigh(B3);
}
if (led_state.kana) {
writePinLow(B4);
} else {
writePinHigh(B4);
}
// writePin sets the pin high for 1 and low for 0.
// In this example the pins are inverted, setting
// it low/0 turns it on, and high/1 turns the LED off.
// This behavior depends on whether the LED is between the pin
// and VCC or the pin and GND.
writePin(B0, !led_state.num_lock);
writePin(B1, !led_state.caps_lock);
writePin(B2, !led_state.scroll_lock);
writePin(B3, !led_state.compose);
writePin(B4, !led_state.kana);
}
return res;
}
Expand Down

0 comments on commit 61f49dc

Please sign in to comment.