fix: shine led indicator brightness

This commit is contained in:
Florian
2024-11-14 17:00:57 +07:00
parent ac5f08afed
commit 0b6f7f996c

View File

@@ -1,18 +1,65 @@
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
// SPDX-License-Identifier: GPL-3.0-or-later
#include <stdint.h>
#include "ergodox_ez.h"
static uint8_t ergodox_right_led_1_duty;
static uint8_t ergodox_right_led_2_duty;
static uint8_t ergodox_right_led_3_duty;
void ergodox_right_led_1_set(uint8_t n) {
OCR1A = n;
ergodox_right_led_1_duty = n;
if (ergodox_right_led_1_duty == 0) {
ergodox_right_led_1_off();
} else {
ergodox_right_led_1_on();
}
}
void ergodox_right_led_1_on(void) {
OCR1A = ergodox_right_led_1_duty;
}
void ergodox_right_led_1_off(void) {
OCR1A = 0;
}
void ergodox_right_led_2_set(uint8_t n) {
OCR1B = n;
ergodox_right_led_2_duty = n;
if (ergodox_right_led_2_duty == 0) {
ergodox_right_led_2_off();
} else {
ergodox_right_led_2_on();
}
}
void ergodox_right_led_2_on(void) {
OCR1B = ergodox_right_led_2_duty;
}
void ergodox_right_led_2_off(void) {
OCR1B = 0;
}
void ergodox_right_led_3_set(uint8_t n) {
OCR1C = n;
ergodox_right_led_3_duty = n;
if (ergodox_right_led_3_duty == 0) {
ergodox_right_led_3_off();
} else {
ergodox_right_led_3_on();
}
}
void ergodox_right_led_3_off(void) {
OCR1C = 0;
}
void ergodox_right_led_3_on(void) {
OCR1C = ergodox_right_led_3_duty;
}
void keyboard_post_init_sub(void) {
// keyboard LEDs (see "PWM on ports OC1(A|B|C)" in "teensy-2-0.md")
TCCR1A = 0b10101001; // set and configure fast PWM