-
Notifications
You must be signed in to change notification settings - Fork 417
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
sn32 rgb: yet another major update - more modularity #369
Conversation
837aee2
to
9989fdc
Compare
257f08e
to
456a43a
Compare
Working good for me on 268F with ROW2COL. But I had two things to change to make it perfect. Here I need to use qmk_firmware/drivers/led/sn32f2xx.c Lines 518 to 522 in e3f4c6d
This is also needed for qmk_firmware/drivers/led/sn32f2xx.c Lines 389 to 391 in e3f4c6d
qmk_firmware/drivers/led/sn32f2xx.c Lines 502 to 504 in e3f4c6d
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on K66 v1 with ROW2COL hardware PWM shared matrix.
With these 3 changes it is working very good for me.
} | ||
bool enable_pwm_output = false; | ||
for (uint8_t current_key_col = 0; current_key_col < SN32_RGB_MATRIX_COLS; current_key_col++) { | ||
uint8_t led_index = g_led_config.matrix_co[current_key_row][current_key_col]; | ||
# if (SN32_PWM_CONTROL == SOFTWARE_PWM) | ||
if (led_index >= SN32F24XB_LED_COUNT) continue; | ||
if (led_index >= SN32F2XX_LED_COUNT) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this line is necessary also for hardware PWM.
If this is not used the last keys in cols which have less then the standard amount of keys. (e.g. just 4 than normally 5) will light up dimly.
@@ -380,7 +500,7 @@ static void update_pwm_channels(PWMDriver *pwmp) { | |||
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]; | |||
# if (SN32_PWM_CONTROL == SOFTWARE_PWM) | |||
if (led_index >= SN32F24XB_LED_COUNT) continue; | |||
if (led_index >= SN32F2XX_LED_COUNT) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this line is necessary also for hardware PWM.
If this is not used the last keys in cols which have less then the standard amount of keys. (e.g. just 4 than normally 5) will light up dimly.
@@ -380,7 +500,7 @@ static void update_pwm_channels(PWMDriver *pwmp) { | |||
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]; | |||
# if (SN32_PWM_CONTROL == SOFTWARE_PWM) | |||
if (led_index >= SN32F24XB_LED_COUNT) continue; | |||
if (led_index >= SN32F2XX_LED_COUNT) continue; | |||
# endif | |||
uint8_t led_row_id = (current_key_row * SN32_RGB_MATRIX_ROW_CHANNELS); | |||
// Check if we need to enable RGB output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In line 519 and 521 I need current_key_col instead of last_key_col.
Otherwise the keypress effects are shifted one col to the left.
// Enable RGB output
if (enable_pwm_output) {
# if (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_HIGH)
writePinHigh(led_col_pins[current_key_col ]);
# elif (SN32_RGB_OUTPUT_ACTIVE_LEVEL == SN32_RGB_OUTPUT_ACTIVE_LOW)
writePinLow(led_col_pins[current_key_col ]);
# endif // SN32_RGB_OUTPUT_ACTIVE_LEVEL
}
only use custom scanning if the wiring is shared
depending on configuration
happy new year!
LED output differs depending on the module used, as well as the current limiting setup. Introduce a luminosity correction factor that will limit output on overdriven channels, allowing fine tuning through PWM scaling.
fix ROW2COL PWM bug on COL2ROW A column would light up when pressed on this scenario
4889fd3
to
93db451
Compare
@fightforlife after revisiting this and updating ROW2COL scenario, I could not reproduce your issues. If they persist, they are probably related to indexing on your specific board/setup |
SN32_PWM_OUTPUT_ACTIVE_LOW
Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist