Merge pull request #3060 from jepler/misc-fixes

This commit is contained in:
Dan Halbert 2020-06-22 16:16:14 -04:00 committed by GitHub
commit f1a497e293
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 69 additions and 68 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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