Removed LEFT_LEDS code

master
Mark 2022-06-16 11:15:18 -07:00
parent e6783b8064
commit 1366cfc2e5
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
4 changed files with 1 additions and 108 deletions

View File

@ -65,7 +65,6 @@ void matrix_init_kb(void) {
PORTE |= (1<<6); PORTE |= (1<<6);
keyboard_config.raw = eeconfig_read_kb(); keyboard_config.raw = eeconfig_read_kb();
ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 );
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
if (keyboard_config.rgb_matrix_enable) { if (keyboard_config.rgb_matrix_enable) {
rgb_matrix_set_flags(LED_FLAG_ALL); rgb_matrix_set_flags(LED_FLAG_ALL);
@ -88,49 +87,12 @@ void ergodox_blink_all_leds(void) {
_delay_ms(50); _delay_ms(50);
ergodox_right_led_3_on(); ergodox_right_led_3_on();
_delay_ms(50); _delay_ms(50);
#ifdef LEFT_LEDS
ergodox_left_led_1_on();
_delay_ms(50);
if (!mcp23018_status) {
mcp23018_status = ergodox_left_leds_update();
}
ergodox_left_led_2_on();
_delay_ms(50);
if (!mcp23018_status) {
mcp23018_status = ergodox_left_leds_update();
}
ergodox_left_led_3_on();
_delay_ms(50);
if (!mcp23018_status) {
mcp23018_status = ergodox_left_leds_update();
}
#endif
ergodox_right_led_1_off(); ergodox_right_led_1_off();
_delay_ms(50); _delay_ms(50);
ergodox_right_led_2_off(); ergodox_right_led_2_off();
_delay_ms(50); _delay_ms(50);
ergodox_right_led_3_off(); ergodox_right_led_3_off();
#ifdef LEFT_LEDS
_delay_ms(50);
ergodox_left_led_1_off();
if (!mcp23018_status) {
mcp23018_status = ergodox_left_leds_update();
}
_delay_ms(50);
ergodox_left_led_2_off();
if (!mcp23018_status) {
mcp23018_status = ergodox_left_leds_update();
}
_delay_ms(50);
ergodox_left_led_3_off();
if (!mcp23018_status) {
mcp23018_status = ergodox_left_leds_update();
}
#endif
//ergodox_led_all_on();
//_delay_ms(333);
ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 );
ergodox_led_all_off(); ergodox_led_all_off();
} }
@ -174,48 +136,11 @@ uint8_t init_mcp23018(void) {
out: out:
i2c_stop(); i2c_stop();
#ifdef LEFT_LEDS
if (!mcp23018_status) mcp23018_status = ergodox_left_leds_update();
#endif // LEFT_LEDS
// SREG=sreg_prev; // SREG=sreg_prev;
return mcp23018_status; return mcp23018_status;
} }
#ifdef LEFT_LEDS
uint8_t ergodox_left_leds_update(void) {
if (mcp23018_status) { // if there was an error
return mcp23018_status;
}
#define LEFT_LED_1_SHIFT 7 // in MCP23018 port B
#define LEFT_LED_2_SHIFT 6 // in MCP23018 port B
#define LEFT_LED_3_SHIFT 7 // in MCP23018 port A
// set logical value (doesn't matter on inputs)
// - unused : hi-Z : 1
// - input : hi-Z : 1
// - driving : hi-Z : 1
mcp23018_status = i2c_start(I2C_ADDR_WRITE, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(OLATA, ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111
& ~(ergodox_left_led_3<<LEFT_LED_3_SHIFT),
ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
mcp23018_status = i2c_write(0b11111111
& ~(ergodox_left_led_2<<LEFT_LED_2_SHIFT)
& ~(ergodox_left_led_1<<LEFT_LED_1_SHIFT),
ERGODOX_EZ_I2C_TIMEOUT);
if (mcp23018_status) goto out;
out:
i2c_stop();
return mcp23018_status;
}
#endif
#ifdef SWAP_HANDS_ENABLE #ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak)) __attribute__ ((weak))

View File

@ -44,7 +44,6 @@ extern i2c_status_t mcp23018_status;
void init_ergodox(void); void init_ergodox(void);
void ergodox_blink_all_leds(void); void ergodox_blink_all_leds(void);
uint8_t init_mcp23018(void); uint8_t init_mcp23018(void);
uint8_t ergodox_left_leds_update(void);
#ifndef LED_BRIGHTNESS_LO #ifndef LED_BRIGHTNESS_LO
#define LED_BRIGHTNESS_LO 15 #define LED_BRIGHTNESS_LO 15
@ -66,30 +65,12 @@ inline void ergodox_right_led_2_off(void) { DDRB &= ~(1<<6); PORTB &= ~(1<<6);
inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); } inline void ergodox_right_led_3_off(void) { DDRB &= ~(1<<7); PORTB &= ~(1<<7); }
inline void ergodox_right_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); } inline void ergodox_right_led_off(uint8_t led) { DDRB &= ~(1<<(led+4)); PORTB &= ~(1<<(led+4)); }
#ifdef LEFT_LEDS
bool ergodox_left_led_1;
bool ergodox_left_led_2;
bool ergodox_left_led_3;
inline void ergodox_left_led_1_on(void) { ergodox_left_led_1 = 1; }
inline void ergodox_left_led_2_on(void) { ergodox_left_led_2 = 1; }
inline void ergodox_left_led_3_on(void) { ergodox_left_led_3 = 1; }
inline void ergodox_left_led_1_off(void) { ergodox_left_led_1 = 0; }
inline void ergodox_left_led_2_off(void) { ergodox_left_led_2 = 0; }
inline void ergodox_left_led_3_off(void) { ergodox_left_led_3 = 0; }
#endif // LEFT_LEDS
inline void ergodox_led_all_on(void) { inline void ergodox_led_all_on(void) {
ergodox_board_led_on(); ergodox_board_led_on();
ergodox_right_led_1_on(); ergodox_right_led_1_on();
ergodox_right_led_2_on(); ergodox_right_led_2_on();
ergodox_right_led_3_on(); ergodox_right_led_3_on();
#ifdef LEFT_LEDS
ergodox_left_led_1_on();
ergodox_left_led_2_on();
ergodox_left_led_3_on();
#endif // LEFT_LEDS
} }
inline void ergodox_led_all_off(void) { inline void ergodox_led_all_off(void) {
@ -97,11 +78,6 @@ inline void ergodox_led_all_off(void) {
ergodox_right_led_1_off(); ergodox_right_led_1_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();
ergodox_right_led_3_off(); ergodox_right_led_3_off();
#ifdef LEFT_LEDS
ergodox_left_led_1_off();
ergodox_left_led_2_off();
ergodox_left_led_3_off();
#endif // LEFT_LEDS
} }
inline void ergodox_right_led_1_set(uint8_t n) { OCR1A = n; } inline void ergodox_right_led_1_set(uint8_t n) { OCR1A = n; }

View File

@ -100,9 +100,6 @@ bool matrix_scan_custom(matrix_row_t current_matrix[]) {
} }
} }
#ifdef LEFT_LEDS
mcp23018_status = ergodox_left_leds_update();
#endif // LEFT_LEDS
bool changed = false; bool changed = false;
for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) { for (uint8_t i = 0; i < MATRIX_ROWS_PER_SIDE; i++) {
// select rows from left and right hands // select rows from left and right hands

View File

@ -11,11 +11,6 @@ MCU = atmega32u4
# ATmega328P USBasp # ATmega328P USBasp
BOOTLOADER = halfkay BOOTLOADER = halfkay
# If you have Left LEDs (see
# https://geekhack.org/index.php?topic=22780.msg873819#msg873819 for
# details), include the following define:
# OPT_DEFS += -DLEFT_LEDS
# Build Options # Build Options
# comment out to disable the options. # comment out to disable the options.
# #