aboutsummaryrefslogtreecommitdiff
path: root/docs/custom_quantum_functions.md
diff options
context:
space:
mode:
authorYan-Fa Li <yanfali@gmail.com>2019-11-23 07:37:25 -0800
committerJoel Challis <git@zvecr.com>2019-11-23 15:37:25 +0000
commit3541f01a72c4bf2e284d6c96b9697d29c68a47bd (patch)
tree3bdb7cc003a890ae45edf1751d4a0e88ff91aa18 /docs/custom_quantum_functions.md
parenteae21eed743d8bb9fd961f91d97a92f0f94247fe (diff)
downloadqmk_firmware-3541f01a72c4bf2e284d6c96b9697d29c68a47bd.tar.gz
qmk_firmware-3541f01a72c4bf2e284d6c96b9697d29c68a47bd.zip
Update led_update_kb example (#7451)
* Update led_update_kb example * Update comment to explain pin behavior * wordsmith * wordsmithing 2
Diffstat (limited to 'docs/custom_quantum_functions.md')
-rw-r--r--docs/custom_quantum_functions.md35
1 files changed, 10 insertions, 25 deletions
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index 3879e43bc..71a30bc7c 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -132,31 +132,16 @@ Some examples include:
132bool led_update_kb(led_t led_state) { 132bool led_update_kb(led_t led_state) {
133 bool res = led_update_user(led_state); 133 bool res = led_update_user(led_state);
134 if(res) { 134 if(res) {
135 if (led_state.num_lock) { 135 // writePin sets the pin high for 1 and low for 0.
136 writePinLow(B0); 136 // In this example the pins are inverted, setting
137 } else { 137 // it low/0 turns it on, and high/1 turns the LED off.
138 writePinHigh(B0); 138 // This behavior depends on whether the LED is between the pin
139 } 139 // and VCC or the pin and GND.
140 if (led_state.caps_lock) { 140 writePin(B0, !led_state.num_lock);
141 writePinLow(B1); 141 writePin(B1, !led_state.caps_lock);
142 } else { 142 writePin(B2, !led_state.scroll_lock);
143 writePinHigh(B1); 143 writePin(B3, !led_state.compose);
144 } 144 writePin(B4, !led_state.kana);
145 if (led_state.scroll_lock) {
146 writePinLow(B2);
147 } else {
148 writePinHigh(B2);
149 }
150 if (led_state.compose) {
151 writePinLow(B3);
152 } else {
153 writePinHigh(B3);
154 }
155 if (led_state.kana) {
156 writePinLow(B4);
157 } else {
158 writePinHigh(B4);
159 }
160 } 145 }
161 return res; 146 return res;
162} 147}