add object types to rgb status objects;mark spi rgb objects as never_reset

This commit is contained in:
Dan Halbert 2019-10-25 22:32:43 -04:00
parent 7d04d9109e
commit ab6fd34828
2 changed files with 27 additions and 6 deletions

View File

@ -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

View File

@ -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.