summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/custom_quantum_functions.md21
1 files changed, 8 insertions, 13 deletions
diff --git a/docs/custom_quantum_functions.md b/docs/custom_quantum_functions.md
index 655fa1578..418faf349 100644
--- a/docs/custom_quantum_functions.md
+++ b/docs/custom_quantum_functions.md
@@ -235,7 +235,7 @@ This example, running after everything else has initialized, sets up the rgb und
void keyboard_post_init_user(void) {
// Call the post init code.
rgblight_enable_noeeprom(); // enables Rgb, without saving settings
- rgblight_sethsv_noeeprom(180, 255, 255): // sets the color to teal/cyan without saving
+ rgblight_sethsv_noeeprom(180, 255, 255); // sets the color to teal/cyan without saving
rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); // sets mode to Fast breathing without saving
}
```
@@ -342,7 +342,7 @@ This is an example of how to add settings, and read and write it. We're using th
In your keymap.c file, add this to the top:
-```
+```c
typedef union {
uint32_t raw;
struct {
@@ -358,7 +358,7 @@ This sets up a 32 bit structure that we can store settings with in memory, and w
We're using `rgb_layer_change`, for the `layer_state_set_*` function, and use `keyboard_post_init_user` and `process_record_user` to configure everything.
Now, using the `keyboard_post_init_user` code above, you want to add `eeconfig_read_user()` to it, to populate the structure you've just created. And you can then immediately use this structure to control functionality in your keymap. And It should look like:
-```
+```c
void keyboard_post_init_user(void) {
// Call the keymap level matrix init.
@@ -375,7 +375,7 @@ void keyboard_post_init_user(void) {
```
The above function will use the EEPROM config immediately after reading it, to set the default layer's RGB color. The "raw" value of it is converted in a usable structure based on the "union" that you created above.
-```
+```c
uint32_t layer_state_set_user(uint32_t state) {
switch (biton32(state)) {
case _RAISE:
@@ -397,8 +397,8 @@ uint32_t layer_state_set_user(uint32_t state) {
return state;
}
```
-This will cause the RGB underglow to be changed ONLY if the value was enabled. Now to configure this value, create a new keycode for `process_record_user` called `RGB_LYR` and `EPRM`. Additionally, we want to make sure that if you use the normal RGB codes, that it turns off Using the example above, make it look this:
-```
+This will cause the RGB underglow to be changed ONLY if the value was enabled. Now to configure this value, create a new keycode for `process_record_user` called `RGB_LYR`. Additionally, we want to make sure that if you use the normal RGB codes, that it turns off Using the example above, make it look this:
+```c
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@@ -415,11 +415,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
PLAY_NOTE_ARRAY(tone_qwerty);
}
return true; // Let QMK send the enter press/release events
- case EPRM:
- if (record->event.pressed) {
- eeconfig_init(); // resets the EEPROM to default
- }
- return false;
case RGB_LYR: // This allows me to use underglow as layer indication, or as normal
if (record->event.pressed) {
user_config.rgb_layer_change ^= 1; // Toggles the status
@@ -442,9 +437,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
```
-And lastly, you want to add the `eeconfig_init_user` function, so that when the EEPROM is reset, you can specify default values, and even custom actions. For example, if you want to set rgb layer indication by default, and save the default valued.
+And lastly, you want to add the `eeconfig_init_user` function, so that when the EEPROM is reset, you can specify default values, and even custom actions. To force an EEPROM reset, use the `EEP_RST` keycode or [Bootmagic](feature_bootmagic.md) functionallity. For example, if you want to set rgb layer indication by default, and save the default valued.
-```
+```c
void eeconfig_init_user(void) { // EEPROM is getting reset!
user_config.raw = 0;
user_config.rgb_layer_change = true; // We want this enabled by default