diff --git a/keyboard/ghpad/Makefile b/keyboard/ghpad/Makefile
index 09636010..8298db26 100644
--- a/keyboard/ghpad/Makefile
+++ b/keyboard/ghpad/Makefile
@@ -51,7 +51,8 @@ TARGET_DIR = .
SRC = keymap_common.c \
matrix.c \
led.c \
- backlight.c
+ backlight.c \
+ ledmap.c
ifdef KEYMAP
SRC := keymap_$(KEYMAP).c $(SRC)
@@ -128,10 +129,16 @@ CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
+USB_6KRO_ENABLE = yes # USB 6key Rollover
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
-KEYMAP_EX_ENABLE = yes # External keymap in eeprom
-KEYMAP_SECTION_ENABLE = yes # Fixed address keymap for keymap editor
+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
+FADING_LED_ENABLE = yes # Enable fading backlight
+BREATHING_LED_ENABLE = yes # Enable breathing backlight
+LEDMAP_ENABLE = yes # Enable LED mapping
+LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
# Optimize size but this may cause error "relocation truncated to fit"
diff --git a/keyboard/ghpad/Makefile.pjrc b/keyboard/ghpad/Makefile.pjrc
index 83ca6c91..25d6e45d 100644
--- a/keyboard/ghpad/Makefile.pjrc
+++ b/keyboard/ghpad/Makefile.pjrc
@@ -50,7 +50,16 @@ TARGET_DIR = .
# project specific files
SRC = keymap.c \
matrix.c \
- led.c
+ led.c \
+ backlight.c \
+ ledmap.c
+
+ifdef KEYMAP
+ SRC := keymap_$(KEYMAP).c $(SRC)
+else
+ SRC := keymap_4x6.c $(SRC)
+endif
+
CONFIG_H = config.h
@@ -86,7 +95,16 @@ CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover(+500)
+USB_6KRO_ENABLE = yes # USB 6key Rollover
#PS2_MOUSE_ENABLE = yes # PS/2 mouse(TrackPoint) support
+BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
+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
+FADING_LED_ENABLE = yes # Enable fading backlight
+BREATHING_LED_ENABLE = yes # Enable breathing backlight
+LEDMAP_ENABLE = yes # Enable LED mapping
+LEDMAP_IN_EEPROM_ENABLE = yes # Read LED mapping from eeprom
# Search Path
diff --git a/keyboard/ghpad/backlight.c b/keyboard/ghpad/backlight.c
index f6b00317..df6bedbf 100644
--- a/keyboard/ghpad/backlight.c
+++ b/keyboard/ghpad/backlight.c
@@ -19,64 +19,96 @@ along with this program. If not, see .
#include
#include
#include "backlight.h"
+#include "softpwm_led.h"
+#include "action.h"
+
+#ifdef BACKLIGHT_ENABLE
+
+static uint8_t backlight_mode;
static const uint8_t backlight_table[] PROGMEM = {
0, 16, 128, 255
};
-uint8_t softpwm_ocr = 0;
-
/* Backlight pin configuration
- * PWM: PB5 (RevRS)
+ * PWM: PB5 (RevRS)
* GPIO: PF7 PF6 PF5
*/
void backlight_set(uint8_t level)
{
- if (level > 0) {
- // Turn on PWM
- cli();
- // Hard PWM
- DDRB |= (1<.
#define DEBOUNCE 5
/* number of backlight levels */
-#define BACKLIGHT_LEVELS 3
+#define BACKLIGHT_LEVELS 8
+
+#define LED_COUNT 5
/* number of backlight levels */
//#define BACKLIGHT_LEVELS 3
diff --git a/keyboard/ghpad/keymap_4x6.c b/keyboard/ghpad/keymap_4x6.c
index c70ff7a7..5fe21345 100644
--- a/keyboard/ghpad/keymap_4x6.c
+++ b/keyboard/ghpad/keymap_4x6.c
@@ -40,7 +40,7 @@ const uint16_t fn_actions[] PROGMEM = {
#endif
};
-#ifdef KEYMAP_EX_ENABLE
+#ifdef KEYMAP_IN_EEPROM_ENABLE
uint16_t keys_count(void) {
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS;
}
diff --git a/keyboard/ghpad/keymap_4x6_backlight.c b/keyboard/ghpad/keymap_4x6_backlight.c
index e2359034..fc2c0026 100644
--- a/keyboard/ghpad/keymap_4x6_backlight.c
+++ b/keyboard/ghpad/keymap_4x6_backlight.c
@@ -43,7 +43,7 @@ const uint16_t fn_actions[] PROGMEM = {
[2] = ACTION_BACKLIGHT_INCREASE()
};
-#ifdef KEYMAP_EX_ENABLE
+#ifdef KEYMAP_IN_EEPROM_ENABLE
uint16_t keys_count(void) {
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS;
}
diff --git a/keyboard/ghpad/keymap_arrow.c b/keyboard/ghpad/keymap_arrow.c
index 0bf98ed6..da60a8cf 100644
--- a/keyboard/ghpad/keymap_arrow.c
+++ b/keyboard/ghpad/keymap_arrow.c
@@ -51,7 +51,7 @@ const uint16_t fn_actions[] PROGMEM = {
[2] = ACTION_BACKLIGHT_INCREASE()
};
-#ifdef KEYMAP_EX_ENABLE
+#ifdef KEYMAP_IN_EEPROM_ENABLE
uint16_t keys_count(void) {
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS;
}
diff --git a/keyboard/ghpad/keymap_common.c b/keyboard/ghpad/keymap_common.c
index ae934eea..6ab88064 100644
--- a/keyboard/ghpad/keymap_common.c
+++ b/keyboard/ghpad/keymap_common.c
@@ -19,7 +19,7 @@ along with this program. If not, see .
/* translates key to keycode */
uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
{
-#ifndef KEYMAP_EX_ENABLE
+#ifndef KEYMAP_IN_EEPROM_ENABLE
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
#else
return eeconfig_read_keymap_key(layer, key.row, key.col);
@@ -30,7 +30,7 @@ uint8_t keymap_key_to_keycode(uint8_t layer, key_t key)
action_t keymap_fn_to_action(uint8_t keycode)
{
return (action_t) {
-#ifndef KEYMAP_EX_ENABLE
+#ifndef KEYMAP_IN_EEPROM_ENABLE
.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)])
#else
.code = eeconfig_read_keymap_fn_action(FN_INDEX(keycode))
@@ -38,7 +38,7 @@ action_t keymap_fn_to_action(uint8_t keycode)
};
}
-#ifdef KEYMAP_EX_ENABLE
+#ifdef KEYMAP_IN_EEPROM_ENABLE
const uint8_t* keymaps_pointer(void) {
return (const uint8_t*)keymaps;
}
diff --git a/keyboard/ghpad/keymap_common.h b/keyboard/ghpad/keymap_common.h
index 32f4019f..9595a89b 100644
--- a/keyboard/ghpad/keymap_common.h
+++ b/keyboard/ghpad/keymap_common.h
@@ -28,7 +28,7 @@ along with this program. If not, see .
#include "print.h"
#include "debug.h"
#include "keymap.h"
-#include "keymap_ex.h"
+#include "keymap_in_eeprom.h"
extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[];
diff --git a/keyboard/ghpad/keymap_redscarf.c b/keyboard/ghpad/keymap_redscarf.c
index 0bf8c591..a11396eb 100644
--- a/keyboard/ghpad/keymap_redscarf.c
+++ b/keyboard/ghpad/keymap_redscarf.c
@@ -41,7 +41,7 @@ const uint16_t fn_actions[] PROGMEM = {
[0] = ACTION_BACKLIGHT_STEP(),
};
-#ifdef KEYMAP_EX_ENABLE
+#ifdef KEYMAP_IN_EEPROM_ENABLE
uint16_t keys_count(void) {
return sizeof(keymaps) / sizeof(keymaps[0]) * MATRIX_ROWS * MATRIX_COLS;
}
diff --git a/keyboard/ghpad/led.c b/keyboard/ghpad/led.c
index 04104fb7..d5f9e1c6 100644
--- a/keyboard/ghpad/led.c
+++ b/keyboard/ghpad/led.c
@@ -19,6 +19,7 @@ along with this program. If not, see .
#include "stdint.h"
#include "led.h"
+#ifndef LEDMAP_ENABLE
void led_set(uint8_t usb_led)
{
@@ -32,3 +33,5 @@ void led_set(uint8_t usb_led)
PORTB &= ~(1<
+#include "ledmap.h"
+#include "debug.h"
+
+
+#ifdef LEDMAP_ENABLE
+
+static const uint8_t ledmaps[LED_COUNT] PROGMEM = {
+ [0] = LEDMAP_NUM_LOCK | LEDMAP_BACKLIGHT, // LEDS1 - PB2
+ [1] = LEDMAP_BACKLIGHT, // LEDS6 - PF7
+ [2] = LEDMAP_BACKLIGHT, // LEDS11 - PF6
+ [3] = LEDMAP_BACKLIGHT, // LEDS16 - PF5
+ [4] = LEDMAP_BACKLIGHT, // PWM - PB5
+};
+
+uint8_t ledmap_get_code(uint8_t index)
+{
+ return pgm_read_byte(&ledmaps[index]);
+}
+
+void ledmap_led_init(void)
+{
+ DDRB |= (1<