diff options
| author | Drashna Jaelre <drashna@live.com> | 2018-06-03 14:57:35 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-06-03 17:57:35 -0400 |
| commit | cb91320d6d8836dd13db19bd2434abe2e7cadc20 (patch) | |
| tree | bf0d08f1560a3928ef21ca80d4ac953d09dd71c7 /docs/custom_quantum_functions.md | |
| parent | 692a77c2dd8a369f6ae6efa22270d1bdeb551f0b (diff) | |
| download | qmk_firmware-cb91320d6d8836dd13db19bd2434abe2e7cadc20.tar.gz qmk_firmware-cb91320d6d8836dd13db19bd2434abe2e7cadc20.zip | |
Add Suspend functions (#3112)
* Add suspend functions
* Disable RGB code if it's disabled
* Add suspend code to ChibiOS for future compatibility
* Add keyboard_init functions
* Change where references so it will compile
* Wrong command chained in wake up kb function
* Fix non-feature file changes
* Add documentation
* Re-add matrix init docs
* add rgblight code to example
* Remove keyboard init stuff for separate PR
Diffstat (limited to 'docs/custom_quantum_functions.md')
| -rw-r--r-- | docs/custom_quantum_functions.md | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md index 6d741b6cb..9a1c486df 100644 --- a/docs/custom_quantum_functions.md +++ b/docs/custom_quantum_functions.md | |||
| @@ -135,9 +135,11 @@ void led_set_user(uint8_t usb_led) { | |||
| 135 | * Keyboard/Revision: `void led_set_kb(uint8_t usb_led)` | 135 | * Keyboard/Revision: `void led_set_kb(uint8_t usb_led)` |
| 136 | * Keymap: `void led_set_user(uint8_t usb_led)` | 136 | * Keymap: `void led_set_user(uint8_t usb_led)` |
| 137 | 137 | ||
| 138 | |||
| 138 | # Matrix Initialization Code | 139 | # Matrix Initialization Code |
| 139 | 140 | ||
| 140 | Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LED's or i²c controllers you will need to set up that hardware before it can be used. | 141 | Before a keyboard can be used the hardware must be initialized. QMK handles initialization of the keyboard matrix itself, but if you have other hardware like LED's or i²c controllers you will need to set up that hardware before it can be used. |
| 142 | |||
| 141 | 143 | ||
| 142 | ### Example `matrix_init_user()` Implementation | 144 | ### Example `matrix_init_user()` Implementation |
| 143 | 145 | ||
| @@ -177,9 +179,38 @@ This function gets called at every matrix scan, which is basically as often as t | |||
| 177 | You should use this function if you need custom matrix scanning code. It can also be used for custom status output (such as LED's or a display) or other functionality that you want to trigger regularly even when the user isn't typing. | 179 | You should use this function if you need custom matrix scanning code. It can also be used for custom status output (such as LED's or a display) or other functionality that you want to trigger regularly even when the user isn't typing. |
| 178 | 180 | ||
| 179 | 181 | ||
| 182 | # Keyboard Idling/Wake Code | ||
| 183 | |||
| 184 | If the board supports it, it can be "idled", by stopping a number of functions. A good example of this is RGB lights or backlights. This can save on power consumption, or may be better behavior for your keyboard. | ||
| 185 | |||
| 186 | This is controlled by two functions: `suspend_power_down_*` and `suspend_wakeup_init_*`, which are called when the system is board is idled and when it wakes up, respectively. | ||
| 187 | |||
| 188 | |||
| 189 | ### Example suspend_power_down_user() and suspend_wakeup_init_user() Implementation | ||
| 190 | |||
| 191 | This example, at the keyboard level, sets up B1, B2, and B3 as LED pins. | ||
| 192 | |||
| 193 | ``` | ||
| 194 | void suspend_power_down_user(void) | ||
| 195 | { | ||
| 196 | rgb_matrix_set_suspend_state(true); | ||
| 197 | } | ||
| 198 | |||
| 199 | void suspend_wakeup_init_user(void) | ||
| 200 | { | ||
| 201 | rgb_matrix_set_suspend_state(false); | ||
| 202 | } | ||
| 203 | |||
| 204 | ``` | ||
| 205 | |||
| 206 | ### `keyboard_init_*` Function Documentation | ||
| 207 | |||
| 208 | * Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` | ||
| 209 | * Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)` | ||
| 210 | |||
| 180 | # Layer Change Code | 211 | # Layer Change Code |
| 181 | 212 | ||
| 182 | Thir runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling. | 213 | This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling. |
| 183 | 214 | ||
| 184 | ### Example `layer_state_set_*` Implementation | 215 | ### Example `layer_state_set_*` Implementation |
| 185 | 216 | ||
