This provides similar functionality to the former zlib.DecompIO and
especially CPython's gzip.GzipFile for both compression and decompression.
This class can be used directly, and also can be used from Python to
implement (via io.BytesIO) zlib.decompress and zlib.compress, as well as
gzip.GzipFile.
Enable/disable this on all ports/boards that zlib was previously configured
for.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This library used a mix of "tinf" and "uzlib" to refer to itself. Remove
all use of "tinf" in the public API.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
There are enough places that implement __exit__ by forwarding directly to
mp_stream_close that this saves code size.
For the cases where __exit__ is a no-op, additionally make their
MP_STREAM_CLOSE ioctl handled as a no-op.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This will be replaced with a new deflate module providing the same
functionality, with an optional frozen Python wrapper providing a
replacement zlib module.
binascii.crc32 is temporarily disabled.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Re-enable some features required for the board to still build and the lora
driver to run.
This board only has 192KB of flash total, so default stm32 build is very
close to the limit.
Before:
LINK build-B_L072Z_LRWAN1/firmware.elf
text data bss dec hex filename
184352 68 14112 198532 30784 build-B_L072Z_LRWAN1/firmware.elf
(12256 bytes free)
After:
LINK build-B_L072Z_LRWAN1/firmware.elf
text data bss dec hex filename
155028 68 14052 169148 294bc build-B_L072Z_LRWAN1/firmware.elf
(41580 bytes free)
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The existing qspi for stm32 implementation can only send a spi command with
exactly 0 or 2 data bytes. Certain spiflash chips (e.g. AT25SF321B) have
commands that only take a single data byte, and will ignore the command if
more than that is sent. This commit allows sending a command with a single
data byte.
Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
For STM32G4, there is a errata on ADC that may get wrong ADC result.
According to the errata sheet, this can be avoid by performing two
consecutive ADC conversions and keep second result.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STM32G4 series, the internal sensors are connected to:
- ADC1_IN16: Temperature sensor
- ADC1_IN17: Battery voltage monitoring
- ADC1_IN18: Internal voltage reference
but ADC_CHANNEL_TEMPSENSOR_ADC1, ADC_CHANNEL_VBAT,
ADC_CHANNEL_VREFINT are not defined as 16, 17, 18.
This commit converts channel 16, 17, 18 to ADC_CHANNEL_x in
adc_get_internal_channel().
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STM32G4,
* TS_CAL1 raw data acquired at a temperature of 30°C
* TS_CAL2 raw data acquired at a temperature of 130°C
Also, these values are at VDDA=3.0V.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STM32G4, ADC clock frequency should be equal or less than 60MHz.
To satisfy this specification, ADC clock prescaler should be equal or
greater than 4 (For example, NUCLEO_G474RE runs 170MHz).
In addition, to obtain accurate internal channel value,
the ADC clock prescaler is set to 16 because vbat needs at least 12us
(16/170*247.5=23.3us).
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
For STMG4 MCUs, the peripheral registers for DAC have to be accessed by
words (32bits) because DAC is connected to AHB directly.
(This requirement is also there for other MCU series. However, if DAC is
connected to APB like F4/L1/L4 MCUs, AHB byte or half-word transfer is
changed into a 32-bit APB transfer. This means that PSIZE does not have to
be DMA_PDATAALIGN_WORD on these MCUs, and in fact must be BYTE/HALFWORD to
function correctly.)
Fixes issue #9563.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
To match the other functions in the machine module, in particular so that
MICROPY_PY_MACHINE can be disabled without getting a compiler warning about
unused code.
Signed-off-by: Damien George <damien@micropython.org>
Mostly updates comments, but also renames the UASYNCIO enum value to
ASYNCIO.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The asyncio module now has much better CPython compatibility and
deserves to be just called "asyncio".
This will avoid people having to write `from uasyncio import asyncio`.
Renames all files, and updates port manifests to use the new path. Also
renames the built-in _uasyncio to _asyncio.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit adds initial support for STM32H5xx MCUs. The following
features have been confirmed to be working on an STM32H573:
- UART over REPL and USB CDC
- USB CDC and MSC
- internal flash filesystem
- machine.Pin
- machine.SPI transfers with DMA
- machine.ADC
- machine.RTC
- pyb.LED
- pyb.Switch
- pyb.rng
- mboot
Signed-off-by: Damien George <damien@micropython.org>
The G0 USB peripheral behaves more like MICROPY_HW_USB_IS_MULTI_OTG=0 than
that config =1. This fixes the configuration of the PMA FIFO buffers.
Signed-off-by: Damien George <damien@micropython.org>
For debugging purposes, to see output from other peripherals.
Also reset the pyb_stdio_uart state at the end of soft reset, in case it
points to a heap-allocated object.
Signed-off-by: Damien George <damien@micropython.org>
Following how mkrules.cmake works. This makes it easy for a port to enable
frozen code, by defining FROZEN_MANIFEST in its Makefile.
Signed-off-by: Damien George <damien@micropython.org>
This is a MicroPython-specific module that existed to support the old
version of uasyncio. It's undocumented and not enabled on all ports and
takes up code size unnecessarily.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Applies to drivers/examples/extmod/port-modules/tools.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Updates any includes, and references from Makefiles/CMake.
This essentially reverts what was done long ago in commit
136b5cbd76
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This renames the builtin-modules, such that help('modules') and printing
the module object will show "module" rather than "umodule".
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Updates all `help()` output to use the phrase:
`For online docs please visit http://docs.micropython.org/`
Some ports previously used different wording, some pointed to the wrong
link. Also make all ports use `help.c` for consistency.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>