From 1f42071238c57aff1ec2d441fe82ae2df4a0853f Mon Sep 17 00:00:00 2001
From: mcarni <michele.carnaghi@googlemail.com>
Date: Sat, 13 Jun 2020 09:29:22 +0200
Subject: [PATCH] dz60 iso split - cleaned up the readme and replaced normal
 key with numpad key on numpad layer (#9339)

* README cleanup

* replaced "normal" numbers with "keypad" numbers:
KC_P4 replaced by KC_KP_P4

* replaced "normal" keys on Numpad Layer with the "KeyPad" keys
KC_1 replaced by KC_P1 etc.
---
 .../dz60/keymaps/iso_split-spacebar/README.md | 123 ++++++++++--------
 .../dz60/keymaps/iso_split-spacebar/keymap.c  |  33 +++--
 2 files changed, 95 insertions(+), 61 deletions(-)

diff --git a/keyboards/dz60/keymaps/iso_split-spacebar/README.md b/keyboards/dz60/keymaps/iso_split-spacebar/README.md
index 7d96f2225f..2600d22715 100644
--- a/keyboards/dz60/keymaps/iso_split-spacebar/README.md
+++ b/keyboards/dz60/keymaps/iso_split-spacebar/README.md
@@ -1,69 +1,86 @@
-# iso layout with a split spacebar
+# ISO layout with a split spacebar
 
-i needed to have an ISO layout
-and i wanted to have a split spacebar
-i couldn't find anything ready so i cobbled this together
+I needed to have an ISO layout
+and I wanted to have a split spacebar
+I couldn't find anything ready 
+so i cobbled this together
 
 
 
----- Layer 0 - BL
-this is basically the standard iso layout with the addition of the split spacebar
+## Layer 0 - BL
+
+standard ISO layout with the addition of the split spacebar
 menu key (KC_APP) is used to move to the next layer
 the key in between the two spacebars is the function key
- *,-----------------------------------------------------------.
- *| ' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Backsp |
- *|-----------------------------------------------------------|
- *| Tab | q | w | e | r | t | y | u | i | o | p | [ | ] |enter|
- *|------------------------------------------------------     |
- *| Caps  | a | s | d | f | g | h | j | k | l | ; | ' | # |   |
- *|-----------------------------------------------------------|
- *|Shft| < | z | x | c | v | b | n | m | , | . | / |  Shift   |
- *|-----------------------------------------------------------|
- *|Ctrl|Gui |Alt | Space  | FN |  Space  |Alt |Gui | NL |Ctrl |
- *`-----------------------------------------------------------'
 
----- Layer 1 - FL
+```
+,-----------------------------------------------------------.
+| ' | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Backsp |
+|-----------------------------------------------------------|
+| Tab | q | w | e | r | t | y | u | i | o | p | [ | ] |enter|
+|------------------------------------------------------     |
+| Caps  | a | s | d | f | g | h | j | k | l | ; | ' | # |   |
+|-----------------------------------------------------------|
+|Shft| < | z | x | c | v | b | n | m | , | . | / |  Shift   |
+|-----------------------------------------------------------|
+|Ctrl|Gui |Alt | Space  | FN |  Space  |Alt |Gui | NL |Ctrl |
+`-----------------------------------------------------------'
+```
+
+## Layer 1 - FL
+
 quite standard function layer
 arrow keys and mouse movement/buttons on the home row 
- *,-----------------------------------------------------------.
- *|ESC|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|  DEL  |
- *|-----------------------------------------------------------|
- *|     |   |   |   |   |   |   |   |   |   |prt|   |   |     |
- *|------------------------------------------------------     |
- *|       |m l|m d|m u|m r|   |   | l | d | u | r |   |   |   |
- *|-----------------------------------------------------------|
- *|    |   |   |   |   |mb1|mb2|   |hm |pgd|pgu|end|          |
- *|-----------------------------------------------------------|
- *|    |    |    |        |    |         |    |    |    |     |
- *`-----------------------------------------------------------'
 
----- Layer 2 - NL
+```
+,-----------------------------------------------------------.
+|ESC|F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|  DEL  |
+|-----------------------------------------------------------|
+|     |   |   |   |   |   |   |   |   |   |prt|   |   |     |
+|------------------------------------------------------     |
+|       |m l|m d|m u|m r|   |   | l | d | u | r |   |   |   |
+|-----------------------------------------------------------|
+|    |   |   |   |   |mb1|mb2|   |hm |pgd|pgu|end|          |
+|-----------------------------------------------------------|
+|    |    |    |        |    |         |    |    |    |     |
+`-----------------------------------------------------------'
+```
+
+## Layer 2 - NL
+
 numbers numbers numbers...
 first key (top left) to return to BL
 menu key (KC_APP) is used to move to the next layer
- *,-----------------------------------------------------------.
- *|BL | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |   |   |       |
- *|-----------------------------------------------------------|
- *|     | 4 | 5 | 6 | * | / |   | 4 | 5 | 6 | * | / | ] |     |
- *|------------------------------------------------------     |
- *|       | 7 | 8 | 9 | + | - |   | 1 | 2 | 3 | + | - |   |   |
- *|-----------------------------------------------------------|
- *|    |   | 0 | , | . | = |   |   | 0 | , | . | = |      |
- *|-----------------------------------------------------------|
- *|    |    |    |        |    |         |    |    | RL |     |
- *`-----------------------------------------------------------'
+
+```
+,-----------------------------------------------------------.
+|BL | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |   |   |       |
+|-----------------------------------------------------------|
+|     | 4 | 5 | 6 | * | / |   | 4 | 5 | 6 | * | / | ] |     |
+|------------------------------------------------------     |
+|       | 7 | 8 | 9 | + | - |   | 1 | 2 | 3 | + | - |   |   |
+|-----------------------------------------------------------|
+|    |   | 0 | , | . | = |   |   | 0 | , | . | = |      |
+|-----------------------------------------------------------|
+|    |    |    |        |    |         |    |    | RL |     |
+`-----------------------------------------------------------'
+```
  
