summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@adafruit.com>2020-06-22 16:16:14 -0400
committerGitHub <noreply@github.com>2020-06-22 16:16:14 -0400
commitf1a497e29335ffaf59ad48d5c5a9327305f5fd49 (patch)
treef96930ff29670f200a1e5ffd7aa85054ecc5bc9c
parent1504d9005d28ded268d2de5eb12d53dbac1bf179 (diff)
parentd43449a6d613c5a6a386231745f6fca91b352b79 (diff)
Merge pull request #3060 from jepler/misc-fixes
-rw-r--r--ports/atmel-samd/Makefile2
-rw-r--r--ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h4
-rw-r--r--ports/atmel-samd/common-hal/_pew/PewPew.c (renamed from shared-module/_pew/PewPew.c)0
-rw-r--r--ports/atmel-samd/common-hal/_pew/PewPew.h (renamed from shared-module/_pew/PewPew.h)0
-rw-r--r--ports/atmel-samd/common-hal/_pew/__init__.c (renamed from shared-module/_pew/__init__.c)0
-rw-r--r--ports/atmel-samd/common-hal/_pew/__init__.h (renamed from shared-module/_pew/__init__.h)0
-rw-r--r--ports/atmel-samd/common-hal/microcontroller/Pin.c4
-rw-r--r--ports/atmel-samd/supervisor/port.c4
-rw-r--r--ports/atmel-samd/timer_handler.c2
-rw-r--r--ports/mimxrt10xx/supervisor/port.c2
-rwxr-xr-xports/stm/Makefile34
-rw-r--r--ports/stm/common-hal/microcontroller/Pin.c17
-rw-r--r--py/circuitpy_defns.mk62
-rw-r--r--shared-bindings/_pew/PewPew.c2
-rw-r--r--shared-bindings/_pew/__init__.c2
-rw-r--r--supervisor/shared/flash.c2
16 files changed, 69 insertions, 68 deletions
diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile
index d0ab65e6b..8eb24e836 100644
--- a/ports/atmel-samd/Makefile
+++ b/ports/atmel-samd/Makefile
@@ -206,7 +206,7 @@ SRC_ASF += \
else ifeq ($(CHIP_FAMILY), samd51)
SRC_ASF += \
- hal/src/hal_rand_sync.c \
+ hal/src/hal_rand_sync.c \
hpl/core/hpl_core_m4.c \
hpl/mclk/hpl_mclk.c \
hpl/osc32kctrl/hpl_osc32kctrl.c \
diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h
index a5dee295b..97a4465a1 100644
--- a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h
+++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/mpconfigboard.h
@@ -18,8 +18,8 @@
#define BOARD_HAS_CRYSTAL 1
-#define DEFAULT_I2C_BUS_SCL (&pin_PA22)
-#define DEFAULT_I2C_BUS_SDA (&pin_PA23)
+#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
+#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
#define DEFAULT_SPI_BUS_SCK (&pin_PB13)
#define DEFAULT_SPI_BUS_MOSI (&pin_PB12)
diff --git a/shared-module/_pew/PewPew.c b/ports/atmel-samd/common-hal/_pew/PewPew.c
index 568dc6425..568dc6425 100644
--- a/shared-module/_pew/PewPew.c
+++ b/ports/atmel-samd/common-hal/_pew/PewPew.c
diff --git a/shared-module/_pew/PewPew.h b/ports/atmel-samd/common-hal/_pew/PewPew.h
index da1cae0a2..da1cae0a2 100644
--- a/shared-module/_pew/PewPew.h
+++ b/ports/atmel-samd/common-hal/_pew/PewPew.h
diff --git a/shared-module/_pew/__init__.c b/ports/atmel-samd/common-hal/_pew/__init__.c
index f3b23c606..f3b23c606 100644
--- a/shared-module/_pew/__init__.c
+++ b/ports/atmel-samd/common-hal/_pew/__init__.c
diff --git a/shared-module/_pew/__init__.h b/ports/atmel-samd/common-hal/_pew/__init__.h
index 4f953c610..4f953c610 100644
--- a/shared-module/_pew/__init__.h
+++ b/ports/atmel-samd/common-hal/_pew/__init__.h
diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c
index cf78673b2..3c214a9f4 100644
--- a/ports/atmel-samd/common-hal/microcontroller/Pin.c
+++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c
@@ -110,12 +110,12 @@ void never_reset_pin_number(uint8_t pin_number) {
}
void reset_pin_number(uint8_t pin_number) {
- never_reset_pins[GPIO_PORT(pin_number)] &= ~(1 << GPIO_PIN(pin_number));
-
if (pin_number >= PORT_BITS) {
return;
}
+ never_reset_pins[GPIO_PORT(pin_number)] &= ~(1 << GPIO_PIN(pin_number));
+
#ifdef MICROPY_HW_NEOPIXEL
if (pin_number == MICROPY_HW_NEOPIXEL->number) {
neopixel_in_use = false;
diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c
index 2b3e9826f..74c984997 100644
--- a/ports/atmel-samd/supervisor/port.c
+++ b/ports/atmel-samd/supervisor/port.c
@@ -85,7 +85,9 @@
#if CIRCUITPY_GAMEPADSHIFT
#include "shared-module/gamepadshift/__init__.h"
#endif
-#include "shared-module/_pew/PewPew.h"
+#if CIRCUITPY_PEW
+#include "common-hal/_pew/PewPew.h"
+#endif
extern volatile bool mp_msc_enabled;
diff --git a/ports/atmel-samd/timer_handler.c b/ports/atmel-samd/timer_handler.c
index 34d819e16..16d65334e 100644
--- a/ports/atmel-samd/timer_handler.c
+++ b/ports/atmel-samd/timer_handler.c
@@ -31,7 +31,7 @@
#include "common-hal/pulseio/PulseIn.h"
#include "common-hal/pulseio/PulseOut.h"
-#include "shared-module/_pew/PewPew.h"
+#include "common-hal/_pew/PewPew.h"
#include "common-hal/frequencyio/FrequencyIn.h"
extern void _PM_IRQ_HANDLER(void);
diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c
index ed5824732..0b53a79f0 100644
--- a/ports/mimxrt10xx/supervisor/port.c
+++ b/ports/mimxrt10xx/supervisor/port.c
@@ -53,7 +53,9 @@
#if CIRCUITPY_GAMEPADSHIFT
#include "shared-module/gamepadshift/__init__.h"
#endif
+#if CIRCUITPY_PEW
#include "shared-module/_pew/PewPew.h"
+#endif
#include "supervisor/shared/tick.h"
#include "clocks.h"
diff --git a/ports/stm/Makefile b/ports/stm/Makefile
index a7b519ffc..08cb36ddf 100755
--- a/ports/stm/Makefile
+++ b/ports/stm/Makefile
@@ -154,43 +154,43 @@ CFLAGS += \
-DCFG_TUD_MIDI_TX_BUFSIZE=128
SRC_STM32 = $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES_LOWER)xx_,\
+ hal.c \
hal_adc.c \
hal_adc_ex.c \
+ hal_cortex.c \
hal_dac.c \
hal_dac_ex.c \
+ hal_dma.c \
+ hal_dma_ex.c \
+ hal_exti.c \
+ hal_flash.c \
+ hal_flash_ex.c \
+ hal_gpio.c \
hal_i2c.c \
hal_i2c_ex.c \
+ hal_pwr.c \
+ hal_pwr_ex.c \
hal_qspi.c \
+ hal_rcc.c \
+ hal_rcc_ex.c \
hal_rng.c \
hal_rtc.c \
hal_rtc_ex.c \
+ hal_sd.c \
hal_spi.c \
hal_tim.c \
hal_tim_ex.c \
hal_uart.c \
hal_usart.c \
- hal_rcc.c \
- hal_rcc_ex.c \
- hal_flash.c \
- hal_flash_ex.c \
- hal_gpio.c \
- hal_dma_ex.c \
- hal_dma.c \
- hal_pwr.c \
- hal_pwr_ex.c \
- hal_cortex.c \
- hal.c \
- hal_exti.c \
- hal_sd.c \
- ll_gpio.c \
ll_adc.c \
- ll_i2c.c \
ll_dma.c \
+ ll_exti.c \
+ ll_gpio.c \
+ ll_i2c.c \
+ ll_rcc.c \
ll_sdmmc.c \
ll_usart.c \
- ll_rcc.c \
ll_utils.c \
- ll_exti.c \
)
# Need this to avoid UART linker problems. TODO: rewrite to use registered callbacks.
diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c
index e966f709f..b0e3c7015 100644
--- a/ports/stm/common-hal/microcontroller/Pin.c
+++ b/ports/stm/common-hal/microcontroller/Pin.c
@@ -37,23 +37,20 @@ bool neopixel_in_use;
#endif
#if defined(TFBGA216)
- #define GPIO_PORT_COUNT 11
- GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH, GPIOI, GPIOJ, GPIOK};
+ GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH, GPIOI, GPIOJ, GPIOK};
#elif defined(LQFP144)
- #define GPIO_PORT_COUNT 7
- GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG};
+ GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE, GPIOF, GPIOG};
#elif defined(LQFP100_f4) || (LQFP100_x7)
- #define GPIO_PORT_COUNT 5
- GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE};
+ GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD, GPIOE};
#elif defined(LQFP64)
- #define GPIO_PORT_COUNT 4
- GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC, GPIOD};
+ GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC, GPIOD};
#elif defined(UFQFPN48)
- #define GPIO_PORT_COUNT 3
- GPIO_TypeDef * ports[GPIO_PORT_COUNT] = {GPIOA, GPIOB, GPIOC};
+ GPIO_TypeDef * ports[] = {GPIOA, GPIOB, GPIOC};
#endif
+#define GPIO_PORT_COUNT (MP_ARRAY_SIZE(ports))
+
STATIC uint16_t claimed_pins[GPIO_PORT_COUNT];
STATIC uint16_t never_reset_pins[GPIO_PORT_COUNT];
diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk
index 67fbde6e4..fb8f46bd8 100644
--- a/py/circuitpy_defns.mk
+++ b/py/circuitpy_defns.mk
@@ -249,7 +249,6 @@ endif
# All possible sources are listed here, and are filtered by SRC_PATTERNS in SRC_COMMON_HAL
SRC_COMMON_HAL_ALL = \
- _bleio/__init__.c \
_bleio/Adapter.c \
_bleio/Attribute.c \
_bleio/Characteristic.c \
@@ -259,16 +258,19 @@ SRC_COMMON_HAL_ALL = \
_bleio/PacketBuffer.c \
_bleio/Service.c \
_bleio/UUID.c \
+ _bleio/__init__.c \
+ _pew/PewPew.c \
+ _pew/__init__.c \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
analogio/__init__.c \
- audiobusio/__init__.c \
audiobusio/I2SOut.c \
audiobusio/PDMIn.c \
- audiopwmio/__init__.c \
- audiopwmio/PWMAudioOut.c \
- audioio/__init__.c \
+ audiobusio/__init__.c \
audioio/AudioOut.c \
+ audioio/__init__.c \
+ audiopwmio/PWMAudioOut.c \
+ audiopwmio/__init__.c \
board/__init__.c \
busio/I2C.c \
busio/SPI.c \
@@ -279,8 +281,8 @@ SRC_COMMON_HAL_ALL = \
digitalio/DigitalInOut.c \
digitalio/__init__.c \
displayio/ParallelBus.c \
- frequencyio/__init__.c \
frequencyio/FrequencyIn.c \
+ frequencyio/__init__.c \
i2cslave/I2CSlave.c \
i2cslave/__init__.c \
microcontroller/Pin.c \
@@ -290,23 +292,23 @@ SRC_COMMON_HAL_ALL = \
nvm/ByteArray.c \
nvm/__init__.c \
os/__init__.c \
- rgbmatrix/RGBMatrix.c \
- rgbmatrix/__init__.c \
+ ps2io/Ps2.c \
+ ps2io/__init__.c \
pulseio/PWMOut.c \
pulseio/PulseIn.c \
pulseio/PulseOut.c \
pulseio/__init__.c \
- ps2io/Ps2.c \
- ps2io/__init__.c \
+ rgbmatrix/RGBMatrix.c \
+ rgbmatrix/__init__.c \
rotaryio/IncrementalEncoder.c \
rotaryio/__init__.c \
rtc/RTC.c \
rtc/__init__.c \
supervisor/Runtime.c \
supervisor/__init__.c \
- watchdog/__init__.c \
watchdog/WatchDogMode.c \
watchdog/WatchDogTimer.c \
+ watchdog/__init__.c \
SRC_COMMON_HAL = $(filter $(SRC_PATTERNS), $(SRC_COMMON_HAL_ALL))
@@ -318,13 +320,13 @@ $(filter $(SRC_PATTERNS), \
_bleio/Address.c \
_bleio/Attribute.c \
_bleio/ScanEntry.c \
+ _eve/__init__.c \
digitalio/Direction.c \
digitalio/DriveMode.c \
digitalio/Pull.c \
fontio/Glyph.c \
- microcontroller/RunMode.c \
math/__init__.c \
- _eve/__init__.c \
+ microcontroller/RunMode.c \
)
SRC_BINDINGS_ENUMS += \
@@ -335,29 +337,30 @@ SRC_SHARED_MODULE_ALL = \
_bleio/Attribute.c \
_bleio/ScanEntry.c \
_bleio/ScanResults.c \
+ _eve/__init__.c \
_pixelbuf/PixelBuf.c \
_pixelbuf/__init__.c \
_stage/Layer.c \
_stage/Text.c \
_stage/__init__.c \
- audiopwmio/__init__.c \
- audioio/__init__.c \
- audiocore/__init__.c \
+ aesio/__init__.c \
+ aesio/aes.c \
audiocore/RawSample.c \
audiocore/WaveFile.c \
- audiomixer/__init__.c \
+ audiocore/__init__.c \
+ audioio/__init__.c \
audiomixer/Mixer.c \
audiomixer/MixerVoice.c \
- audiomp3/__init__.c \
+ audiomixer/__init__.c \
audiomp3/MP3Decoder.c \
+ audiomp3/__init__.c \
+ audiopwmio/__init__.c \
bitbangio/I2C.c \
bitbangio/OneWire.c \
bitbangio/SPI.c \
bitbangio/__init__.c \
board/__init__.c \
busio/OneWire.c \
- aesio/__init__.c \
- aesio/aes.c \
displayio/Bitmap.c \
displayio/ColorConverter.c \
displayio/Display.c \
@@ -370,11 +373,6 @@ SRC_SHARED_MODULE_ALL = \
displayio/Shape.c \
displayio/TileGrid.c \
displayio/__init__.c \
- vectorio/Circle.c \
- vectorio/Rectangle.c \
- vectorio/Polygon.c \
- vectorio/VectorShape.c \
- vectorio/__init__.c \
fontio/BuiltinFont.c \
fontio/__init__.c \
framebufferio/FramebufferDisplay.c \
@@ -383,22 +381,24 @@ SRC_SHARED_MODULE_ALL = \
gamepad/__init__.c \
gamepadshift/GamePadShift.c \
gamepadshift/__init__.c \
+ network/__init__.c \
os/__init__.c \
random/__init__.c \
- socket/__init__.c \
- network/__init__.c \
rgbmatrix/RGBMatrix.c \
rgbmatrix/__init__.c \
+ socket/__init__.c \
storage/__init__.c \
struct/__init__.c \
- time/__init__.c \
terminalio/Terminal.c \
terminalio/__init__.c \
+ time/__init__.c \
uheap/__init__.c \
ustack/__init__.c \
- _pew/__init__.c \
- _pew/PewPew.c \
- _eve/__init__.c
+ vectorio/Circle.c \
+ vectorio/Polygon.c \
+ vectorio/Rectangle.c \
+ vectorio/VectorShape.c \
+ vectorio/__init__.c \
# All possible sources are listed here, and are filtered by SRC_PATTERNS.
SRC_SHARED_MODULE = $(filter $(SRC_PATTERNS), $(SRC_SHARED_MODULE_ALL))
diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c
index 82bf04a61..352ef38f2 100644
--- a/shared-bindings/_pew/PewPew.c
+++ b/shared-bindings/_pew/PewPew.c
@@ -31,7 +31,7 @@
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "shared-bindings/util.h"
#include "PewPew.h"
-#include "shared-module/_pew/PewPew.h"
+#include "common-hal/_pew/PewPew.h"
#include "supervisor/shared/translate.h"
//| class PewPew:
diff --git a/shared-bindings/_pew/__init__.c b/shared-bindings/_pew/__init__.c
index 6e0070d8e..498beaf1c 100644
--- a/shared-bindings/_pew/__init__.c
+++ b/shared-bindings/_pew/__init__.c
@@ -27,7 +27,7 @@
#include "py/runtime.h"
#include "py/mphal.h"
#include "PewPew.h"
-#include "shared-module/_pew/PewPew.h"
+#include "common-hal/_pew/PewPew.h"
STATIC mp_obj_t get_pressed(void) {
pew_obj_t *pew = MP_STATE_VM(pew_singleton);
diff --git a/supervisor/shared/flash.c b/supervisor/shared/flash.c
index 298e7d83e..9f52ddbc4 100644
--- a/supervisor/shared/flash.c
+++ b/supervisor/shared/flash.c
@@ -88,7 +88,7 @@ static void build_partition(uint8_t *buf, int boot, int type, uint32_t start_blo
mp_uint_t flash_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks) {
if (block_num == 0) {
- if (block_num > 1) {
+ if (num_blocks > 1) {
return 1; // error
}
// fake the MBR so we can decide on our own partition table