Skip to content

Commit

Permalink
Handle UNSELECT_DRIVE_HIGH and SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH
Browse files Browse the repository at this point in the history
  • Loading branch information
iglooom committed Jan 23, 2025
1 parent 6798b5e commit a213a0d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/led/sn32f2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static void shared_matrix_rgb_disable_output(void) {
gpio_set_pin_input(led_col_pins[x]);
# endif // DIODE_DIRECTION != SN32F2XX_PWM_DIRECTION
// Unselect all columns before scanning the key matrix
# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW)
# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_LOW || defined(MATRIX_UNSELECT_DRIVE_HIGH))
gpio_write_pin_high(led_col_pins[x]);
# elif (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_RGB_OUTPUT_ACTIVE_HIGH)
gpio_write_pin_low(led_col_pins[x]);
Expand Down Expand Up @@ -479,6 +479,13 @@ static void update_pwm_channels(PWMDriver *pwmp) {
# endif // SHARED_MATRIX
}

// Disable all RGB columns before turning on PWM in case matrix read unselect high
# if (SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH && defined(MATRIX_UNSELECT_DRIVE_HIGH))
for (uint8_t x = 0; x < SN32F2XX_RGB_MATRIX_COLS; x++) {
gpio_write_pin_low(led_col_pins[x]);
}
# endif // SN32F2XX_RGB_OUTPUT_ACTIVE_LEVEL == SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH && defined(MATRIX_UNSELECT_DRIVE_HIGH)

bool enable_pwm_output = false;
for (uint8_t current_key_row = 0; current_key_row < MATRIX_ROWS; current_key_row++) {
uint8_t led_index = g_led_config.matrix_co[current_key_row][current_key_col];
Expand Down

0 comments on commit a213a0d

Please sign in to comment.