Skip to content

Commit ab6fd34

Browse files
committed
add object types to rgb status objects;mark spi rgb objects as never_reset
1 parent 7d04d91 commit ab6fd34

2 files changed

Lines changed: 27 additions & 6 deletions

File tree

ports/nrf/boards/itsybitsy_nrf52840_express/mpconfigboard.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endif
2121

2222
NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
2323

24-
# Don't use up a hardware SPI peripheral for the status DotStar: we only have two or three.
24+
# Don't use up a hardware SPI peripheral for the status DotStar: we only have one or two.
2525
CIRCUITPY_BITBANG_APA102 = 1
2626

2727
QSPI_FLASH_FILESYSTEM = 1

supervisor/shared/rgb_led_status.c

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,18 @@ static uint8_t status_apa102_color[APA102_BUFFER_LENGTH] = {0, 0, 0, 0, 0xff, 0,
4646
#if CIRCUITPY_BITBANG_APA102
4747
#include "shared-bindings/bitbangio/SPI.h"
4848
#include "shared-module/bitbangio/types.h"
49-
static bitbangio_spi_obj_t status_apa102;
49+
static bitbangio_spi_obj_t status_apa102 = {
50+
.base = {
51+
.type = &bitbangio_spi_type,
52+
},
53+
};
5054
#else
5155
#include "shared-bindings/busio/SPI.h"
52-
busio_spi_obj_t status_apa102;
56+
busio_spi_obj_t status_apa102 = {
57+
.base = {
58+
.type = &busio_spi_type,
59+
},
60+
};
5361
#endif
5462
#endif
5563

@@ -59,9 +67,21 @@ busio_spi_obj_t status_apa102;
5967
#include "shared-bindings/pulseio/PWMOut.h"
6068
#include "shared-bindings/microcontroller/Pin.h"
6169

62-
pulseio_pwmout_obj_t rgb_status_r;
63-
pulseio_pwmout_obj_t rgb_status_g;
64-
pulseio_pwmout_obj_t rgb_status_b;
70+
pulseio_pwmout_obj_t rgb_status_r = {
71+
.base = {
72+
.type = &pulseio_pwmout_type,
73+
},
74+
};
75+
pulseio_pwmout_obj_t rgb_status_g = {
76+
.base = {
77+
.type = &pulseio_pwmout_type,
78+
},
79+
};
80+
pulseio_pwmout_obj_t rgb_status_b = {
81+
.base = {
82+
.type = &pulseio_pwmout_type,
83+
},
84+
};
6585

6686
uint8_t rgb_status_brightness = 0xFF;
6787

@@ -105,6 +125,7 @@ void rgb_led_status_init() {
105125
MICROPY_HW_APA102_SCK,
106126
MICROPY_HW_APA102_MOSI,
107127
mp_const_none);
128+
common_hal_busio_spi_never_reset(&status_apa102);
108129
#endif
109130
// Pretend we aren't using the pins. bitbangio.SPI will
110131
// mark them as used.

0 commit comments

Comments
 (0)