diff options
| author | sommersoft <sommersoft@gmail.com> | 2018-04-06 01:58:29 +0000 |
|---|---|---|
| committer | sommersoft <sommersoft@gmail.com> | 2018-04-06 01:58:29 +0000 |
| commit | cc644032ea81783de0e1e15b90dac2ce7913011b (patch) | |
| tree | f859d54e7b8830b96cf9965dcb54c2f2daaaa21a /supervisor | |
| parent | d1974e0038f18ed2ffc59f0f198d998070f4c618 (diff) | |
| parent | 6ee573c7c9e4912de8c518df73af81dd8c2fd935 (diff) | |
Merge branch 'super_status' of https://github.com/sommersoft/circuitpython into super_status
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/rgb_led_colors.h | 16 | ||||
| -rw-r--r-- | supervisor/shared/rgb_led_status.c | 12 |
2 files changed, 15 insertions, 13 deletions
diff --git a/supervisor/shared/rgb_led_colors.h b/supervisor/shared/rgb_led_colors.h index 12f5cc3d9..cab702981 100644 --- a/supervisor/shared/rgb_led_colors.h +++ b/supervisor/shared/rgb_led_colors.h @@ -1,12 +1,12 @@ #define BLACK 0x000000 -#define GREEN 0x001000 -#define BLUE 0x000010 -#define CYAN 0x001010 -#define RED 0x100000 -#define ORANGE 0x100800 -#define YELLOW 0x101000 -#define PURPLE 0x100010 -#define WHITE 0x101010 +#define GREEN 0x003000 +#define BLUE 0x000030 +#define CYAN 0x003030 +#define RED 0x300000 +#define ORANGE 0x302000 +#define YELLOW 0x303000 +#define PURPLE 0x300030 +#define WHITE 0x303030 #define BOOT_RUNNING BLUE #define MAIN_RUNNING GREEN diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 4ea090042..5b55c1ba2 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -29,8 +29,8 @@ #include "rgb_led_status.h" #include "pins.h" -uint8_t rgb_status_brightness = 255; #ifdef MICROPY_HW_NEOPIXEL +uint8_t rgb_status_brightness = 63; #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/neopixel_write/__init__.h" static uint8_t status_neopixel_color[3]; @@ -39,7 +39,7 @@ static digitalio_digitalinout_obj_t status_neopixel; #if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) - +uint8_t rgb_status_brightness = 255; static uint8_t status_apa102_color[12] = {0, 0, 0, 0, 0xff, 0, 0, 0}; #ifdef CIRCUITPY_BITBANG_APA102 #include "shared-bindings/bitbangio/SPI.h" @@ -70,11 +70,11 @@ void rgb_led_status_init() { MICROPY_HW_APA102_MOSI, mp_const_none); #else - if (status_apa102.current_baudrate > 0) { + if (!common_hal_busio_spi_deinited(&status_apa102)) { // Don't use spi_deinit because that leads to infinite // recursion because reset_pin may call // rgb_led_status_init. - spi_disable(&status_apa102.spi_master_instance); + spi_m_sync_disable(&status_apa102.spi_desc); } common_hal_busio_spi_construct(&status_apa102, MICROPY_HW_APA102_SCK, @@ -196,7 +196,9 @@ uint32_t color_brightness(uint32_t color, uint8_t brightness) { } void set_rgb_status_brightness(uint8_t level){ - rgb_status_brightness = level; + #if defined(MICROPY_HW_NEOPIXEL) || (defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)) + rgb_status_brightness = level; + #endif } void prep_rgb_status_animation(const pyexec_result_t* result, |
