forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 401
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|