From 61051c74eea0f58ea7479e016c680e234a135f30 Mon Sep 17 00:00:00 2001 From: Kai Ryu Date: Fri, 18 Jul 2014 11:17:45 +0900 Subject: [PATCH] Experimental implement SoftPWM for GH60 --- keyboard/gh60/Makefile | 1 + keyboard/gh60/backlight.c | 59 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/keyboard/gh60/Makefile b/keyboard/gh60/Makefile index b20fe4d5..f8206667 100644 --- a/keyboard/gh60/Makefile +++ b/keyboard/gh60/Makefile @@ -139,6 +139,7 @@ USB_6KRO_ENABLE = yes # USB 6key Rollover 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 BREATHING_LED_ENABLE = yes # Enable breathing backlight diff --git a/keyboard/gh60/backlight.c b/keyboard/gh60/backlight.c index 3a8f6c0e..59c865a9 100644 --- a/keyboard/gh60/backlight.c +++ b/keyboard/gh60/backlight.c @@ -19,7 +19,11 @@ along with this program. If not, see . #include #include #include "backlight.h" +#ifdef SOFTPWM_LED_ENABLE +#include "softpwm_led.h" +#else #include "breathing_led.h" +#endif #ifdef BACKLIGHT_ENABLE @@ -27,12 +31,14 @@ void backlight_enable(void); void backlight_disable(void); inline void backlight_set_raw(uint8_t raw); +#ifndef SOFTPWM_LED_ENABLE #ifdef GH60_REV_CHN #else #define SOFTPWM_TIMER_TOP F_CPU/(256*64) uint8_t softpwm_ocr = 0; uint8_t softpwm_ocr_buff = 0; #endif +#endif static const uint8_t backlight_table[] PROGMEM = { 0, 16, 128, 255 @@ -44,6 +50,16 @@ static const uint8_t backlight_table[] PROGMEM = { */ void backlight_enable(void) { +#ifdef SOFTPWM_LED_ENABLE +#if defined(GH60_REV_CHN) + DDRB |= (1<