Ejemplo n.º 1
0
void backlight_set(uint8_t level)
{
    softpwm_enable();
    switch (level) {
    case 1:
    case 2:
    case 3:
        fading_led_disable_all();
        breathing_led_disable_all();
        backlight_brightness = pgm_read_byte(&backlight_table[level]);
        softpwm_led_set_all(backlight_brightness);
        rgb_set_brightness(backlight_brightness);
        softpwm_led_enable_all();
        break;
    case 4:
    case 5:
    case 6:
        fading_led_disable_all();
        breathing_led_set_duration(6 - level);
        breathing_led_set_index_all(0);
        breathing_led_enable_all();
        softpwm_led_enable_all();
        break;
    case 7:
        breathing_led_disable_all();
        breathing_led_set_duration(1);
        softpwm_led_set_all(0);
        fading_led_set_direction_all(FADING_LED_FADE_OUT);
        fading_led_set_duration(3);
        fading_led_enable_all();
        softpwm_led_enable_all();
        break;
    case 0:
    default:
        fading_led_disable_all();
        breathing_led_disable_all();
        backlight_brightness = 0;
        softpwm_led_set_all(backlight_brightness);
        softpwm_led_disable_all();
        break;
    }
}
Ejemplo n.º 2
0
/* Backlight pin configuration
 * PWM:  PB5 (RevRS)
 * GPIO: PF7  PF6  PF5
 */
void backlight_set(uint8_t level)
{
    softpwm_enable();
    switch (level) {
        case 1:
        case 2:
        case 3:
            softpwm_led_enable_all();
            fading_led_disable_all();
            breathing_led_disable_all();
            softpwm_led_set_all(pgm_read_byte(&backlight_table[level]));
            break;
        case 4:
        case 5:
        case 6:
            softpwm_led_enable_all();
            breathing_led_enable_all();
            fading_led_disable_all();
            breathing_led_set_duration(6 - level);
            break;
        case 7:
            softpwm_led_enable_all();
            fading_led_enable_all();
            breathing_led_disable_all();
            fading_led_set_direction_all(FADING_LED_FADE_IN);
            fading_led_set_duration(3);
            break;
        case 8:
            softpwm_led_enable_all();
            fading_led_enable_all();
            breathing_led_disable_all();
            fading_led_set_direction_all(FADING_LED_FADE_OUT);
            fading_led_set_duration(3);
            break;
        case 0:
        default:
            fading_led_disable_all();
            breathing_led_disable_all();
            softpwm_led_disable_all();
            break;
    }
}
Ejemplo n.º 3
0
void action_keyevent(keyevent_t event)
{
    if (backlight_config.enable) {
        if (backlight_config.level == 7) {
            if (event.pressed) {
                if (idle_state > 1) {
                    breathing_led_disable_all();
                }
                idle_state = 0;
                uint8_t key = event.key.col + 1;
                fading_led_set_delay(key, 64);
                softpwm_led_increase(key, 32);
            }
        }
    }
}
Ejemplo n.º 4
0
void backlight_set(uint8_t level)
{
#ifdef FADING_LED_ENABLE
    backlight_mode = level;
#endif

#ifdef BREATHING_LED_ENABLE
    switch (level) {
        case 1:
        case 2:
        case 3:
#ifdef SOFTPWM_LED_ENABLE
            softpwm_led_enable();
#ifdef FADING_LED_ENABLE
            fading_led_disable_all();
#endif
            breathing_led_disable_all();
#else
            backlight_enable();
            breathing_led_disable();
#endif
            backlight_set_raw(pgm_read_byte(&backlight_table[level]));
            break;
        case 4:
        case 5:
        case 6:
#ifdef SOFTPWM_LED_ENABLE
            softpwm_led_enable();
#ifdef FADING_LED_ENABLE
            fading_led_disable_all();
#endif
            breathing_led_enable_all();
#else
            backlight_enable();
            breathing_led_enable();
#endif
            breathing_led_set_duration(6 - level);
            break;
#ifdef SOFTPWM_LED_ENABLE
#ifdef FADING_LED_ENABLE
        case 7:
            softpwm_led_enable();
            fading_led_enable_all();
            breathing_led_disable_all();
            fading_led_set_direction(FADING_LED_FADE_IN);
            fading_led_set_duration(3);
            break;
        case 8:
            softpwm_led_enable();
            fading_led_enable_all();
            breathing_led_disable_all();
            fading_led_set_direction(FADING_LED_FADE_OUT);
            fading_led_set_duration(3);
            break;
#endif
#endif
        case 0:
        default:
#ifdef SOFTPWM_LED_ENABLE
#ifdef FADING_LED_ENABLE
            fading_led_disable_all();
#endif
            breathing_led_disable_all();
            softpwm_led_disable();
#else
            breathing_led_disable();
            backlight_disable();
#endif
            break;
    }
#else
    if (level > 0) {
        backlight_enable();
        backlight_set_raw(pgm_read_byte(&backlight_table[level]));
    }
    else {
        backlight_disable();
    }
#endif

}