Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle UNSELECT_DRIVE_HIGH and SN32F2XX_PWM_OUTPUT_ACTIVE_HIGH #441

Open
wants to merge 2 commits into
base: sn32_develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_RGB_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_RGB_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
Loading