Skip to content

Commit

Permalink
fix: shine led indicator brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
fdidron committed Nov 14, 2024
1 parent ac5f08a commit 0b6f7f9
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions keyboards/zsa/ergodox_ez/m32u4/m32u4.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,65 @@
// Copyright 2023 Christopher Courtney, aka Drashna Jael're (@drashna) <[email protected]>
// 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
Expand Down

0 comments on commit 0b6f7f9

Please sign in to comment.