1
0

Add init callback function to softpwm_led

This commit is contained in:
Kai Ryu 2014-08-03 12:00:18 +09:00
parent 89bdc9fb72
commit 78242ebba1
5 changed files with 22 additions and 6 deletions

View File

@ -91,18 +91,18 @@ void keyboard_init(void)
ledmap_init();
#endif
#ifdef BACKLIGHT_ENABLE
backlight_init();
#endif
#ifdef SOFTPWM_LED_ENABLE
softpwm_led_init();
softpwm_init();
#endif
#ifdef BREATHING_LED_ENABLE
breathing_led_init();
#endif
#ifdef BACKLIGHT_ENABLE
backlight_init();
#endif
#ifdef KEYMAP_IN_EEPROM_ENABLE
keymap_in_eeprom_init();
#endif

View File

@ -83,6 +83,10 @@ void layer_state_change(uint32_t state)
#endif
#ifdef SOFTPWM_LED_ENABLE
void softpwm_led_init(void)
{
}
void softpwm_led_on(uint8_t index)
{
if (backlight_binding & LED_BIT(index)) {

View File

@ -11,7 +11,7 @@ static uint8_t softpwm_led_state = 0;
static uint8_t softpwm_led_ocr[LED_COUNT] = {0};
static uint8_t softpwm_led_ocr_buff[LED_COUNT] = {0};
void softpwm_led_init(void)
void softpwm_init(void)
{
#ifdef SOFTPWM_LED_TIMER3
/* Timer3 setup */
@ -38,6 +38,7 @@ void softpwm_led_init(void)
OCR1AL = SOFTPWM_LED_TIMER_TOP & 0xff;
SREG = sreg;
#endif
softpwm_led_init();
}
void softpwm_led_enable(void)

View File

@ -8,6 +8,7 @@ typedef led_pack_t led_state_t;
#ifdef SOFTPWM_LED_ENABLE
void softpwm_init(void);
void softpwm_led_init(void);
void softpwm_led_enable(void);
void softpwm_led_disable(void);
@ -43,6 +44,7 @@ void breathing_led_set_duration_all(uint8_t dur);
#else
#define softpwm_init()
#define softpwm_led_init()
#define softpwm_led_enable()
#define softpwm_led_disable()

View File

@ -174,6 +174,15 @@ inline void backlight_set_raw(uint8_t raw)
#ifdef SOFTPWM_LED_ENABLE
#ifndef LEDMAP_ENABLE
void softpwm_led_init(void)
{
#if defined(GH60_REV_CHN)
DDRB |= (1<<PB6);
#else
DDRF |= (1<<PF7 | 1<<PF6 | 1<<PF5 | 1<<PF4);
#endif
}
void softpwm_led_on(uint8_t index)
{
#if defined(GH60_REV_CHN)