forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "fix: shine led indicator brightness" This reverts commit 0b6f7f9. * Cleanup leds * Confirm working on AVR and ARM
- Loading branch information
Showing
3 changed files
with
43 additions
and
64 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
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
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,83 +1,55 @@ | ||
// 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) { | ||
ergodox_right_led_1_duty = n; | ||
if (ergodox_right_led_1_duty == 0) { | ||
ergodox_right_led_1_off(); | ||
} else { | ||
ergodox_right_led_1_on(); | ||
} | ||
OCR1A = n; | ||
} | ||
|
||
void ergodox_right_led_1_on(void) { | ||
OCR1A = ergodox_right_led_1_duty; | ||
void ergodox_right_led_2_set(uint8_t n) { | ||
OCR1B = n; | ||
} | ||
|
||
void ergodox_right_led_1_off(void) { | ||
OCR1A = 0; | ||
void ergodox_right_led_3_set(uint8_t n) { | ||
OCR1C = n; | ||
} | ||
|
||
void ergodox_right_led_2_set(uint8_t 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(); | ||
} | ||
__attribute__((weak)) void ergodox_right_led_1_on(void) { | ||
gpio_write_pin_high(ERGODOX_LED_1_PIN); | ||
} | ||
|
||
void ergodox_right_led_2_on(void) { | ||
OCR1B = ergodox_right_led_2_duty; | ||
__attribute__((weak)) void ergodox_right_led_2_on(void) { | ||
gpio_write_pin_high(ERGODOX_LED_2_PIN); | ||
} | ||
|
||
void ergodox_right_led_2_off(void) { | ||
OCR1B = 0; | ||
__attribute__((weak)) void ergodox_right_led_3_on(void) { | ||
gpio_write_pin_high(ERGODOX_LED_3_PIN); | ||
} | ||
|
||
void ergodox_right_led_3_set(uint8_t 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(); | ||
} | ||
__attribute__((weak)) void ergodox_right_led_1_off(void) { | ||
gpio_write_pin_low(ERGODOX_LED_1_PIN); | ||
} | ||
|
||
void ergodox_right_led_3_off(void) { | ||
OCR1C = 0; | ||
__attribute__((weak)) void ergodox_right_led_2_off(void) { | ||
gpio_write_pin_low(ERGODOX_LED_2_PIN); | ||
} | ||
|
||
void ergodox_right_led_3_on(void) { | ||
OCR1C = ergodox_right_led_3_duty; | ||
__attribute__((weak)) void ergodox_right_led_3_off(void) { | ||
gpio_write_pin_low(ERGODOX_LED_3_PIN); | ||
} | ||
|
||
|
||
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 | ||
TCCR1B = 0b00001001; // set and configure fast PWM | ||
|
||
// (tied to Vcc for hardware convenience) | ||
setPinInput(B4); | ||
gpio_set_pin_input(B4); | ||
|
||
// unused pins - C7, D4, D5, E6 | ||
// set as input with internal pull-up enabled | ||
setPinInputHigh(C7); | ||
setPinInputHigh(D4); | ||
setPinInputHigh(D5); | ||
setPinInputHigh(E6); | ||
|
||
setPinOutput(ERGODOX_LED_1_PIN); | ||
setPinOutput(ERGODOX_LED_2_PIN); | ||
setPinOutput(ERGODOX_LED_3_PIN); | ||
gpio_set_pin_input_high(C7); | ||
gpio_set_pin_input_high(D4); | ||
gpio_set_pin_input_high(D5); | ||
gpio_set_pin_input_high(E6); | ||
} | ||
|
||
#ifdef RGB_MATRIX_ENABLE | ||
|