Disable bitbangio on Itsy M0

Also, switch CIRCUITPY_BITBANG_APA102 to makefile setting so it can alter included files
crypto-aes
Scott Shawcroft 3 years ago
parent 966a48b23a
commit 0876d5c4ad
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
  1. 2
      ports/atmel-samd/boards/gemma_m0/mpconfigboard.h
  2. 1
      ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.h
  3. 3
      ports/atmel-samd/boards/itsybitsy_m0_express/mpconfigboard.mk
  4. 2
      ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.h
  5. 2
      ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk
  6. 2
      ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.h
  7. 2
      ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk
  8. 2
      ports/atmel-samd/boards/pirkey_m0/mpconfigboard.h
  9. 2
      ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.h
  10. 2
      ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk
  11. 4
      ports/atmel-samd/common-hal/busio/SPI.c
  12. 4
      py/circuitpy_defns.mk
  13. 6
      py/circuitpy_mpconfig.mk
  14. 12
      supervisor/shared/rgb_led_status.c
  15. 2
      supervisor/shared/rgb_led_status.h

@ -6,8 +6,6 @@
#define MICROPY_HW_APA102_MOSI (&pin_PA00)
#define MICROPY_HW_APA102_SCK (&pin_PA01)
// #define CIRCUITPY_BITBANG_APA102
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)

@ -3,7 +3,6 @@
#define MICROPY_HW_LED_STATUS (&pin_PA17)
#define CIRCUITPY_BITBANG_APA102
#define MICROPY_HW_APA102_MOSI (&pin_PA01)
#define MICROPY_HW_APA102_SCK (&pin_PA00)

@ -12,6 +12,9 @@ EXTERNAL_FLASH_DEVICE_COUNT = 2
EXTERNAL_FLASH_DEVICES = "W25Q16FW, GD25Q16C"
LONGINT_IMPL = MPZ
CIRCUITPY_BITBANG_APA102 = 1
CIRCUITPY_BITBANGIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CSLAVE = 0
CIRCUITPY_RTC = 0

@ -9,8 +9,6 @@
#define MICROPY_HW_APA102_MOSI (&pin_PB03)
#define MICROPY_HW_APA102_SCK (&pin_PB02)
#define CIRCUITPY_BITBANG_APA102
// These are pins not to reset.
// QSPI Data pins
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)

@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITBANG_APA102 = 1

@ -9,8 +9,6 @@
#define MICROPY_HW_APA102_MOSI (&pin_PB03)
#define MICROPY_HW_APA102_SCK (&pin_PB02)
#define CIRCUITPY_BITBANG_APA102
// These are pins not to reset.
// QSPI Data pins
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)

@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITBANG_APA102 = 1

@ -4,8 +4,6 @@
#define MICROPY_HW_APA102_MOSI (&pin_PA00)
#define MICROPY_HW_APA102_SCK (&pin_PA01)
// #define CIRCUITPY_BITBANG_APA102
#define MICROPY_PORT_A (PORT_PA00 | PORT_PA01 | PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)

@ -8,8 +8,6 @@
#define MICROPY_HW_APA102_MOSI (&pin_PB03)
#define MICROPY_HW_APA102_SCK (&pin_PB02)
#define CIRCUITPY_BITBANG_APA102
// These are pins not to reset.
// QSPI Data pins
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)

@ -15,3 +15,5 @@ LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1
# No I2S on SAMD51G
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITBANG_APA102 = 1

