diff --git a/keyboard/gh60/Makefile b/keyboard/gh60/Makefile
index f8206667..5dc426df 100644
--- a/keyboard/gh60/Makefile
+++ b/keyboard/gh60/Makefile
@@ -52,6 +52,7 @@ SRC = keymap_common.c \
matrix.c \
led.c \
backlight.c \
+ ledmap.c \
led_matrix.c
ifdef KEYMAP
@@ -141,6 +142,7 @@ KEYMAP_IN_EEPROM_ENABLE = yes # Read keymap from eeprom
KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
SOFTPWM_LED_ENABLE = yes # Enable SoftPWM to drive backlight
BREATHING_LED_ENABLE = yes # Enable breathing backlight
+LEDMAP_ENABLE = yes # Enable LED mapping
# Optimize size but this may cause error "relocation truncated to fit"
diff --git a/keyboard/gh60/backlight.c b/keyboard/gh60/backlight.c
index 59c865a9..30dabea8 100644
--- a/keyboard/gh60/backlight.c
+++ b/keyboard/gh60/backlight.c
@@ -169,6 +169,7 @@ inline void backlight_set_raw(uint8_t raw)
}
#ifdef SOFTPWM_LED_ENABLE
+#ifndef LEDMAP_ENABLE
void softpwm_led_on(void)
{
@@ -189,6 +190,7 @@ void softpwm_led_off(void)
}
#endif
+#endif
#ifndef SOFTPWM_LED_ENABLE
diff --git a/keyboard/gh60/config.h b/keyboard/gh60/config.h
index 94f6ba24..2881b8fa 100644
--- a/keyboard/gh60/config.h
+++ b/keyboard/gh60/config.h
@@ -53,6 +53,15 @@ along with this program. If not, see .
#define LED_MATRIX_COLS 14
#endif
+/* LED mapping */
+#ifdef LEDMAP_ENABLE
+#if defined(GH60_REV_CHN)
+#define LED_COUNT 2
+#else
+#define LED_COUNT 5
+#endif
+#endif
+
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
diff --git a/keyboard/gh60/led.c b/keyboard/gh60/led.c
index 62abcd79..fbc01c58 100644
--- a/keyboard/gh60/led.c
+++ b/keyboard/gh60/led.c
@@ -20,6 +20,7 @@ along with this program. If not, see .
#include "led.h"
+#ifndef LEDMAP_ENABLE
void led_set(uint8_t usb_led)
{
if (usb_led & (1<
+
+
+#ifdef LEDMAP_ENABLE
+
+static const uint8_t ledmaps[LED_COUNT] PROGMEM = {
+#if defined(GH60_REV_CHN)
+ [0] = LEDMAP_CAPS_LOCK, // CapsLock - PB2
+ [1] = LEDMAP_BACKLIGHT, // PWM - PB6
+#else
+ [0] = LEDMAP_CAPS_LOCK, // CapsLock - PB2
+ [1] = LEDMAP_BACKLIGHT, // Esc - GPIO1 - PF6
+ [2] = LEDMAP_LAYER(1), // WASD - GPIO0 - PF7
+ [3] = LEDMAP_LAYER(2), // Sh/Al/Ct - GPIO3 - PF4
+ [4] = LEDMAP_LAYER(1), // Fn - GPIO2 - PF5
+#endif
+};
+
+uint8_t ledmap_get_code(uint8_t index)
+{
+ return pgm_read_byte(&ledmaps[index]);
+}
+
+void ledmap_led_init(void)
+{
+ DDRB |= (1<