diff options
| author | C47D <carlos.santiago.diaz@gmail.com> | 2019-07-07 21:15:51 -0500 |
|---|---|---|
| committer | C47D <carlos.santiago.diaz@gmail.com> | 2019-07-07 21:15:51 -0500 |
| commit | 324cbe432753297f8de6c512e2186b5075c050d0 (patch) | |
| tree | 47f727bd61e492ab8abf91056ce941c570537873 /supervisor | |
| parent | fae1039401fe2eef70d21ae2148e8eeeec0560bd (diff) | |
[rgb status] Also invert the pwm values on clear_temp_status
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/rgb_led_status.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 2e1b8260b..7ca92c677 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -271,9 +271,24 @@ void clear_temp_status() { #endif #endif #if defined(CP_RGB_STATUS_LED) - common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_r, status_rgb_color[0]); - common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_g, status_rgb_color[1]); - common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_b, status_rgb_color[2]); + + uint16_t red = 0; + uint16_t green = 0; + uint16_t blue = 0; + + #if defined(CP_RGB_STATUS_INVERTED_PWM) + red = (1 << 16) - 1 - status_rgb_color[0]; + green = (1 << 16) - 1 - status_rgb_color[1]; + blue = (1 << 16) - 1 - status_rgb_color[2]; + #else + red = status_rgb_color[0]; + green = status_rgb_color[1]; + blue = status_rgb_color[2]; + #endif + + common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_r, red); + common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_g, green); + common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_b, blue); #endif } |
