summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-10-25 22:32:43 -0400
committerDan Halbert <halbert@halwitz.org>2019-10-25 22:32:43 -0400
commitab6fd34828d0cf33ac10375cb68ea1c71e08c657 (patch)
tree3c04458890b5688ed6bf8218b00d91249b4840dd
parent7d04d9109e689aa0ea18be94d25c5bdcd9646168 (diff)
add object types to rgb status objects;mark spi rgb objects as never_reset
-rw-r--r--ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.mk2
-rw-r--r--supervisor/shared/rgb_led_status.c31
2 files changed, 27 insertions, 6 deletions
diff --git a/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.mk b/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.mk
index 11be3121f..d290077e7 100644
--- a/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.mk
+++ b/ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.mk
@@ -21,7 +21,7 @@ endif
NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
-# Don't use up a hardware SPI peripheral for the status DotStar: we only have two or three.
+# Don't use up a hardware SPI peripheral for the status DotStar: we only have one or two.
CIRCUITPY_BITBANG_APA102 = 1
QSPI_FLASH_FILESYSTEM = 1
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.