----- Layer 3 - BL
+## Layer 3 - BL
+
 all the fancy lights
 and useful reset button  (top right)
- *,-----------------------------------------------------------.
- *|BL |   |   |   |   |   |   |   |   |   |   |   |   |Reset  |
- *|-----------------------------------------------------------|
- *|     |tog|mod|hui|hud|   |   |sai|sad|vai|vad|   |   |     |
- *|------------------------------------------------------     |
- *|       |sta|bre|rai|swi|   |   |sna|kni|gra|xms|   |   |   |
- *|-----------------------------------------------------------|
- *|    |   |bd |bt |bi |bs |   |   |   |   |   |   |          |
- *|-----------------------------------------------------------|
- *|    |    |    |        |    |         |    |    | BL |     |
- *`-----------------------------------------------------------' 
+
+```
+,-----------------------------------------------------------.
+|BL |   |   |   |   |   |   |   |   |   |   |   |   |Reset  |
+|-----------------------------------------------------------|
+|     |tog|mod|hui|hud|   |   |sai|sad|vai|vad|   |   |     |
+|------------------------------------------------------     |
+|       |sta|bre|rai|swi|   |   |sna|kni|gra|xms|   |   |   |
+|-----------------------------------------------------------|
+|    |   |bd |bt |bi |bs |   |   |   |   |   |   |          |
+|-----------------------------------------------------------|
+|    |    |    |        |    |         |    |    | BL |     |
+`-----------------------------------------------------------'
+```
diff --git a/keyboards/dz60/keymaps/iso_split-spacebar/keymap.c b/keyboards/dz60/keymaps/iso_split-spacebar/keymap.c
index a54c06f557..a9e811f9a4 100644
--- a/keyboards/dz60/keymaps/iso_split-spacebar/keymap.c
+++ b/keyboards/dz60/keymaps/iso_split-spacebar/keymap.c
@@ -112,12 +112,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    * `-----------------------------------------------------------'
    */
    [NL] = LAYOUT_60_iso_split(
-	//  1          2          3          4          5          6          7          8          9          10         11         12         13         14
-	    TG(NL),    KC_1,      KC_2,      KC_3,      KC_4,      KC_5,      KC_6,      KC_7,      KC_8,      KC_9,      KC_0,      KC_MINS,   KC_EQL,    _______,
-        _______,   KC_4,      KC_5,      KC_6,      KC_PAST,   KC_PSLS,   _______,   KC_4,      KC_5,      KC_6,      KC_PAST,   KC_PSLS,   _______,
-        _______,   KC_7,      KC_8,      KC_9,      KC_PPLS,   KC_PMNS,   _______,   KC_1,      KC_2,      KC_3,      KC_PPLS,   KC_PMNS,   _______,   _______,
-        _______,   KC_0,      KC_COMM,   KC_DOT,    KC_EQL,    _______,   _______,   _______,   KC_0,      KC_COMM,   KC_DOT,    KC_EQL,    _______,
-        _______,   _______,   _______,   _______,   MO(FL),    _______,   _______,   _______,   TG(RL),    _______),
+	//  1          2         3          4          5          6          7          8          9        10        11        12         13         14
+	    TG(NL),    KC_P1,    KC_P2,     KC_P3,     KC_P4,     KC_P5,     KC_P6,     KC_P7,     KC_P8,   KC_P9,    KC_P0,     KC_PPLS,   KC_PMNS,   _______,
+        _______,   KC_P4,    KC_P5,     KC_P6,     KC_PAST,   KC_PSLS,   _______,   KC_P4,     KC_P5,   KC_P6,    KC_PAST,   KC_PSLS,   _______,
+        _______,   KC_P7,    KC_P8,     KC_P9,     KC_PPLS,   KC_PMNS,   _______,   KC_P1,     KC_P2,   KC_P3,    KC_PPLS,   KC_PMNS,   _______,   _______,
+        _______,   KC_P0,    KC_COMM,   KC_DOT,    KC_PEQL,   KC_PSLS,   KC_PMNS,   _______,   KC_P0,   KC_COMM,  KC_DOT,    KC_PEQL,   _______,
+        _______,   _______,  _______,   _______,   MO(FL),    _______,   _______,   _______,   TG(RL),  _______),
 
   /* Keymap RL: RGB Layer
    *
@@ -150,6 +150,23 @@ void persistent_default_layer_set(uint16_t default_layer) {
   default_layer_set(default_layer);
 }
 
+// always enable num lock on layer NL and disable on other layers
+// thanks to spidey3 & Erovia on discord
+layer_state_t layer_state_set_user(layer_state_t state) {
+    switch (get_highest_layer(state)) {
+    case NL:
+        if (!host_keyboard_led_state().num_lock) {
+             tap_code16(KC_NLCK);
+        }
+        break;
+    default: //  for any other layers, or the default layer
+        if (host_keyboard_led_state().num_lock) {
+             tap_code16(KC_NLCK);
+        }
+        break;
+    }
+  return state;
+}
 
 // layer-activated RGB underglow
 
@@ -172,11 +189,11 @@ void matrix_scan_user(void) {
         break;
       case NL:
           RGB_NL_MODE; 
-         // RGB_NL_LIGHT; 
+          RGB_NL_LIGHT; 
         break;
       case RL:
           RGB_RL_MODE; 
-         // RGB_RL_LIGHT;        
+          RGB_RL_LIGHT;        
         break;
     }