diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-10-25 22:32:43 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-10-25 22:32:43 -0400 |
| commit | ab6fd34828d0cf33ac10375cb68ea1c71e08c657 (patch) | |
| tree | 3c04458890b5688ed6bf8218b00d91249b4840dd /supervisor | |
| parent | 7d04d9109e689aa0ea18be94d25c5bdcd9646168 (diff) | |
add object types to rgb status objects;mark spi rgb objects as never_reset
Diffstat (limited to 'supervisor')
| -rw-r--r-- | supervisor/shared/rgb_led_status.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c index 0a03094ea..ebb20b4cc 100644 --- a/supervisor/shared/rgb_led_status.c +++ b/supervisor/shared/rgb_led_status.c @@ -46,10 +46,18 @@ static uint8_t status_apa102_color[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, 0, #if CIRCUITPY_BITBANG_APA102 #include "shared-bindings/bitbangio/SPI.h" #include "shared-module/bitbangio/types.h" -static bitbangio_spi_obj_t status_apa102; +static bitbangio_spi_obj_t status_apa102 = { + .base = { + .type = &bitbangio_spi_type, + }, +}; #else #include "shared-bindings/busio/SPI.h" -busio_spi_obj_t status_apa102; +busio_spi_obj_t status_apa102 = { + .base = { + .type = &busio_spi_type, + }, +}; #endif #endif @@ -59,9 +67,21 @@ busio_spi_obj_t status_apa102; #include "shared-bindings/pulseio/PWMOut.h" #include "shared-bindings/microcontroller/Pin.h" -pulseio_pwmout_obj_t rgb_status_r; -pulseio_pwmout_obj_t rgb_status_g; -pulseio_pwmout_obj_t rgb_status_b; +pulseio_pwmout_obj_t rgb_status_r = { + .base = { + .type = &pulseio_pwmout_type, + }, +}; +pulseio_pwmout_obj_t rgb_status_g = { + .base = { + .type = &pulseio_pwmout_type, + }, +}; +pulseio_pwmout_obj_t rgb_status_b = { + .base = { + .type = &pulseio_pwmout_type, + }, +}; uint8_t rgb_status_brightness = 0xFF; @@ -105,6 +125,7 @@ void rgb_led_status_init() { MICROPY_HW_APA102_SCK, MICROPY_HW_APA102_MOSI, mp_const_none); + common_hal_busio_spi_never_reset(&status_apa102); #endif // Pretend we aren't using the pins. bitbangio.SPI will // mark them as used. |