@ -122,7 +122,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
}
Sercom* potential_sercom = sercom_insts[sercom_index];
if (
#if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !defined(CIRCUITPY_BITBANG_APA102)
#if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !CIRCUITPY_BITBANG_APA102
(potential_sercom->SPI.CTRLA.bit.ENABLE != 0 &&
potential_sercom != status_apa102.spi_desc.dev.prvt &&
!apa102_sck_in_use)) {
@ -181,7 +181,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
// Set up SPI clocks on SERCOM.
samd_peripherals_sercom_clock_init(sercom, sercom_index);
#if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !defined(CIRCUITPY_BITBANG_APA102)
#if defined(MICROPY_HW_APA102_SCK) && defined(MICROPY_HW_APA102_MOSI) && !CIRCUITPY_BITBANG_APA102
// if we're re-using the dotstar sercom, make sure it is disabled or the init will fail out
hri_sercomspi_clear_CTRLA_ENABLE_bit(sercom);
#endif

@ -117,6 +117,10 @@ endif
ifeq ($(CIRCUITPY_BITBANGIO),1)
SRC_PATTERNS += bitbangio/%
endif
# Some builds need bitbang SPI for the dotstar but don't make bitbangio available so include it separately.
ifeq ($(CIRCUITPY_BITBANG_APA102),1)
SRC_PATTERNS += bitbangio/SPI%
endif
ifeq ($(CIRCUITPY_BLEIO),1)
SRC_PATTERNS += bleio/%
endif

@ -278,3 +278,9 @@ ifndef CIRCUITPY_USTACK
CIRCUITPY_USTACK = 0
endif
CFLAGS += -DCIRCUITPY_USTACK=$(CIRCUITPY_USTACK)
ifndef CIRCUITPY_BITBANG_APA102
CIRCUITPY_BITBANG_APA102 = 0
endif
CFLAGS += -DCIRCUITPY_BITBANG_APA102=$(CIRCUITPY_BITBANG_APA102)

@ -40,7 +40,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
#if CIRCUITPY_BITBANG_APA102
#include "shared-bindings/bitbangio/SPI.h"
#include "shared-module/bitbangio/types.h"
static bitbangio_spi_obj_t status_apa102;
@ -81,7 +81,7 @@ void rgb_led_status_init() {
common_hal_digitalio_digitalinout_switch_to_output(&status_neopixel, false, DRIVE_MODE_PUSH_PULL);
#endif
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
#ifdef CIRCUITPY_BITBANG_APA102
#if CIRCUITPY_BITBANG_APA102
shared_module_bitbangio_spi_construct(&status_apa102,
MICROPY_HW_APA102_SCK,
MICROPY_HW_APA102_MOSI,
@ -102,7 +102,7 @@ void rgb_led_status_init() {
// mark them as used.
apa102_mosi_in_use = false;
apa102_sck_in_use = false;
#ifdef CIRCUITPY_BITBANG_APA102
#if CIRCUITPY_BITBANG_APA102
shared_module_bitbangio_spi_try_lock(&status_apa102);
shared_module_bitbangio_spi_configure(&status_apa102, 100000, 0, 1, 8);
#else
@ -185,7 +185,7 @@ void new_status_color(uint32_t rgb) {
status_apa102_color[6] = (rgb_adjusted >> 8) & 0xff;
status_apa102_color[7] = (rgb_adjusted >> 16) & 0xff;
#ifdef CIRCUITPY_BITBANG_APA102
#if CIRCUITPY_BITBANG_APA102
shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, 8);
#else
common_hal_busio_spi_write(&status_apa102, status_apa102_color, 8);
@ -230,7 +230,7 @@ void temp_status_color(uint32_t rgb) {
return;
}
uint8_t colors[12] = {0, 0, 0, 0, 0xff, rgb_adjusted & 0xff, (rgb_adjusted >> 8) & 0xff, (rgb_adjusted >> 16) & 0xff, 0x0, 0x0, 0x0, 0x0};
#ifdef CIRCUITPY_BITBANG_APA102
#if CIRCUITPY_BITBANG_APA102
shared_module_bitbangio_spi_write(&status_apa102, colors, 12);
#else
common_hal_busio_spi_write(&status_apa102, colors, 12);
@ -264,7 +264,7 @@ void clear_temp_status() {
common_hal_neopixel_write(&status_neopixel, status_neopixel_color, 3);
#endif
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
#ifdef CIRCUITPY_BITBANG_APA102
#if CIRCUITPY_BITBANG_APA102
shared_module_bitbangio_spi_write(&status_apa102, status_apa102_color, 8);
#else
common_hal_busio_spi_write(&status_apa102, status_apa102_color, 8);

@ -44,7 +44,7 @@
// To work with a NeoPixel, one must have MICROPY_HW_NEOPIXEL defined and
// neopixel_write implemented.
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) && !defined(CIRCUITPY_BITBANG_APA102)
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK) && !CIRCUITPY_BITBANG_APA102
#include "common-hal/busio/SPI.h"
extern busio_spi_obj_t status_apa102;
#endif

Loading…
Cancel
Save