Merge branch 'main' into display_brightness_pwm
This commit is contained in:
commit
260994d16e
|
@ -289,3 +289,6 @@
|
|||
[submodule "frozen/pew-pewpew-lcd"]
|
||||
path = frozen/pew-pewpew-lcd
|
||||
url = https://github.com/pypewpew/pew-pewpew-lcd.git
|
||||
[submodule "frozen/mixgo_cp_lib"]
|
||||
path = frozen/mixgo_cp_lib
|
||||
url = https://github.com/dahanzimin/circuitpython_lib.git
|
||||
|
|
19
conf.py
19
conf.py
|
@ -33,6 +33,25 @@ from sphinx import addnodes
|
|||
|
||||
tools_describe = str(pathlib.Path(__file__).parent / "tools/describe")
|
||||
|
||||
# Monkeypatch autoapi
|
||||
def _format_args(args_info, include_annotations=True, ignore_self=None):
|
||||
result = []
|
||||
|
||||
for i, (prefix, name, annotation, default) in enumerate(args_info):
|
||||
if i == 0 and ignore_self is not None and name == ignore_self:
|
||||
continue
|
||||
formatted = "{}{}{}{}".format(
|
||||
prefix or "",
|
||||
name or "",
|
||||
": {}".format(annotation) if annotation and include_annotations else "",
|
||||
(" = {}" if annotation else "={}").format(default) if default else "",
|
||||
)
|
||||
result.append(formatted)
|
||||
return ", ".join(result)
|
||||
|
||||
import autoapi.mappers.python.objects as objects
|
||||
objects._format_args = _format_args
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
|
|
@ -79,8 +79,6 @@ as a natural "TODO" list. An example minimal build list is shown below:
|
|||
# any port once their prerequisites in common-hal are complete.
|
||||
# Requires DigitalIO:
|
||||
CIRCUITPY_BITBANGIO = 0
|
||||
# Requires DigitalIO
|
||||
CIRCUITPY_GAMEPADSHIFT = 0
|
||||
# Requires neopixel_write or SPI (dotstar)
|
||||
CIRCUITPY_PIXELBUF = 0
|
||||
# Requires OS
|
||||
|
|
|
@ -45,12 +45,10 @@ shared-bindings/audiomp3/__init__.rst shared-bindings/audiomp3/
|
|||
shared-bindings/audiopwmio/PWMAudioOut.rst shared-bindings/audiopwmio/#audiopwmio.PWMAudioOut
|
||||
shared-bindings/audiopwmio/__init__.rst shared-bindings/audiopwmio/
|
||||
shared-bindings/bitbangio/I2C.rst shared-bindings/bitbangio/#bitbangio.I2C
|
||||
shared-bindings/bitbangio/OneWire.rst shared-bindings/bitbangio/#bitbangio.OneWire
|
||||
shared-bindings/bitbangio/SPI.rst shared-bindings/bitbangio/#bitbangio.SPI
|
||||
shared-bindings/bitbangio/__init__.rst shared-bindings/bitbangio/
|
||||
shared-bindings/board/__init__.rst shared-bindings/board/
|
||||
shared-bindings/busio/I2C.rst shared-bindings/busio/#busio.I2C
|
||||
shared-bindings/busio/OneWire.rst shared-bindings/busio/#busio.OneWire
|
||||
shared-bindings/busio/Parity.rst shared-bindings/busio/#busio.Parity
|
||||
shared-bindings/busio/SPI.rst shared-bindings/busio/#busio.SPI
|
||||
shared-bindings/busio/UART.rst shared-bindings/busio/#busio.UART
|
||||
|
@ -82,10 +80,6 @@ shared-bindings/framebufferio/FramebufferDisplay.rst shared-bindings/framebuffer
|
|||
shared-bindings/framebufferio/__init__.rst shared-bindings/framebufferio/
|
||||
shared-bindings/frequencyio/FrequencyIn.rst shared-bindings/frequencyio/#frequencyio.FrequencyIn
|
||||
shared-bindings/frequencyio/__init__.rst shared-bindings/frequencyio/
|
||||
shared-bindings/gamepad/GamePad.rst shared-bindings/gamepad/#gamepad.GamePad
|
||||
shared-bindings/gamepad/__init__.rst shared-bindings/gamepad/
|
||||
shared-bindings/gamepadshift/GamePadShift.rst shared-bindings/gamepadshift/#gamepadshift.GamePadShift
|
||||
shared-bindings/gamepadshift/__init__.rst shared-bindings/gamepadshift/
|
||||
shared-bindings/gnss/__init__.rst shared-bindings/gnss/
|
||||
shared-bindings/i2cperipheral/__init__.rst shared-bindings/i2cperipheral/
|
||||
shared-bindings/i2csecondary/__init__.rst shared-bindings/i2csecondary/
|
||||
|
@ -101,6 +95,7 @@ shared-bindings/neopixel_write/__init__.rst shared-bindings/neopixel_write/
|
|||
shared-bindings/network/__init__.rst shared-bindings/network/
|
||||
shared-bindings/nvm/ByteArray.rst shared-bindings/nvm/#nvm.ByteArray
|
||||
shared-bindings/nvm/__init__.rst shared-bindings/nvm/
|
||||
shared-bindings/onewireio/OneWire.rst shared-bindings/onewireio/#onewireio.OneWire
|
||||
shared-bindings/os/__init__.rst shared-bindings/os/
|
||||
shared-bindings/protomatter/__init__.rst shared-bindings/protomatter/
|
||||
shared-bindings/ps2io/Ps2.rst shared-bindings/ps2io/#ps2io.Ps2
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f82d3ef195256aa71d274a34ea25f760d7e651d1
|
||||
Subproject commit 54b2fa03d8af80562b77460841e63d47f12eee43
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 8b6cd888b264abaf8f9b1904b09b01313b273bb2
|
909
locale/ID.po
909
locale/ID.po
File diff suppressed because it is too large
Load Diff
|
@ -930,6 +930,10 @@ msgstr ""
|
|||
msgid "Failed to acquire mutex, err 0x%04x"
|
||||
msgstr ""
|
||||
|
||||
#: shared-module/rgbmatrix/RGBMatrix.c
|
||||
msgid "Failed to allocate %q buffer"
|
||||
msgstr ""
|
||||
|
||||
#: ports/espressif/common-hal/wifi/__init__.c
|
||||
msgid "Failed to allocate Wifi memory"
|
||||
msgstr ""
|
||||
|
|
652
locale/cs.po
652
locale/cs.po
File diff suppressed because it is too large
Load Diff
1037
locale/de_DE.po
1037
locale/de_DE.po
File diff suppressed because it is too large
Load Diff
641
locale/el.po
641
locale/el.po
File diff suppressed because it is too large
Load Diff
1015
locale/en_GB.po
1015
locale/en_GB.po
File diff suppressed because it is too large
Load Diff
999
locale/es.po
999
locale/es.po
File diff suppressed because it is too large
Load Diff
807
locale/fil.po
807
locale/fil.po
File diff suppressed because it is too large
Load Diff
1048
locale/fr.po
1048
locale/fr.po
File diff suppressed because it is too large
Load Diff
641
locale/hi.po
641
locale/hi.po
File diff suppressed because it is too large
Load Diff
833
locale/it_IT.po
833
locale/it_IT.po
File diff suppressed because it is too large
Load Diff
908
locale/ja.po
908
locale/ja.po
File diff suppressed because it is too large
Load Diff
678
locale/ko.po
678
locale/ko.po
File diff suppressed because it is too large
Load Diff
947
locale/nl.po
947
locale/nl.po
File diff suppressed because it is too large
Load Diff
875
locale/pl.po
875
locale/pl.po
File diff suppressed because it is too large
Load Diff
1024
locale/pt_BR.po
1024
locale/pt_BR.po
File diff suppressed because it is too large
Load Diff
889
locale/ru.po
889
locale/ru.po
File diff suppressed because it is too large
Load Diff
1020
locale/sv.po
1020
locale/sv.po
File diff suppressed because it is too large
Load Diff
684
locale/tr.po
684
locale/tr.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -124,7 +124,7 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY))
|
|||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb3 -Og -Os
|
||||
# You may want to disable -flto if it interferes with debugging.
|
||||
CFLAGS += -flto -flto-partition=none
|
||||
CFLAGS += -flto -flto-partition=one
|
||||
# You may want to enable these flags to make setting breakpoints easier.
|
||||
# CFLAGS += -fno-inline -fno-ipa-sra
|
||||
ifeq ($(CHIP_FAMILY), samd21)
|
||||
|
@ -147,10 +147,11 @@ else
|
|||
CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT)
|
||||
endif
|
||||
|
||||
CFLAGS += -flto -flto-partition=none
|
||||
CFLAGS += -flto
|
||||
|
||||
ifeq ($(CIRCUITPY_FULL_BUILD),0)
|
||||
CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20
|
||||
CFLAGS += -flto-partition=one
|
||||
endif
|
||||
|
||||
ifdef CFLAGS_BOARD
|
||||
|
@ -167,7 +168,8 @@ CFLAGS += \
|
|||
-mcpu=cortex-m0plus \
|
||||
-msoft-float \
|
||||
-mfloat-abi=soft \
|
||||
-DSAMD21
|
||||
-DSAMD21 \
|
||||
-flto-partition=one
|
||||
endif
|
||||
ifeq ($(CHIP_FAMILY), samd51)
|
||||
CFLAGS += \
|
||||
|
|
|
@ -9,6 +9,3 @@ CHIP_FAMILY = samd21
|
|||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_FULL_BUILD = 0
|
||||
|
||||
# This board has many pins, and we have to remove something else to make room.
|
||||
CIRCUITPY_RAINBOWIO = 0
|
||||
|
|
|
@ -11,4 +11,3 @@ LONGINT_IMPL = NONE
|
|||
CIRCUITPY_FULL_BUILD = 0
|
||||
|
||||
CIRCUITPY_ONEWIREIO = 0
|
||||
CIRCUITPY_RAINBOWIO = 0
|
||||
|
|
|
@ -19,7 +19,7 @@ CIRCUITPY_COUNTIO = 1
|
|||
CIRCUITPY_BUSDEVICE = 1
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_cpx
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
|
|
|
@ -18,7 +18,7 @@ CIRCUITPY_KEYPAD = 0
|
|||
CIRCUITPY_ONEWIREIO = 0
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_cpx
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor
|
||||
|
|
|
@ -24,7 +24,7 @@ CIRCUITPY_BITMAPTOOLS = 0
|
|||
CIRCUITPY_PARALLELDISPLAY = 0
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_cpx
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "hal/include/hal_gpio.h"
|
||||
|
||||
void board_init(void) {
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#define MICROPY_HW_BOARD_NAME "Cytron Maker Zero SAMD21"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_HW_LED_TX &pin_PA27
|
||||
#define MICROPY_HW_LED_RX &pin_PB03
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PB11)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PB10)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA12)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PA11)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PA10)
|
||||
|
||||
// USB is always used internally so skip the pin objects for it.
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
||||
|
||||
// Connected to a crystal
|
||||
#define IGNORE_PIN_PA00 1
|
||||
#define IGNORE_PIN_PA01 1
|
||||
|
||||
// SWD-only
|
||||
#define IGNORE_PIN_PA30 1
|
||||
#define IGNORE_PIN_PA31 1
|
|
@ -0,0 +1,11 @@
|
|||
USB_VID = 0x04D8
|
||||
USB_PID = 0xE799
|
||||
USB_PRODUCT = "Maker Zero SAMD21"
|
||||
USB_MANUFACTURER = "Cytron"
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_FULL_BUILD = 0
|
|
@ -0,0 +1,49 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA17) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_PA13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ATN), MP_ROM_PTR(&pin_PA13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J19A
|
|||
CHIP_FAMILY = samd51
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = GD25Q64C
|
||||
EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
|
|
@ -9,5 +9,3 @@ CHIP_FAMILY = samd21
|
|||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CIRCUITPY_ONEWIREIO = 0
|
||||
|
|
|
@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J19A
|
|||
CHIP_FAMILY = samd51
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = GD25Q64C
|
||||
EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
|
|
@ -10,4 +10,4 @@ QSPI_FLASH_FILESYSTEM = 1
|
|||
EXTERNAL_FLASH_DEVICES = GD25Q16C
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CIRCUITPY_GAMEPADSHIFT = 1
|
||||
CIRCUITPY_KEYPAD = 1
|
||||
|
|
|
@ -12,8 +12,8 @@ LONGINT_IMPL = MPZ
|
|||
|
||||
CIRCUITPY_AESIO = 0
|
||||
CIRCUITPY_FRAMEBUFFERIO = 0
|
||||
CIRCUITPY_GAMEPADSHIFT = 1
|
||||
CIRCUITPY_GIFIO = 0
|
||||
CIRCUITPY_KEYPAD = 1
|
||||
CIRCUITPY_STAGE = 1
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge
|
||||
|
|
|
@ -7,13 +7,13 @@ CHIP_VARIANT = SAMD51J19A
|
|||
CHIP_FAMILY = samd51
|
||||
|
||||
QSPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = GD25Q64C
|
||||
EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CIRCUITPY_AESIO = 0
|
||||
CIRCUITPY_FRAMEBUFFERIO = 0
|
||||
CIRCUITPY_GAMEPADSHIFT = 1
|
||||
CIRCUITPY_GIFIO = 0
|
||||
CIRCUITPY_KEYPAD = 1
|
||||
CIRCUITPY_STAGE = 1
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pygamer
|
||||
|
|
|
@ -12,5 +12,4 @@ CIRCUITPY_FULL_BUILD = 0
|
|||
|
||||
# There are many pin definitions on this board; it doesn't quite fit on very large translations.
|
||||
CIRCUITPY_ONEWIREIO = 0
|
||||
CIRCUITPY_RAINBOWIO = 0
|
||||
CIRCUITPY_USB_MIDI = 0
|
||||
|
|
|
@ -123,8 +123,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
|||
adc_sync_read_channel(&adc, self->channel, ((uint8_t *)&value), 2);
|
||||
|
||||
adc_sync_deinit(&adc);
|
||||
// Shift the value to be 16 bit.
|
||||
return value << 4;
|
||||
// Stretch 12-bit ADC reading to 16-bit range
|
||||
return (value << 4) | (value >> 8);
|
||||
}
|
||||
|
||||
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
|
||||
|
|
|
@ -71,12 +71,16 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
|||
uint8_t rx_pad = 255; // Unset pad
|
||||
uint32_t tx_pinmux = 0;
|
||||
uint8_t tx_pad = 255; // Unset pad
|
||||
uint32_t rts_pinmux = 0;
|
||||
uint32_t cts_pinmux = 0;
|
||||
|
||||
// Set state so the object is deinited to start.
|
||||
self->rx_pin = NO_PIN;
|
||||
self->tx_pin = NO_PIN;
|
||||
self->rts_pin = NO_PIN;
|
||||
self->cts_pin = NO_PIN;
|
||||
|
||||
if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) {
|
||||
if ((rs485_dir != NULL) || (rs485_invert)) {
|
||||
mp_raise_NotImplementedError(translate("RS485"));
|
||||
}
|
||||
|
||||
|
@ -84,6 +88,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
|||
|
||||
bool have_tx = tx != NULL;
|
||||
bool have_rx = rx != NULL;
|
||||
bool have_rts = rts != NULL;
|
||||
bool have_cts = cts != NULL;
|
||||
|
||||
if (!have_tx && !have_rx) {
|
||||
mp_raise_ValueError(translate("tx and rx cannot both be None"));
|
||||
}
|
||||
|
@ -122,6 +129,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
|||
#endif
|
||||
tx_pinmux = PINMUX(tx->number, (i == 0) ? MUX_C : MUX_D);
|
||||
tx_pad = tx->sercom[i].pad;
|
||||
if (have_rts) {
|
||||
rts_pinmux = PINMUX(rts->number, (i == 0) ? MUX_C : MUX_D);
|
||||
}
|
||||
if (rx == NULL) {
|
||||
sercom = potential_sercom;
|
||||
break;
|
||||
|
@ -134,6 +144,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
|||
rx->sercom[j].pad != tx_pad) {
|
||||
rx_pinmux = PINMUX(rx->number, (j == 0) ? MUX_C : MUX_D);
|
||||
rx_pad = rx->sercom[j].pad;
|
||||
if (have_cts) {
|
||||
cts_pinmux = PINMUX(cts->number, (j == 0) ? MUX_C : MUX_D);
|
||||
}
|
||||
sercom = sercom_insts[rx->sercom[j].index];
|
||||
sercom_index = rx->sercom[j].index;
|
||||
break;
|
||||
|
@ -190,24 +203,35 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
|||
// which don't necessarily match what we need. After calling it, set the values
|
||||
// specific to this instantiation of UART.
|
||||
|
||||
// Set pads computed for this SERCOM.
|
||||
// Set pads computed for this SERCOM. Refer to the datasheet for details on pads.
|
||||
// TXPO:
|
||||
// 0x0: TX pad 0; no RTS/CTS
|
||||
// 0x1: TX pad 2; no RTS/CTS
|
||||
// 0x2: TX pad 0; RTS: pad 2, CTS: pad 3 (not used by us right now)
|
||||
// So divide by 2 to map pad to value.
|
||||
// 0x1: reserved
|
||||
// 0x2: TX pad 0; RTS: pad 2, CTS: pad 3
|
||||
// 0x3: TX pad 0; RTS: pad 2; no CTS
|
||||
// RXPO:
|
||||
// 0x0: RX pad 0
|
||||
// 0x1: RX pad 1
|
||||
// 0x2: RX pad 2
|
||||
// 0x3: RX pad 3
|
||||
|
||||
// Default to TXPO with no RTS/CTS
|
||||
uint8_t computed_txpo = 0;
|
||||
// If we have both CTS (with or without RTS), use second pinout
|
||||
if (have_cts) {
|
||||
computed_txpo = 2;
|
||||
}
|
||||
// If we have RTS only, use the third pinout
|
||||
if (have_rts && !have_cts) {
|
||||
computed_txpo = 3;
|
||||
}
|
||||
|
||||
// Doing a group mask and set of the registers saves 60 bytes over setting the bitfields individually.
|
||||
|
||||
sercom->USART.CTRLA.reg &= ~(SERCOM_USART_CTRLA_TXPO_Msk |
|
||||
SERCOM_USART_CTRLA_RXPO_Msk |
|
||||
SERCOM_USART_CTRLA_FORM_Msk);
|
||||
sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(tx_pad / 2) |
|
||||
sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(computed_txpo) |
|
||||
SERCOM_USART_CTRLA_RXPO(rx_pad) |
|
||||
(parity == BUSIO_UART_PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1));
|
||||
|
||||
|
@ -257,6 +281,26 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
|
|||
self->rx_pin = NO_PIN;
|
||||
}
|
||||
|
||||
if (have_rts) {
|
||||
gpio_set_pin_direction(rts->number, GPIO_DIRECTION_OUT);
|
||||
gpio_set_pin_pull_mode(rts->number, GPIO_PULL_OFF);
|
||||
gpio_set_pin_function(rts->number, rts_pinmux);
|
||||
self->rts_pin = rts->number;
|
||||
claim_pin(rts);
|
||||
} else {
|
||||
self->rts_pin = NO_PIN;
|
||||
}
|
||||
|
||||
if (have_cts) {
|
||||
gpio_set_pin_direction(cts->number, GPIO_DIRECTION_IN);
|
||||
gpio_set_pin_pull_mode(cts->number, GPIO_PULL_OFF);
|
||||
gpio_set_pin_function(cts->number, cts_pinmux);
|
||||
self->cts_pin = cts->number;
|
||||
claim_pin(cts);
|
||||
} else {
|
||||
self->cts_pin = NO_PIN;
|
||||
}
|
||||
|
||||
usart_async_enable(usart_desc_p);
|
||||
}
|
||||
|
||||
|
@ -270,6 +314,8 @@ void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) {
|
|||
never_reset_sercom(hw);
|
||||
never_reset_pin_number(self->rx_pin);
|
||||
never_reset_pin_number(self->tx_pin);
|
||||
never_reset_pin_number(self->rts_pin);
|
||||
never_reset_pin_number(self->cts_pin);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -289,8 +335,12 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
|||
usart_async_deinit(usart_desc_p);
|
||||
reset_pin_number(self->rx_pin);
|
||||
reset_pin_number(self->tx_pin);
|
||||
reset_pin_number(self->rts_pin);
|
||||
reset_pin_number(self->cts_pin);
|
||||
self->rx_pin = NO_PIN;
|
||||
self->tx_pin = NO_PIN;
|
||||
self->rts_pin = NO_PIN;
|
||||
self->cts_pin = NO_PIN;
|
||||
}
|
||||
|
||||
// Read characters.
|
||||
|
|
|
@ -38,6 +38,8 @@ typedef struct {
|
|||
struct usart_async_descriptor usart_desc;
|
||||
uint8_t rx_pin;
|
||||
uint8_t tx_pin;
|
||||
int8_t rts_pin;
|
||||
int8_t cts_pin;
|
||||
uint8_t character_bits;
|
||||
bool rx_error;
|
||||
uint32_t baudrate;
|
||||
|
|
|
@ -45,6 +45,7 @@ CIRCUITPY_RE ?= 0
|
|||
CIRCUITPY_SDCARDIO ?= 0
|
||||
CIRCUITPY_SYNTHIO ?= 0
|
||||
CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1
|
||||
CIRCUITPY_TRACEBACK = 0
|
||||
CIRCUITPY_ULAB = 0
|
||||
CIRCUITPY_VECTORIO = 0
|
||||
CIRCUITPY_ZLIB = 0
|
||||
|
|
|
@ -122,9 +122,6 @@
|
|||
|
||||
#include "tusb.h"
|
||||
|
||||
#if CIRCUITPY_GAMEPADSHIFT
|
||||
#include "shared-module/gamepadshift/__init__.h"
|
||||
#endif
|
||||
#if CIRCUITPY_PEW
|
||||
#include "common-hal/_pew/PewPew.h"
|
||||
#endif
|
||||
|
@ -428,9 +425,6 @@ void reset_port(void) {
|
|||
|
||||
reset_gclks();
|
||||
|
||||
#if CIRCUITPY_GAMEPADSHIFT
|
||||
gamepadshift_reset();
|
||||
#endif
|
||||
#if CIRCUITPY_PEW
|
||||
pew_reset();
|
||||
#endif
|
||||
|
|
|
@ -164,11 +164,10 @@ capabilities = {
|
|||
"AnalogOut": ["PA02"],
|
||||
},
|
||||
"audioio": {"AudioOut": ["PA02"]},
|
||||
"bitbangio": {"I2C": ALL_BUT_USB, "OneWire": ALL_BUT_USB, "SPI": ALL_BUT_USB},
|
||||
"bitbangio": {"I2C": ALL_BUT_USB, "SPI": ALL_BUT_USB},
|
||||
"busio": {
|
||||
"I2C - SDA": ["PA00", "PB08", "PA08", "PA12", "PA16", "PA22", "PB02"], # SERCOM pad 0
|
||||
"I2C - SCL": ["PA01", "PB09", "PA09", "PA13", "PA17", "PA23", "PB03"], # SERCOM pad 1
|
||||
"OneWire": ALL_BUT_USB,
|
||||
"SPI - MISO": [
|
||||
"PA00",
|
||||
"PA01",
|
||||
|
@ -299,6 +298,7 @@ capabilities = {
|
|||
], # pad 0 or 2
|
||||
},
|
||||
"digitalio": {"DigitalInOut": ALL_BUT_USB},
|
||||
"onewireio": {"OneWire": ALL_BUT_USB},
|
||||
"pulseio": {
|
||||
"PulseIn": ALL_BUT_USB,
|
||||
"PWMOut": [
|
||||
|
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/busio/SPI.h"
|
||||
#include "shared-bindings/displayio/FourWire.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#include "shared-module/displayio/mipi_constants.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
displayio_fourwire_obj_t board_display_obj;
|
||||
|
||||
#define DELAY 0x80
|
||||
|
||||
// display init sequence according to LilyGO example app
|
||||
uint8_t display_init_sequence[] = {
|
||||
// sw reset
|
||||
0x01, 0 | DELAY, 150,
|
||||
// sleep out
|
||||
0x11, 0 | DELAY, 255,
|
||||
// normal display mode on
|
||||
0x13, 0,
|
||||
// display and color format settings
|
||||
0x36, 1, 0x68,
|
||||
0xB6, 2, 0x0A, 0x82,
|
||||
0x3A, 1 | DELAY, 0x55, 10,
|
||||
// ST7789V frame rate setting
|
||||
0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33,
|
||||
// voltages: VGH / VGL
|
||||
0xB7, 1, 0x35,
|
||||
// ST7789V power setting
|
||||
0xBB, 1, 0x28,
|
||||
0xC0, 1, 0x0C,
|
||||
0xC2, 2, 0x01, 0xFF,
|
||||
0xC3, 1, 0x10,
|
||||
0xC4, 1, 0x20,
|
||||
0xC6, 1, 0x0F,
|
||||
0xD0, 2, 0xA4, 0xA1,
|
||||
// ST7789V gamma setting
|
||||
0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17,
|
||||
0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E,
|
||||
0x21, 0,
|
||||
// display on
|
||||
0x29, 0 | DELAY, 255,
|
||||
};
|
||||
|
||||
|
||||
void board_init(void) {
|
||||
// THIS SHOULD BE HANDLED BY espressif_board_reset_pin_number(), but it is not working.
|
||||
// TEMPORARY FIX UNTIL IT'S DIAGNOSED.
|
||||
common_hal_never_reset_pin(&pin_GPIO21);
|
||||
gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT);
|
||||
gpio_set_level(21, true);
|
||||
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
|
||||
common_hal_displayio_fourwire_construct(
|
||||
bus,
|
||||
spi,
|
||||
&pin_GPIO39, // DC
|
||||
&pin_GPIO7, // CS
|
||||
&pin_GPIO40, // RST
|
||||
40000000, // baudrate
|
||||
0, // polarity
|
||||
0 // phase
|
||||
);
|
||||
displayio_display_obj_t *display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
||||
// workaround as board_init() is called before reset_port() in main.c
|
||||
pwmout_reset();
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
display,
|
||||
bus,
|
||||
240, // width (after rotation)
|
||||
135, // height (after rotation)
|
||||
40, // column start
|
||||
53, // row start
|
||||
0, // rotation
|
||||
16, // color depth
|
||||
false, // grayscale
|
||||
false, // pixels in a byte share a row. Only valid for depths < 8
|
||||
1, // bytes per cell. Only valid for depths < 8
|
||||
false, // reverse_pixels_in_byte. Only valid for depths < 8
|
||||
true, // reverse_pixels_in_word
|
||||
MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
|
||||
MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
|
||||
MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
|
||||
display_init_sequence,
|
||||
sizeof(display_init_sequence),
|
||||
&pin_GPIO45, // backlight pin
|
||||
NO_BRIGHTNESS_COMMAND,
|
||||
1.0f, // brightness (ignored)
|
||||
false, // auto_brightness
|
||||
false, // single_byte_bounds
|
||||
false, // data_as_commands
|
||||
true, // auto_refresh
|
||||
60, // native_frames_per_second
|
||||
true, // backlight_on_high
|
||||
false // SH1107_addressing
|
||||
);
|
||||
|
||||
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
|
||||
// Override the I2C/TFT power pin reset to prevent resetting the display.
|
||||
if (pin_number == 21) {
|
||||
// Turn on TFT and I2C
|
||||
gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT);
|
||||
gpio_set_level(21, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
// TODO: Should we turn off the display when asleep?
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Radomir Dopieralski for Adafruit Industries
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -24,19 +24,22 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Micropython setup
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT_GAMEPADSHIFT_H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT_GAMEPADSHIFT_H
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32-S3 TFT"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||
|
||||
#include "shared-module/gamepadshift/GamePadShift.h"
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO33)
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34)
|
||||
|
||||
extern const mp_obj_type_t gamepadshift_type;
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO41)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO42)
|
||||
|
||||
void common_hal_gamepadshift_gamepadshift_init(gamepadshift_obj_t *gamepadshift,
|
||||
digitalio_digitalinout_obj_t *clock_pin,
|
||||
digitalio_digitalinout_obj_t *data_pin,
|
||||
digitalio_digitalinout_obj_t *latch_pin);
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37)
|
||||
|
||||
void common_hal_gamepadshift_gamepadshift_deinit(gamepadshift_obj_t *gamepadshift);
|
||||
#define DEFAULT_UART_BUS_RX (&pin_GPIO2)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_GPIO1)
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT_GAMEPADSHIFT_H
|
||||
#define DOUBLE_TAP_PIN (&pin_GPIO38)
|
|
@ -0,0 +1,23 @@
|
|||
USB_VID = 0x239A
|
||||
USB_PID = 0x811E
|
||||
|
||||
USB_PRODUCT = "Feather ESP32-S3 TFT"
|
||||
USB_MANUFACTURER = "Adafruit"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
# Make room for build
|
||||
CIRCUITPY_ULAB = 0
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=40m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=4MB
|
||||
|
||||
CIRCUITPY_MODULE=wroom
|
|
@ -0,0 +1,78 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO34) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_I2C_POWER), MP_ROM_PTR(&pin_GPIO21) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO45) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -0,0 +1,47 @@
|
|||
#
|
||||
# Component config
|
||||
#
|
||||
#
|
||||
# ESP32S3-Specific
|
||||
#
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
CONFIG_SPIRAM_MODE_QUAD=y
|
||||
# CONFIG_SPIRAM_MODE_OCT is not set
|
||||
CONFIG_SPIRAM_TYPE_AUTO=y
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||
CONFIG_SPIRAM_SIZE=2097152
|
||||
#
|
||||
# PSRAM Clock and CS IO for ESP32S3
|
||||
#
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
# end of PSRAM Clock and CS IO for ESP32S3
|
||||
|
||||
# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set
|
||||
# CONFIG_SPIRAM_RODATA is not set
|
||||
# CONFIG_SPIRAM_SPEED_120M is not set
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
# CONFIG_SPIRAM_SPEED_40M is not set
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set
|
||||
# CONFIG_SPIRAM_USE_MALLOC is not set
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
# end of SPI RAM config
|
||||
|
||||
# end of ESP32S3-Specific
|
||||
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3"
|
||||
# end of LWIP
|
||||
|
||||
# end of Component config
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -24,34 +24,47 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "shared-module/gamepadshift/__init__.h"
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
#include "lib/oofatfs/ff.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "shared-bindings/gamepadshift/GamePadShift.h"
|
||||
|
||||
void gamepadshift_tick(void) {
|
||||
void *singleton = MP_STATE_VM(gamepad_singleton);
|
||||
if (singleton == NULL || !mp_obj_is_type(MP_OBJ_FROM_PTR(singleton), &gamepadshift_type)) {
|
||||
return;
|
||||
}
|
||||
void board_init(void) {
|
||||
// Debug UART
|
||||
#ifdef DEBUG
|
||||
common_hal_never_reset_pin(&pin_GPIO43);
|
||||
common_hal_never_reset_pin(&pin_GPIO44);
|
||||
#endif /* DEBUG */
|
||||
|
||||
gamepadshift_obj_t *self = MP_OBJ_TO_PTR(singleton);
|
||||
uint8_t current = 0;
|
||||
uint8_t bit = 1;
|
||||
common_hal_digitalio_digitalinout_set_value(self->latch_pin, 1);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
common_hal_digitalio_digitalinout_set_value(self->clock_pin, 0);
|
||||
if (common_hal_digitalio_digitalinout_get_value(self->data_pin)) {
|
||||
current |= bit;
|
||||
mp_import_stat_t stat_b = mp_import_stat("boot.py");
|
||||
if (stat_b != MP_IMPORT_STAT_FILE) {
|
||||
FATFS *fatfs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FIL fs;
|
||||
UINT char_written = 0;
|
||||
const byte buffer[] = "#Serial port upload mode\nimport storage\nstorage.remount(\"/\", False)\nstorage.disable_usb_drive()\n";
|
||||
// Create or modify existing boot.py file
|
||||
f_open(fatfs, &fs, "/boot.py", FA_WRITE | FA_CREATE_ALWAYS);
|
||||
f_write(&fs, buffer, sizeof(buffer) - 1, &char_written);
|
||||
f_close(&fs);
|
||||
// Delete code.Py, use main.py
|
||||
mp_import_stat_t stat_c = mp_import_stat("code.py");
|
||||
if (stat_c == MP_IMPORT_STAT_FILE) {
|
||||
f_unlink(fatfs,"/code.py");
|
||||
}
|
||||
common_hal_digitalio_digitalinout_set_value(self->clock_pin, 1);
|
||||
bit <<= 1;
|
||||
}
|
||||
common_hal_digitalio_digitalinout_set_value(self->latch_pin, 0);
|
||||
self->pressed |= self->last & current;
|
||||
self->last = current;
|
||||
|
||||
}
|
||||
|
||||
void gamepadshift_reset(void) {
|
||||
MP_STATE_VM(gamepad_singleton) = NULL;
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Radomir Dopieralski for Adafruit Industries
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -24,8 +24,9 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Micropython setup
|
||||
|
||||
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT___INIT___H
|
||||
#define MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT___INIT___H
|
||||
#define MICROPY_HW_BOARD_NAME "MixGo CE"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S2"
|
||||
|
||||
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT___INIT___H
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO45)
|
|
@ -0,0 +1,23 @@
|
|||
USB_VID = 0x303A
|
||||
USB_PID = 0x80FD
|
||||
USB_PRODUCT = "MixGo CE"
|
||||
USB_MANUFACTURER = "Espressif"
|
||||
|
||||
IDF_TARGET = esp32s2
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=40m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=4MB
|
||||
|
||||
CIRCUITPY_MODULE=wroom
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib
|
|
@ -0,0 +1,50 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -0,0 +1,6 @@
|
|||
# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
|
||||
# end of LWIP
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
|
||||
void board_init(void) {
|
||||
// Debug UART
|
||||
#ifdef DEBUG
|
||||
common_hal_never_reset_pin(&pin_GPIO43);
|
||||
common_hal_never_reset_pin(&pin_GPIO44);
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Scott Shawcroft for Adafruit Industries
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -24,10 +24,9 @@
|
|||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_GAMEPADSHIFT___INIT___H
|
||||
#define MICROPY_INCLUDED_GAMEPADSHIFT___INIT___H
|
||||
// Micropython setup
|
||||
|
||||
void gamepadshift_tick(void);
|
||||
void gamepadshift_reset(void);
|
||||
#define MICROPY_HW_BOARD_NAME "MixGo CE"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S2"
|
||||
|
||||
#endif // MICROPY_INCLUDED_GAMEPADSHIFT___INIT___H
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO45)
|
|
@ -0,0 +1,23 @@
|
|||
USB_VID = 0x303A
|
||||
USB_PID = 0x80FC
|
||||
USB_PRODUCT = "MixGo CE"
|
||||
USB_MANUFACTURER = "Espressif"
|
||||
|
||||
IDF_TARGET = esp32s2
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=40m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=4MB
|
||||
|
||||
CIRCUITPY_MODULE=wroom
|
||||
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib
|
|
@ -0,0 +1,50 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
|
@ -0,0 +1,6 @@
|
|||
# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
|
||||
# end of LWIP
|
|
@ -398,6 +398,35 @@ mp_obj_t common_hal_wifi_radio_get_ipv4_dns(wifi_radio_obj_t *self) {
|
|||
return common_hal_ipaddress_new_ipv4address(self->dns_info.ip.u_addr.ip4.addr);
|
||||
}
|
||||
|
||||
void common_hal_wifi_radio_set_ipv4_dns(wifi_radio_obj_t *self, mp_obj_t ipv4_dns_addr) {
|
||||
esp_netif_dns_info_t dns_addr;
|
||||
ipaddress_ipaddress_to_esp_idf_ip4(ipv4_dns_addr, &dns_addr.ip.u_addr.ip4);
|
||||
esp_netif_set_dns_info(self->netif, ESP_NETIF_DNS_MAIN, &dns_addr);
|
||||
}
|
||||
|
||||
void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self) {
|
||||
esp_netif_dhcpc_start(self->netif);
|
||||
}
|
||||
|
||||
void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) {
|
||||
esp_netif_dhcpc_stop(self->netif);
|
||||
}
|
||||
|
||||
void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) {
|
||||
common_hal_wifi_radio_stop_dhcp_client(self); // Must stop DHCP to set a manual address
|
||||
|
||||
esp_netif_ip_info_t ip_info;
|
||||
ipaddress_ipaddress_to_esp_idf_ip4(ipv4, &ip_info.ip);
|
||||
ipaddress_ipaddress_to_esp_idf_ip4(netmask, &ip_info.netmask);
|
||||
ipaddress_ipaddress_to_esp_idf_ip4(gateway, &ip_info.gw);
|
||||
|
||||
esp_netif_set_ip_info(self->netif, &ip_info);
|
||||
|
||||
if (ipv4_dns != MP_OBJ_NULL) {
|
||||
common_hal_wifi_radio_set_ipv4_dns(self, ipv4_dns);
|
||||
}
|
||||
}
|
||||
|
||||
mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) {
|
||||
esp_ping_config_t ping_config = ESP_PING_DEFAULT_CONFIG();
|
||||
ipaddress_ipaddress_to_esp_idf(ip_address, &ping_config.target_addr);
|
||||
|
|
|
@ -189,6 +189,16 @@ void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t *esp_ip_addre
|
|||
IP_ADDR4(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]);
|
||||
}
|
||||
|
||||
void ipaddress_ipaddress_to_esp_idf_ip4(mp_obj_t ip_address, esp_ip4_addr_t *esp_ip_address) {
|
||||
if (!mp_obj_is_type(ip_address, &ipaddress_ipv4address_type)) {
|
||||
mp_raise_ValueError(translate("Only IPv4 addresses supported"));
|
||||
}
|
||||
mp_obj_t packed = common_hal_ipaddress_ipv4address_get_packed(ip_address);
|
||||
size_t len;
|
||||
const char *bytes = mp_obj_str_get_data(packed, &len);
|
||||
esp_netif_set_ip4_addr(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]);
|
||||
}
|
||||
|
||||
void common_hal_wifi_gc_collect(void) {
|
||||
common_hal_wifi_radio_gc_collect(&common_hal_wifi_radio_obj);
|
||||
}
|
||||
|
|
|
@ -30,9 +30,11 @@
|
|||
#include "py/obj.h"
|
||||
|
||||
#include "lwip/api.h"
|
||||
#include "components/esp_wifi/include/esp_wifi.h"
|
||||
|
||||
void wifi_reset(void);
|
||||
|
||||
void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t *esp_ip_address);
|
||||
void ipaddress_ipaddress_to_esp_idf_ip4(mp_obj_t ip_address, esp_ip4_addr_t *esp_ip_address);
|
||||
|
||||
#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI___INIT___H
|
||||
|
|
|
@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt")))
|
|||
* IVT Data
|
||||
*************************************/
|
||||
const ivt image_vector_table = {
|
||||
IVT_HEADER, /* IVT Header */
|
||||
0x432000D1, /* Teensy bootloader looks for this value*/
|
||||
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
|
||||
IVT_RSVD, /* Reserved = 0 */
|
||||
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
|
||||
|
@ -25,13 +25,15 @@ const ivt image_vector_table = {
|
|||
IVT_RSVD /* Reserved = 0 */
|
||||
};
|
||||
|
||||
extern unsigned long _flashimagelen;
|
||||
|
||||
__attribute__((section(".boot_hdr.boot_data")))
|
||||
/*************************************
|
||||
* Boot Data
|
||||
*************************************/
|
||||
const BOOT_DATA_T boot_data = {
|
||||
FLASH_BASE, /* boot start location */
|
||||
FLASH_SIZE, /* size */
|
||||
(uint32_t)&_flashimagelen, /* actual size of image */
|
||||
PLUGIN_FLAG, /* Plugin flag*/
|
||||
0xFFFFFFFF /* empty - extra data word */
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt")))
|
|||
* IVT Data
|
||||
*************************************/
|
||||
const ivt image_vector_table = {
|
||||
IVT_HEADER, /* IVT Header */
|
||||
0x432000D1, /* Teensy bootloader looks for this value*/
|
||||
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
|
||||
IVT_RSVD, /* Reserved = 0 */
|
||||
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
|
||||
|
@ -25,13 +25,15 @@ const ivt image_vector_table = {
|
|||
IVT_RSVD /* Reserved = 0 */
|
||||
};
|
||||
|
||||
extern unsigned long _flashimagelen;
|
||||
|
||||
__attribute__((section(".boot_hdr.boot_data")))
|
||||
/*************************************
|
||||
* Boot Data
|
||||
*************************************/
|
||||
const BOOT_DATA_T boot_data = {
|
||||
FLASH_BASE, /* boot start location */
|
||||
FLASH_SIZE, /* size */
|
||||
(uint32_t)&_flashimagelen, /* actual size of image */
|
||||
PLUGIN_FLAG, /* Plugin flag*/
|
||||
0xFFFFFFFF /* empty - extra data word */
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt")))
|
|||
* IVT Data
|
||||
*************************************/
|
||||
const ivt image_vector_table = {
|
||||
IVT_HEADER, /* IVT Header */
|
||||
0x432000D1, /* Teensy bootloader looks for this value*/
|
||||
IMAGE_ENTRY_ADDRESS, /* Image Entry Function */
|
||||
IVT_RSVD, /* Reserved = 0 */
|
||||
(uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */
|
||||
|
@ -25,13 +25,15 @@ const ivt image_vector_table = {
|
|||
IVT_RSVD /* Reserved = 0 */
|
||||
};
|
||||
|
||||
extern unsigned long _flashimagelen;
|
||||
|
||||
__attribute__((section(".boot_hdr.boot_data")))
|
||||
/*************************************
|
||||
* Boot Data
|
||||
*************************************/
|
||||
const BOOT_DATA_T boot_data = {
|
||||
FLASH_BASE, /* boot start location */
|
||||
FLASH_SIZE, /* size */
|
||||
(uint32_t)&_flashimagelen, /* actual size of image */
|
||||
PLUGIN_FLAG, /* Plugin flag*/
|
||||
0xFFFFFFFF /* empty - extra data word */
|
||||
};
|
||||
|
|
|
@ -81,8 +81,10 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
|||
|
||||
}
|
||||
|
||||
// Shift the value to be 16 bit
|
||||
return ADC_GetChannelConversionValue(self->pin->adc, ADC_CHANNEL_GROUP) << 4;
|
||||
uint16_t value = ADC_GetChannelConversionValue(self->pin->adc, ADC_CHANNEL_GROUP);
|
||||
|
||||
// Stretch 12-bit ADC reading to 16-bit range
|
||||
return (value << 4) | (value >> 8);
|
||||
}
|
||||
|
||||
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
|
||||
|
|
|
@ -74,7 +74,6 @@ SECTIONS
|
|||
_etext = .; /* define a global symbol at end of code */
|
||||
__etext = .; /* define a global symbol at end of code */
|
||||
} > FLASH_FIRMWARE
|
||||
|
||||
_ld_filesystem_start = ORIGIN(FLASH_FATFS);
|
||||
_ld_filesystem_end = _ld_filesystem_start + LENGTH(FLASH_FATFS);
|
||||
|
||||
|
@ -127,6 +126,8 @@ SECTIONS
|
|||
_ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data);
|
||||
_ld_dtcm_data_size = SIZEOF(.dtcm_data);
|
||||
|
||||
_flashimagelen = _ld_dtcm_data_flash_copy + _ld_dtcm_data_size - flash_config_location;
|
||||
|
||||
.dtcm_bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
|
|
|
@ -46,9 +46,6 @@
|
|||
|
||||
#include "supervisor/background_callback.h"
|
||||
|
||||
#if CIRCUITPY_GAMEPADSHIFT
|
||||
#include "shared-module/gamepadshift/__init__.h"
|
||||
#endif
|
||||
#if CIRCUITPY_PEW
|
||||
#include "shared-module/_pew/PewPew.h"
|
||||
#endif
|
||||
|
@ -294,9 +291,6 @@ void reset_port(void) {
|
|||
rtc_reset();
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_GAMEPADSHIFT
|
||||
gamepadshift_reset();
|
||||
#endif
|
||||
#if CIRCUITPY_PEW
|
||||
pew_reset();
|
||||
#endif
|
||||
|
|
|
@ -84,6 +84,14 @@ INC += -I../../lib/mp-readline
|
|||
INC += -I../../lib/tinyusb/src
|
||||
INC += -I../../supervisor/shared/usb
|
||||
|
||||
ifeq ($(MCU_CHIP),nrf52833)
|
||||
OPTIMIZATION_FLAGS ?= -Os -flto -flto-partition=one
|
||||
else
|
||||
ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
|
||||
OPTIMIZATION_FLAGS ?= -Os -flto
|
||||
endif
|
||||
endif
|
||||
|
||||
#Debugging/Optimization
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb3
|
||||
|
@ -91,7 +99,6 @@ ifeq ($(DEBUG), 1)
|
|||
else
|
||||
OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions
|
||||
CFLAGS += -DNDEBUG -ggdb3
|
||||
CFLAGS += -flto -flto-partition=none
|
||||
endif
|
||||
|
||||
ifeq ($(NRF_DEBUG_PRINT), 1)
|
||||
|
|
|
@ -45,9 +45,3 @@ CIRCUITPY_VECTORIO = 0
|
|||
CIRCUITPY_ZLIB = 0
|
||||
|
||||
MICROPY_PY_ASYNC_AWAIT = 0
|
||||
|
||||
SUPEROPT_GC = 0
|
||||
SUPEROPT_VM = 0
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
|
|
|
@ -28,8 +28,3 @@ CIRCUITPY_ULAB = 0
|
|||
CIRCUITPY_USB = 0
|
||||
|
||||
MICROPY_PY_ASYNC_AWAIT = 0
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
SUPEROPT_VM = 0
|
||||
SUPEROPT_GC = 0
|
||||
|
|
|
@ -35,9 +35,3 @@ CIRCUITPY_VECTORIO = 0
|
|||
CIRCUITPY_ZLIB = 0
|
||||
|
||||
MICROPY_PY_ASYNC_AWAIT = 0
|
||||
|
||||
SUPEROPT_GC = 0
|
||||
SUPEROPT_VM = 0
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
|
|
|
@ -46,8 +46,3 @@ CIRCUITPY_ZLIB = 0
|
|||
|
||||
# Enable micropython.native
|
||||
#CIRCUITPY_ENABLE_MPY_NATIVE = 1
|
||||
|
||||
# Override optimization to keep binary small
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
SUPEROPT_VM = 0
|
||||
SUPEROPT_GC = 0
|
||||
|
|
|
@ -125,8 +125,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
|||
value = 0;
|
||||
}
|
||||
|
||||
// Map value to from 14 to 16 bits
|
||||
return value << 2;
|
||||
// Stretch 14-bit ADC reading to 16-bit range
|
||||
return (value << 2) | (value >> 12);
|
||||
}
|
||||
|
||||
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
|
||||
|
|
|
@ -77,6 +77,10 @@ MCU_SERIES = m4
|
|||
MCU_VARIANT = nrf52
|
||||
MCU_SUB_VARIANT = nrf52833
|
||||
|
||||
# Need the space
|
||||
SUPEROPT_GC ?= 0
|
||||
SUPEROPT_VM ?= 0
|
||||
|
||||
SD ?= s140
|
||||
SOFTDEV_VERSION ?= 7.0.1
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
from board import *
|
||||
import busio
|
||||
|
||||
|
||||
_SPI = None
|
||||
_UART = None
|
||||
_I2C = None
|
||||
|
||||
|
||||
D0 = GP0
|
||||
SDA = D0
|
||||
D1 = GP1
|
||||
SCL = D1
|
||||
D8 = GP8
|
||||
CIPO = D8
|
||||
MISO = D8
|
||||
D9 = GP9
|
||||
CS = D9
|
||||
D10 = GP10
|
||||
SCK = D10
|
||||
D11 = GP11
|
||||
COPI = D11
|
||||
MOSI = D11
|
||||
D14 = GP14
|
||||
D15 = GP15
|
||||
D16 = GP16
|
||||
TX = D16
|
||||
D17 = GP17
|
||||
RX = D17
|
||||
D26 = GP26
|
||||
A0 = D26
|
||||
D27 = GP27
|
||||
A1 = D27
|
||||
D28 = GP28
|
||||
A2 = D28
|
||||
D29 = GP29
|
||||
A3 = D29
|
||||
D24 = GP24
|
||||
NEOPIXEL = D24
|
||||
D25 = GP25
|
||||
LED = D25
|
||||
|
||||
|
||||
def SPI():
|
||||
global _SPI
|
||||
|
||||
if not _SPI:
|
||||
_SPI = busio.SPI(SCK, COPI, CIPO)
|
||||
|
||||
return _SPI
|
||||
|
||||
|
||||
def UART():
|
||||
global _UART
|
||||
|
||||
if not _UART:
|
||||
_UART = busio.UART(TX, RX)
|
||||
|
||||
return _UART
|
||||
|
||||
|
||||
def I2C():
|
||||
global _I2C
|
||||
|
||||
if not _I2C:
|
||||
_I2C = busio.I2C(SCL, SDA)
|
||||
|
||||
return _I2C
|
|
@ -65,8 +65,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
|||
adc_select_input(self->pin->number - ADC_FIRST_PIN_NUMBER);
|
||||
uint16_t value = adc_read();
|
||||
|
||||
// Map value to from 12 to 16 bits
|
||||
return value << 4;
|
||||
// Stretch 12-bit ADC reading to 16-bit range
|
||||
return (value << 4) | (value >> 8);
|
||||
}
|
||||
|
||||
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2062372d203b372849d573f252cf7c6dc2800c0a
|
||||
Subproject commit 426e46126b5a1efaea4544cdb71ab81b61983034
|
|
@ -302,11 +302,11 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf
|
|||
|
||||
$(BUILD)/firmware.uf2: $(BUILD)/firmware.hex
|
||||
$(ECHO) "Create $@"
|
||||
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0x57755a57 -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^
|
||||
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^
|
||||
|
||||
flash: $(BUILD)/firmware.bin
|
||||
$(ECHO) "Writing $< to the board"
|
||||
dfu-util -a 0 --dfuse-address 0x08000000 -D $(BUILD)/firmware.bin
|
||||
dfu-util -a 0 --dfuse-address $(BOOTLOADER_OFFSET) -D $(BUILD)/firmware.bin
|
||||
|
||||
include $(TOP)/py/mkrules.mk
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ MEMORY
|
|||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* entire flash */
|
||||
FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 4K /* ISR vector. Kind of wasteful. */
|
||||
FLASH_FIRMWARE (rx) : ORIGIN = 0x08011000, LENGTH = 1024K-128K-64K-4K /* For now, limit to 1MB so that bank switching is still possible. */
|
||||
FLASH_FS (rw) : ORIGIN = 0x080e0000, LENGTH = 128K
|
||||
FLASH_FS (rw) : ORIGIN = 0x08100000, LENGTH = 1024K
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ MEMORY
|
|||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* entire flash */
|
||||
FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 4K /* ISR vector. Kind of wasteful. */
|
||||
FLASH_FIRMWARE (rx) : ORIGIN = 0x08001000, LENGTH = 1024K-128K-4K /* For now, limit to 1MB so that bank switching is still possible. */
|
||||
FLASH_FS (rw) : ORIGIN = 0x080e0000, LENGTH = 128K
|
||||
FLASH_FS (rw) : ORIGIN = 0x08100000, LENGTH = 1024K
|
||||
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
|
||||
}
|
||||
|
||||
|
|
|
@ -33,14 +33,19 @@
|
|||
void initialize_discharge_pin(void) {
|
||||
/* Initialize the 3V3 discharge to be OFF and the output power to be ON */
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD;
|
||||
/* Set the DISCHARGE pin and the USB_DETECT pin to FLOAT */
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_6, GPIO_PIN_SET);
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); /* PE6 DISCHRG */
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /* PC6 is USB_DETECT */
|
||||
|
||||
/* Turn on the 3V3 regulator */
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_4;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_4, GPIO_PIN_SET);
|
||||
|
@ -53,6 +58,19 @@ void board_init(void) {
|
|||
// Set tick interrupt priority, default HAL value is intentionally invalid
|
||||
// Without this, USB does not function.
|
||||
HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL);
|
||||
|
||||
initialize_discharge_pin();
|
||||
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||
HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_SET);
|
||||
HAL_Delay(50);
|
||||
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
|
@ -60,7 +78,6 @@ bool board_requests_safe_mode(void) {
|
|||
}
|
||||
|
||||
void reset_board(void) {
|
||||
initialize_discharge_pin();
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
|
|
|
@ -14,6 +14,7 @@ LD_DEFAULT = boards/STM32L4R5_default.ld
|
|||
# UF2 boot option
|
||||
LD_BOOT = boards/STM32L4R5_boot.ld
|
||||
UF2_OFFSET = 0x8010000
|
||||
UF2_BOOTLOADER ?= 1
|
||||
|
||||
# Turn all of the below off while trying to get the thing to run
|
||||
# These modules are implemented in ports/<port>/common-hal:
|
||||
|
@ -49,8 +50,6 @@ CIRCUITPY_DISPLAYIO = 0
|
|||
# any port once their prerequisites in common-hal are complete.
|
||||
# Requires DigitalIO:
|
||||
CIRCUITPY_BITBANGIO = 1
|
||||
# Requires DigitalIO
|
||||
CIRCUITPY_GAMEPADSHIFT = 1
|
||||
# Requires neopixel_write or SPI (dotstar)
|
||||
CIRCUITPY_PIXELBUF = 0
|
||||
# Requires OS
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
#include "py/objtuple.h"
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
// Core Feather Pins
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
// extended pins
|
||||
STATIC const mp_rom_map_elem_t board_module_carrier_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PD09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PD08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PF15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PE13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PE03) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), MP_ROM_PTR(&pin_PE04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), MP_ROM_PTR(&pin_PE06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DISABLE_DISCHARGING), MP_ROM_TRUE },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENABLE_DISCHARGING), MP_ROM_FALSE },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PD01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_PD00) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_PG12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_PTR(&pin_PB04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX0), MP_ROM_PTR(&pin_PG08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX0), MP_ROM_PTR(&pin_PG07) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) },
|
||||
|
@ -16,34 +25,107 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PC01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PC02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PE01) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL3), MP_ROM_PTR(&pin_PC00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA3), MP_ROM_PTR(&pin_PC09) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PD06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RTS2), MP_ROM_PTR(&pin_PD04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CTS2), MP_ROM_PTR(&pin_PD03) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX3), MP_ROM_PTR(&pin_PB10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX3), MP_ROM_PTR(&pin_PB11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RTS3), MP_ROM_PTR(&pin_PD02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_CTS3), MP_ROM_PTR(&pin_PB13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_PF01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_PF00) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_QEN), MP_ROM_PTR(&pin_PD05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_QCS), MP_ROM_PTR(&pin_PC11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_QCLK), MP_ROM_PTR(&pin_PE10) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_EN), MP_ROM_PTR(&pin_PE04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PF12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PF13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_QIO3), MP_ROM_PTR(&pin_PE15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_QIO2), MP_ROM_PTR(&pin_PE14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_QIO1), MP_ROM_PTR(&pin_PB00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_QIO0), MP_ROM_PTR(&pin_PE12) },
|
||||
|
||||
};
|
||||
|
||||
MP_DEFINE_CONST_DICT(board_module_carrier, board_module_carrier_table);
|
||||
|
||||
const mp_obj_type_t carrier_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Ext,
|
||||
.locals_dict = (mp_obj_dict_t *)&board_module_carrier,
|
||||
};
|
||||
|
||||
|
||||
// Core Feather Pins
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_ext), MP_ROM_PTR(&carrier_type) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), MP_ROM_PTR(&pin_PE04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), MP_ROM_PTR(&pin_PE06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_DISABLE_DISCHARGING), MP_ROM_TRUE },
|
||||
{ MP_ROM_QSTR(MP_QSTR_ENABLE_DISCHARGING), MP_ROM_FALSE },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA03) }, // PWM, ADC
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) }, // PWM, ADC
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PC03) }, // ADC
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PC01) }, // ADC
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC04) }, // ADC
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC05) }, // ADC
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BUTTON_USR), MP_ROM_PTR(&pin_PC13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_PE04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PB02) }, // boot button, but looks like it's wired to GND on the schematic
|
||||
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PB02) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA04) }, // DAC1 output also
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) }, // PWM
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) }, // PWM
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) }, // PWM
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA04) }, // ADC, DAC1 output also
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) }, // ADC, PWM
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) }, // ADC, PWM
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PE02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) }, // DAC1 output also
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) }, // ADC, PWM, DAC2 output also
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, // PWM
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, // PWM
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA04) }, // D10
|
||||
{ MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_PA05) }, // D13
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PD00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PD01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) }, // PWM?
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB15) }, // PWM?
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA09) }, // ADC, PWM
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA10) }, // PWM
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
|
|
|
@ -204,8 +204,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) {
|
|||
uint16_t value = (uint16_t)HAL_ADC_GetValue(&AdcHandle);
|
||||
HAL_ADC_Stop(&AdcHandle);
|
||||
|
||||
// // Shift the value to be 16 bit.
|
||||
return value << 4;
|
||||
// Stretch 12-bit ADC reading to 16-bit range
|
||||
return (value << 4) | (value >> 8);
|
||||
}
|
||||
|
||||
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
|
||||
|
|
|
@ -206,6 +206,10 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
|||
spi_clock_enable(1 << (self->sck->periph_index - 1));
|
||||
reserved_spi[self->sck->periph_index - 1] = true;
|
||||
|
||||
// Always start at 250khz which is what SD cards need. They are sensitive to
|
||||
// SPI bus noise before they are put into SPI mode.
|
||||
const uint32_t default_baudrate = 250000UL;
|
||||
|
||||
self->handle.Instance = SPIx;
|
||||
self->handle.Init.Mode = SPI_MODE_MASTER;
|
||||
// Direction change only required for RX-only, see RefMan RM0090:884
|
||||
|
@ -218,7 +222,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
|||
self->handle.Init.CLKPolarity = SPI_POLARITY_LOW;
|
||||
self->handle.Init.CLKPhase = SPI_PHASE_1EDGE;
|
||||
self->handle.Init.NSS = SPI_NSS_SOFT;
|
||||
self->handle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256;
|
||||
self->handle.Init.BaudRatePrescaler = stm32_baud_to_spi_div(default_baudrate, &self->prescaler, get_busclock(self->handle.Instance));
|
||||
self->handle.Init.FirstBit = SPI_FIRSTBIT_MSB;
|
||||
self->handle.Init.TIMode = SPI_TIMODE_DISABLE;
|
||||
self->handle.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
|
||||
|
@ -226,8 +230,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
|
|||
if (HAL_SPI_Init(&self->handle) != HAL_OK) {
|
||||
mp_raise_ValueError(translate("SPI init error"));
|
||||
}
|
||||
self->baudrate = (get_busclock(SPIx) / 16);
|
||||
self->prescaler = 16;
|
||||
self->baudrate = default_baudrate;
|
||||
// self->prescaler = 16; // Initialised above by stm32_baud_to_spi_div
|
||||
self->half_duplex = half_duplex;
|
||||
self->polarity = 0;
|
||||
self->phase = 0;
|
||||
|
@ -381,7 +385,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self,
|
|||
|
||||
uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t *self) {
|
||||
// returns actual frequency
|
||||
uint32_t result = HAL_RCC_GetPCLK2Freq() / self->prescaler;
|
||||
uint32_t result = get_busclock(self->handle.Instance) / self->prescaler;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F405xx STM32F407xx))
|
|||
CIRCUITPY_SDIOIO ?= 1
|
||||
# Number of USB endpoint pairs.
|
||||
USB_NUM_ENDPOINT_PAIRS = 4
|
||||
UF2_FAMILY_ID ?= 0x6d0922fa
|
||||
endif
|
||||
|
||||
ifeq ($(MCU_SERIES),F4)
|
||||
|
@ -25,6 +26,7 @@ ifeq ($(MCU_SERIES),F4)
|
|||
CIRCUITPY_ROTARYIO ?= 0
|
||||
CIRCUITPY_RTC ?= 0
|
||||
USB_NUM_ENDPOINT_PAIRS = 4
|
||||
UF2_FAMILY_ID ?= 0x57755a57
|
||||
endif
|
||||
|
||||
ifeq ($(MCU_SERIES),H7)
|
||||
|
@ -43,6 +45,7 @@ ifeq ($(MCU_SERIES),H7)
|
|||
CIRCUITPY_RTC ?= 0
|
||||
|
||||
USB_NUM_ENDPOINT_PAIRS = 9
|
||||
UF2_FAMILY_ID ?= 0x6db66082
|
||||
endif
|
||||
|
||||
ifeq ($(MCU_SERIES),F7)
|
||||
|
@ -59,6 +62,7 @@ ifeq ($(MCU_SERIES),F7)
|
|||
CIRCUITPY_RTC ?= 0
|
||||
|
||||
USB_NUM_ENDPOINT_PAIRS = 6
|
||||
UF2_FAMILY_ID ?= 0x53b80f00
|
||||
endif
|
||||
|
||||
ifeq ($(MCU_SERIES),L4)
|
||||
|
@ -77,6 +81,7 @@ ifeq ($(MCU_SERIES),L4)
|
|||
# This slide deck https://www.st.com/content/ccc/resource/training/technical/product_training/98/89/c8/6c/3e/e9/49/79/STM32L4_Peripheral_USB.pdf/files/STM32L4_Peripheral_USB.pdf/jcr:content/translations/en.STM32L4_Peripheral_USB.pdf
|
||||
# cites 16 endpoints, 8 endpoint pairs, while section 3.39 of the L4R5 datasheet states 6 endpoint pairs.
|
||||
USB_NUM_ENDPOINT_PAIRS = 6
|
||||
UF2_FAMILY_ID ?= 0x00ff6919
|
||||
endif
|
||||
|
||||
CIRCUITPY_PARALLELDISPLAY := 0
|
||||
|
|
|
@ -95,12 +95,8 @@ STATIC const flash_layout_t flash_layout[] = {
|
|||
STATIC uint8_t _flash_cache[0x20000] __attribute__((aligned(4)));
|
||||
|
||||
#elif defined(STM32L4)
|
||||
// todo - the L4 devices can have different flash sizes and different page sizes
|
||||
// depending upon the dual bank configuration
|
||||
// This is hardcoded for the Swan R5. When support for other devices is needed more conditionals will be required
|
||||
// to differentiate.
|
||||
STATIC const flash_layout_t flash_layout[] = {
|
||||
{ 0x08000000, 0x1000, 256 },
|
||||
{ 0x08100000, 0x1000, 256 },
|
||||
};
|
||||
STATIC uint8_t _flash_cache[0x1000] __attribute__((aligned(4)));
|
||||
|
||||
|
@ -174,6 +170,9 @@ uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *si
|
|||
}
|
||||
|
||||
void supervisor_flash_init(void) {
|
||||
#ifdef STM32L4
|
||||
// todo - check that the device is in dual bank mode
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t supervisor_flash_get_block_size(void) {
|
||||
|
@ -202,7 +201,7 @@ void port_internal_flash_flush(void) {
|
|||
FLASH_EraseInitTypeDef EraseInitStruct = {};
|
||||
#if CPY_STM32L4
|
||||
EraseInitStruct.TypeErase = TYPEERASE_PAGES;
|
||||
EraseInitStruct.Banks = FLASH_BANK_1;
|
||||
EraseInitStruct.Banks = FLASH_BANK_2; // filesystem stored in upper 1MB of flash in dual bank mode
|
||||
#else
|
||||
EraseInitStruct.TypeErase = TYPEERASE_SECTORS;
|
||||
EraseInitStruct.VoltageRange = VOLTAGE_RANGE_3; // voltage range needs to be 2.7V to 3.6V
|
||||
|
|
|
@ -97,9 +97,9 @@
|
|||
#endif
|
||||
|
||||
#ifdef STM32L4R5xx
|
||||
#define STM32_FLASH_SIZE 0x100000 // 1MB // for now just use the first bank
|
||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x20000 // 128KiB
|
||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x080e0000
|
||||
#define STM32_FLASH_SIZE 0x200000 // 2MB
|
||||
#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x100000 // 1024KiB
|
||||
#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08100000
|
||||
#endif
|
||||
|
||||
#define INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS (INTERNAL_FLASH_FILESYSTEM_SIZE / FILESYSTEM_BLOCK_SIZE)
|
||||
|
|
|
@ -455,6 +455,10 @@ STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name,
|
|||
// not a package. This will be caught on the next iteration
|
||||
// because the file will not exist.
|
||||
}
|
||||
|
||||
// Loading a module thrashes the heap significantly so we explicitly clean up
|
||||
// afterwards.
|
||||
gc_collect();
|
||||
}
|
||||
|
||||
if (outer_module_obj != MP_OBJ_NULL && VERIFY_PTR(MP_OBJ_TO_PTR(outer_module_obj))) {
|
||||
|
|
|
@ -158,6 +158,9 @@ endif
|
|||
ifeq ($(CIRCUITPY_DISPLAYIO),1)
|
||||
SRC_PATTERNS += displayio/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_DOTENV),1)
|
||||
SRC_PATTERNS += dotenv/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_PARALLELDISPLAY),1)
|
||||
SRC_PATTERNS += paralleldisplay/%
|
||||
endif
|
||||
|
@ -181,9 +184,6 @@ ifeq ($(CIRCUITPY_FUTURE),1)
|
|||
SRC_PATTERNS += __future__/%
|
||||
endif
|
||||
|
||||
ifeq ($(CIRCUITPY_GAMEPADSHIFT),1)
|
||||
SRC_PATTERNS += gamepadshift/%
|
||||
endif
|
||||
ifeq ($(CIRCUITPY_GETPASS),1)
|
||||
SRC_PATTERNS += getpass/%
|
||||
endif
|
||||
|
@ -548,13 +548,12 @@ SRC_SHARED_MODULE_ALL = \
|
|||
displayio/TileGrid.c \
|
||||
displayio/area.c \
|
||||
displayio/__init__.c \
|
||||
dotenv/__init__.c \
|
||||
floppyio/__init__.c \
|
||||
fontio/BuiltinFont.c \
|
||||
fontio/__init__.c \
|
||||
framebufferio/FramebufferDisplay.c \
|
||||
framebufferio/__init__.c \
|
||||
gamepadshift/GamePadShift.c \
|
||||
gamepadshift/__init__.c \
|
||||
getpass/__init__.c \
|
||||
gifio/__init__.c \
|
||||
gifio/GifWriter.c \
|
||||
|
|
|
@ -213,7 +213,7 @@ typedef long mp_off_t;
|
|||
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
|
||||
#endif
|
||||
#define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_BUILTINS_POW3)
|
||||
#define MICROPY_PY_FSTRINGS (MICROPY_CPYTHON_COMPAT)
|
||||
#define MICROPY_PY_FSTRINGS (1)
|
||||
#define MICROPY_MODULE_WEAK_LINKS (0)
|
||||
#define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD)
|
||||
#ifndef MICROPY_PY_BUILTINS_COMPLEX
|
||||
|
@ -311,14 +311,6 @@ typedef long mp_off_t;
|
|||
#define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (0)
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_GAMEPADSHIFT
|
||||
// Scan gamepad every 32ms
|
||||
#define CIRCUITPY_GAMEPAD_TICKS 0x1f
|
||||
#define GAMEPAD_ROOT_POINTERS mp_obj_t gamepad_singleton;
|
||||
#else
|
||||
#define GAMEPAD_ROOT_POINTERS
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_KEYPAD
|
||||
#define KEYPAD_ROOT_POINTERS mp_obj_t keypad_scanners_linked_list;
|
||||
#else
|
||||
|
@ -419,7 +411,6 @@ struct _supervisor_allocation_node;
|
|||
#define CIRCUITPY_COMMON_ROOT_POINTERS \
|
||||
FLASH_ROOT_POINTERS \
|
||||
KEYPAD_ROOT_POINTERS \
|
||||
GAMEPAD_ROOT_POINTERS \
|
||||
BOARD_UART_ROOT_POINTER \
|
||||
WIFI_MONITOR_ROOT_POINTERS \
|
||||
MEMORYMONITOR_ROOT_POINTERS \
|
||||
|
|
|
@ -57,8 +57,7 @@ CFLAGS += -DMICROPY_PY_USELECT_SELECT=$(MICROPY_PY_USELECT_SELECT)
|
|||
CIRCUITPY_AESIO ?= $(CIRCUITPY_FULL_BUILD)
|
||||
CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO)
|
||||
|
||||
# TODO: CIRCUITPY_ALARM will gradually be added to
|
||||
# as many ports as possible
|
||||
# TODO: CIRCUITPY_ALARM will gradually be added to as many ports as possible
|
||||
# so make this 1 or CIRCUITPY_FULL_BUILD eventually
|
||||
CIRCUITPY_ALARM ?= 0
|
||||
CFLAGS += -DCIRCUITPY_ALARM=$(CIRCUITPY_ALARM)
|
||||
|
@ -199,6 +198,9 @@ CFLAGS += -DCIRCUITPY_BITMAPTOOLS=$(CIRCUITPY_BITMAPTOOLS)
|
|||
CFLAGS += -DCIRCUITPY_FRAMEBUFFERIO=$(CIRCUITPY_FRAMEBUFFERIO)
|
||||
CFLAGS += -DCIRCUITPY_VECTORIO=$(CIRCUITPY_VECTORIO)
|
||||
|
||||
CIRCUITPY_DOTENV ?= $(CIRCUITPY_FULL_BUILD)
|
||||
CFLAGS += -DCIRCUITPY_DOTENV=$(CIRCUITPY_DOTENV)
|
||||
|
||||
CIRCUITPY_DUALBANK ?= 0
|
||||
CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK)
|
||||
|
||||
|
@ -227,9 +229,6 @@ CFLAGS += -DCIRCUITPY_FREQUENCYIO=$(CIRCUITPY_FREQUENCYIO)
|
|||
CIRCUITPY_FUTURE ?= 1
|
||||
CFLAGS += -DCIRCUITPY_FUTURE=$(CIRCUITPY_FUTURE)
|
||||
|
||||
CIRCUITPY_GAMEPADSHIFT ?= 0
|
||||
CFLAGS += -DCIRCUITPY_GAMEPADSHIFT=$(CIRCUITPY_GAMEPADSHIFT)
|
||||
|
||||
CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD)
|
||||
CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS)
|
||||
|
||||
|
|
|
@ -400,7 +400,8 @@ def compute_huffman_coding(translations, compression_filename):
|
|||
# words[] array.
|
||||
|
||||
scores = sorted(
|
||||
((s, -est_net_savings(s, occ)) for (s, occ) in counter.items()), key=lambda x: x[1]
|
||||
((s, -est_net_savings(s, occ)) for (s, occ) in counter.items() if occ > 1),
|
||||
key=lambda x: x[1],
|
||||
)
|
||||
|
||||
# Pick the one with the highest score. The score must be negative.
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "shared-bindings/bitbangio/__init__.h"
|
||||
#include "shared-bindings/bitbangio/I2C.h"
|
||||
#include "shared-bindings/onewireio/OneWire.h"
|
||||
#include "shared-bindings/bitbangio/SPI.h"
|
||||
|
||||
#include "py/runtime.h"
|
||||
|
@ -72,9 +71,6 @@
|
|||
STATIC const mp_rom_map_elem_t bitbangio_module_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bitbangio) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&bitbangio_i2c_type) },
|
||||
#if CIRCUITPY_ONEWIREIO
|
||||
{ MP_ROM_QSTR(MP_QSTR_OneWire), MP_ROM_PTR(&onewireio_onewire_type) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&bitbangio_spi_type) },
|
||||
};
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue