8000 [rgb status] Also invert the pwm values on clear_temp_status · adafruit/circuitpython@324cbe4 · GitHub
[go: up one dir, main page]

< 8000 div class="position-relative header-wrapper js-header-wrapper "> Skip to content

Commit 324cbe4

Browse files
committed
[rgb status] Also invert the pwm values on clear_temp_status
1 parent fae1039 commit 324cbe4

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

supervisor/shared/rgb_led_status.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,24 @@ void clear_temp_status() {
271271
#endif
272272
#endif
273273
#if defined(CP_RGB_STATUS_LED)
274-
common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_r, status_rgb_color[0]);
275-
common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_g, status_rgb_color[1]);
276-
common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_b, status_rgb_color[2]);
274+
275+
uint16_t red = 0;
276+
uint16_t green = 0;
277+
uint16_t blue = 0;
278+
279+
#if defined(CP_RGB_STATUS_INVERTED_PWM)
280+
red = (1 << 16) - 1 - status_rgb_color[0];
281+
green = (1 << 16) - 1 - status_rgb_color[1];
282+
blue = (1 << 16) - 1 - status_rgb_color[2];
283+
#else
284+
red = status_rgb_color[0];
285+
green = status_rgb_color[1];
286+
blue = status_rgb_color[2];
287+
#endif
288+
289+
common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_r, red);
290+
common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_g, green);
291+
common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_b, blue);
277292
#endif
278293
}
279294

0 commit comments

Comments
 (0)
0