diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-07-06 12:48:16 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-07-06 12:48:16 -0700 |
| commit | 5610e05b8c19c3892dfe9bfced719307a95f365e (patch) | |
| tree | b01e5401dfbd86e341e4cd5b0216879327853f3b /supervisor/shared | |
| parent | 9de46f3edd9bd6a827ba92ef4978143b109e912c (diff) | |
Fix up nrf so that it is initialized properly. Also, do not reset
it's pins.
Diffstat (limited to 'supervisor/shared')
| -rw-r--r-- | supervisor/shared/rgb_led_status.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 2d7bb067e..3146cc686 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -155,9 +155,7 @@ void reset_status_led() { reset_pin_number(MICROPY_HW_APA102_SCK->number); #endif #if defined(CP_RGB_STATUS_LED) - reset_pin_number(CP_RGB_STATUS_R->number); - reset_pin_number(CP_RGB_STATUS_G->number); - reset_pin_number(CP_RGB_STATUS_B->number); + // TODO: Support sharing status LED with user. #endif } @@ -199,9 +197,9 @@ void new_status_color(uint32_t rgb) { uint8_t green_u8 = (rgb_adjusted >> 8) & 0xFF; uint8_t blue_u8 = rgb_adjusted & 0xFF; - status_rgb_color[0] = (uint16_t) (red_u8 << 8) + red_u8; - status_rgb_color[1] = (uint16_t) (green_u8 << 8) + green_u8; - status_rgb_color[2] = (uint16_t) (blue_u8 << 8) + blue_u8; + status_rgb_color[0] = (1<<16) - 1 - ((uint16_t) (red_u8 << 8) + red_u8); + status_rgb_color[1] = (1<<16) - 1 - ((uint16_t) (green_u8 << 8) + green_u8); + status_rgb_color[2] = (1<<16) - 1 - ((uint16_t) (blue_u8 << 8) + blue_u8); 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]); @@ -237,13 +235,14 @@ void temp_status_color(uint32_t rgb) { uint8_t green_u8 = (rgb_adjusted >> 8) & 0xFF; uint8_t blue_u8 = rgb_adjusted & 0xFF; - status_rgb_color[0] = (uint16_t) (red_u8 << 8) + red_u8; - status_rgb_color[1] = (uint16_t) (green_u8 << 8) + green_u8; - status_rgb_color[2] = (uint16_t) (blue_u8 << 8) + blue_u8; + uint16_t temp_status_color_rgb[3]; + temp_status_color_rgb[0] = (uint16_t) (red_u8 << 8) + red_u8; + temp_status_color_rgb[1] = (uint16_t) (green_u8 << 8) + green_u8; + temp_status_color_rgb[2] = (uint16_t) (blue_u8 << 8) + blue_u8; - 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]); + common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_r, temp_status_color_rgb[0]); + common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_g, temp_status_color_rgb[1]); + common_hal_pulseio_pwmout_set_duty_cycle(&rgb_status_b, temp_status_color_rgb[2]); #endif } |
