Merge remote-tracking branch 'adafruit/main' into auto_wifi

This commit is contained in:
Scott Shawcroft 2022-06-13 15:44:43 -07:00
commit 0c418e98b1
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
15 changed files with 258 additions and 88 deletions

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2022-06-08 15:15+0000\n"
"PO-Revision-Date: 2022-06-11 10:17+0000\n"
"Last-Translator: Matěj Soukup <matej@locuboard.cz>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: cs\n"
@ -29,6 +29,8 @@ msgid ""
"\n"
"Code stopped by auto-reload. Reloading soon.\n"
msgstr ""
"\n"
"Kód byl zastaven kvůli automatickému načtení. K načtení dojde brzy.\n"
#: supervisor/shared/safe_mode.c
msgid ""
@ -243,17 +245,17 @@ msgstr "'%s' očekává popisek"
#: py/emitinlinethumb.c py/emitinlinextensa.c
#, c-format
msgid "'%s' expects a register"
msgstr "'%s' očekává register"
msgstr "'%s' očekává registr"
#: py/emitinlinethumb.c
#, c-format
msgid "'%s' expects a special register"
msgstr "'%s' očekává speciální register"
msgstr "'%s' očekává speciální registr"
#: py/emitinlinethumb.c
#, c-format
msgid "'%s' expects an FPU register"
msgstr "'%s' očekává register FPU"
msgstr "'%s' očekává registr FPU"
#: py/emitinlinethumb.c
#, c-format
@ -354,7 +356,7 @@ msgstr "'return' je volán mimo funkci"
#: py/compile.c
msgid "'yield from' inside async function"
msgstr ""
msgstr "'yield from' volán uvnitř funkce async"
#: py/compile.c
msgid "'yield' outside function"
@ -409,13 +411,13 @@ msgstr "Všechny I2C periferie jsou používány"
#: ports/espressif/common-hal/frequencyio/FrequencyIn.c
#: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c
msgid "All PCNT units in use"
msgstr ""
msgstr "Všechny PCNT jednotky jsou používány"
#: ports/atmel-samd/common-hal/canio/Listener.c
#: ports/espressif/common-hal/canio/Listener.c
#: ports/stm/common-hal/canio/Listener.c
msgid "All RX FIFOs in use"
msgstr ""
msgstr "Všechny RX FIFO jsou používány"
#: ports/espressif/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c
msgid "All SPI peripherals are in use"
@ -521,7 +523,7 @@ msgstr "Konverze audia není implementována"
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
msgstr "AuthMode.OPEN nepoužívá heslo"
#: shared-bindings/wifi/Radio.c
msgid "Authentication failure"
@ -550,7 +552,7 @@ msgstr "Pod minimální obnovovací frekvencí"
#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c
msgid "Bit clock and word select must be sequential pins"
msgstr ""
msgstr "Bitové hodiny a výběr slov musí být sekvenční piny"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Bit clock and word select must share a clock unit"
@ -595,7 +597,7 @@ msgstr "Vyrovnávací paměť + offset je příliš malý %d %d %d"
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
msgid "Buffer elements must be 4 bytes long or less"
msgstr ""
msgstr "Prvky bufferu musí být 4 bajty dlouhé nebo méně"
#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Buffer is not a bytearray."
@ -618,7 +620,7 @@ msgstr "Délka vyrovnávací paměti musí být násobkem 512"
#: ports/stm/common-hal/sdioio/SDCard.c shared-bindings/floppyio/__init__.c
msgid "Buffer must be a multiple of 512 bytes"
msgstr ""
msgstr "Buffer musí být násobkem 512 bajtů"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format
@ -627,7 +629,7 @@ msgstr "Buffer je příliš krátký o %d bajtů"
#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
msgid "Buffers must be same size"
msgstr ""
msgstr "Buffery musí mít stejnou velikost"
#: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c
#: ports/espressif/common-hal/paralleldisplay/ParallelBus.c
@ -647,7 +649,7 @@ msgstr "Bloky CBC musí být násobky 16 bajtů"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
msgstr "Disk CIRCUITPY nelze nalézt nebo vytvořit."
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
@ -681,11 +683,11 @@ msgstr "Nelze nastavit CCCD na místní charakteristiku"
#: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c
#: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c
msgid "Cannot change USB devices now"
msgstr ""
msgstr "Nelze změnit USB zařízení"
#: shared-bindings/_bleio/Adapter.c
msgid "Cannot create a new Adapter; use _bleio.adapter;"
msgstr ""
msgstr "Není možné vytvořit nový adaptér; použití _bleio.adapter;"
#: shared-bindings/displayio/Bitmap.c
#: shared-bindings/memorymonitor/AllocationSize.c
@ -718,13 +720,13 @@ msgstr "Nelze nahrávat do souboru"
#: shared-module/storage/__init__.c
msgid "Cannot remount '/' when visible via USB."
msgstr ""
msgstr "Není možné znovu připojit '/', pokud je viditelné pomocí USB."
#: ports/atmel-samd/common-hal/microcontroller/__init__.c
#: ports/cxd56/common-hal/microcontroller/__init__.c
#: ports/mimxrt10xx/common-hal/microcontroller/__init__.c
msgid "Cannot reset into bootloader because no bootloader is present"
msgstr ""
msgstr "Reset do bootloaderu není možný, protože žádný bootloader není přítomen"
#: ports/espressif/common-hal/socketpool/Socket.c
msgid "Cannot set socket options"
@ -769,7 +771,7 @@ msgstr "Jádro kódu CircuitPython tvrdě havarovalo. Jejda!\n"
#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap."
msgstr ""
msgstr "CircuitPython nedokázal alokovat haldu."
#: shared-module/bitbangio/I2C.c
msgid "Clock stretch too long"
@ -788,7 +790,7 @@ msgstr ""
#: py/persistentcode.c
msgid "Corrupt .mpy file"
msgstr ""
msgstr "Poškozený soubor .mpy"
#: ports/espressif/common-hal/neopixel_write/__init__.c
msgid "Could not retrieve clock"
@ -796,7 +798,7 @@ msgstr ""
#: shared-bindings/_bleio/Adapter.c
msgid "Could not set address"
msgstr ""
msgstr "Není možné nastavit adresu"
#: shared-bindings/pwmio/PWMOut.c
msgid "Could not start PWM"
@ -891,7 +893,7 @@ msgstr "EXTINT kanál se již používá"
#: shared-module/synthio/MidiTrack.c
#, c-format
msgid "Error in MIDI stream at position %d"
msgstr ""
msgstr "Chyba v MIDI přenosu na pozici %d"
#: extmod/modure.c
msgid "Error in regex"
@ -923,7 +925,7 @@ msgstr ""
#: extmod/ulab/code/numpy/fft/fft_tools.c
msgid "FFT is implemented for linear arrays only"
msgstr ""
msgstr "FFT je implementován pouze pro lineární pole"
#: ports/espressif/common-hal/ssl/SSLSocket.c
msgid "Failed SSL handshake"
@ -940,11 +942,11 @@ msgstr ""
#: shared-module/rgbmatrix/RGBMatrix.c
msgid "Failed to allocate %q buffer"
msgstr ""
msgstr "Chyba alokace %q bufferu"
#: ports/espressif/common-hal/wifi/__init__.c
msgid "Failed to allocate Wifi memory"
msgstr ""
msgstr "Chyba alokace paměti WiFi"
#: ports/espressif/common-hal/wifi/ScannedNetworks.c
msgid "Failed to allocate wifi scan memory"
@ -965,7 +967,7 @@ msgstr "Nepodařilo se připojit: časový limit"
#: ports/espressif/common-hal/wifi/__init__.c
msgid "Failed to init wifi"
msgstr ""
msgstr "Chyba inicializace WiFi"
#: shared-module/audiomp3/MP3Decoder.c
msgid "Failed to parse MP3 file"
@ -982,7 +984,7 @@ msgstr "Nepodařilo se zapsat do interní paměti."
#: supervisor/shared/safe_mode.c
msgid "Fatal error."
msgstr ""
msgstr "Fatální chyba."
#: py/moduerrno.c
msgid "File exists"
@ -996,7 +998,7 @@ msgstr ""
#: ports/espressif/common-hal/dualbank/__init__.c
msgid "Firmware image is invalid"
msgstr ""
msgstr "Obraz firmwaru je nevalidní"
#: shared-bindings/bitmaptools/__init__.c
msgid "For L8 colorspace, input bitmap must have 8 bits per pixel"
@ -1008,12 +1010,14 @@ msgstr ""
#: ports/cxd56/common-hal/camera/Camera.c
msgid "Format not supported"
msgstr ""
msgstr "Formát není podporován"
#: ports/mimxrt10xx/common-hal/microcontroller/Processor.c
msgid ""
"Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz"
msgstr ""
"Frekvence musí být 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 nebo 1008 "
"Mhz"
#: shared-bindings/pwmio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer"
@ -1026,11 +1030,11 @@ msgstr "Funkce vyžaduje zámek"
#: ports/cxd56/common-hal/gnss/GNSS.c
msgid "GNSS init"
msgstr ""
msgstr "Inicializace GNSS"
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "Generic Failure"
msgstr ""
msgstr "Základní chyba"
#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
@ -1061,11 +1065,11 @@ msgstr ""
#: ports/stm/common-hal/busio/I2C.c
msgid "I2C init error"
msgstr ""
msgstr "Chyba inicializace I2C"
#: ports/raspberrypi/common-hal/busio/I2C.c
msgid "I2C peripheral in use"
msgstr ""
msgstr "Periférie I2C je používána"
#: shared-bindings/audiobusio/I2SOut.c
msgid "I2SOut not available"
@ -1115,7 +1119,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
msgid "Input taking too long"
msgstr ""
msgstr "Vstup trval příliš dlouho"
#: ports/espressif/common-hal/neopixel_write/__init__.c py/moduerrno.c
msgid "Input/output error"
@ -1163,7 +1167,7 @@ msgstr ""
#: ports/espressif/common-hal/paralleldisplay/ParallelBus.c
msgid "Internal error"
msgstr ""
msgstr "Interní chyba"
#: shared-module/rgbmatrix/RGBMatrix.c
#, c-format
@ -1185,15 +1189,15 @@ msgstr "Neplatná hodnota jednotky ADC"
#: ports/espressif/common-hal/_bleio/__init__.c
#: ports/nrf/common-hal/_bleio/__init__.c
msgid "Invalid BLE parameter"
msgstr ""
msgstr "Chybný BLE parametr"
#: shared-bindings/wifi/Radio.c
msgid "Invalid BSSID"
msgstr ""
msgstr "Chybné BSSID"
#: shared-bindings/wifi/Radio.c
msgid "Invalid MAC address"
msgstr ""
msgstr "Chybná MAC adresa"
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
#: py/moduerrno.c
@ -1207,7 +1211,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_pins[%d]"
msgstr ""
msgstr "Chybný data_pin[%d]"
#: shared-module/audiocore/WaveFile.c
msgid "Invalid format chunk size"
@ -1219,7 +1223,7 @@ msgstr "Neplatný přístup k paměti."
#: ports/espressif/common-hal/wifi/Radio.c
msgid "Invalid multicast MAC address"
msgstr ""
msgstr "Chybná multicastová MAC adresa"
#: shared-bindings/busio/UART.c
msgid "Invalid pins"
@ -1227,15 +1231,15 @@ msgstr "Neplatné piny"
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "Invalid size"
msgstr ""
msgstr "Chybná velikost"
#: ports/espressif/common-hal/ssl/SSLContext.c
msgid "Invalid socket for TLS"
msgstr ""
msgstr "Chybný soket pro TLS"
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "Invalid state"
msgstr ""
msgstr "Chybný stav"
#: shared-bindings/aesio/aes.c
msgid "Key must be 16, 24, or 32 bytes long"
@ -1243,7 +1247,7 @@ msgstr "Klíč musí být dlouhý 16, 24 nebo 32 bajtů"
#: shared-module/is31fl3741/FrameBuffer.c
msgid "LED mappings must match display size"
msgstr ""
msgstr "Mapování LED musí korespondovat s velikostí displeje"
#: py/compile.c
msgid "LHS of keyword arg must be an id"
@ -1259,7 +1263,7 @@ msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "MAC address was invalid"
msgstr ""
msgstr "MAC adresa byla chybná"
#: shared-bindings/is31fl3741/IS31FL3741.c
msgid "Mapping must be a tuple"
@ -1289,7 +1293,7 @@ msgstr "Chybí pin MISO nebo MOSI"
#: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI pin"
msgstr ""
msgstr "Chybějící MISO nebo MOSI pin"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format
@ -1345,7 +1349,7 @@ msgstr ""
#: ports/espressif/common-hal/nvm/ByteArray.c
msgid "NVS Error"
msgstr ""
msgstr "Chyba NVS"
#: py/qstr.c
msgid "Name too long"
@ -1353,7 +1357,7 @@ msgstr "Jméno je příliš dlouhé"
#: shared-bindings/displayio/TileGrid.c
msgid "New bitmap must be same size as old bitmap"
msgstr ""
msgstr "Nová bitmapa musí mít stejnou velikost jako původní bitmapa"
#: ports/espressif/common-hal/_bleio/__init__.c
msgid "Nimble out of memory"
@ -1383,7 +1387,7 @@ msgstr ""
#: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c
#, c-format
msgid "No I2C device at address: 0x%x"
msgstr ""
msgstr "Žádné I2C zařízení na adrese: 0x%x"
#: ports/espressif/common-hal/busio/SPI.c
#: ports/mimxrt10xx/common-hal/busio/SPI.c
@ -1392,7 +1396,7 @@ msgstr "Žádný pin MISO"
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
msgid "No MISO pin"
msgstr ""
msgstr "Žádný MISO pin"
#: ports/espressif/common-hal/busio/SPI.c
#: ports/mimxrt10xx/common-hal/busio/SPI.c
@ -1401,7 +1405,7 @@ msgstr "Žádný pin MOSI"
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
msgid "No MOSI pin"
msgstr ""
msgstr "Žádný MOSI pin"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/espressif/common-hal/busio/UART.c
@ -1460,11 +1464,11 @@ msgstr ""
#: shared-module/usb_hid/__init__.c
#, c-format
msgid "No more than %d HID devices allowed"
msgstr ""
msgstr "Ne více než %d HID zařízení je povoleno"
#: shared-bindings/wifi/Radio.c
msgid "No network with that ssid"
msgstr ""
msgstr "Žádná síť s takovým SSID"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "No out in program"
@ -1487,7 +1491,7 @@ msgstr "Na zařízení nezůstal žádný prostor"
#: py/moduerrno.c
msgid "No such device"
msgstr ""
msgstr "Žádné takové zařízení"
#: py/moduerrno.c
msgid "No such file/directory"
@ -1507,7 +1511,7 @@ msgstr ""
#: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c
msgid "Not a valid IP string"
msgstr ""
msgstr "Nevalidní IP string"
#: ports/espressif/common-hal/_bleio/__init__.c
#: ports/nrf/common-hal/_bleio/__init__.c
@ -1527,12 +1531,13 @@ msgstr ""
#: ports/espressif/common-hal/paralleldisplay/ParallelBus.c
#, c-format
msgid "Number of data_pins must be 8 or 16, not %d"
msgstr ""
msgstr "Počet data_pins musí být 8 nebo 16, nikoli %d"
#: shared-bindings/util.c
msgid ""
"Object has been deinitialized and can no longer be used. Create a new object."
msgstr ""
"Objekt byl deinicializován a nelze jej dále používat. Vytvořte nový objekt."
#: ports/nrf/common-hal/busio/UART.c
msgid "Odd parity is not supported"
@ -1545,11 +1550,11 @@ msgstr ""
#: ports/espressif/common-hal/wifi/__init__.c
msgid "Only IPv4 addresses supported"
msgstr ""
msgstr "Pouze IPv4 adresy podporovány"
#: ports/espressif/common-hal/socketpool/SocketPool.c
msgid "Only IPv4 sockets supported"
msgstr ""
msgstr "Pouze IPv4 sokety podporovány"
#: shared-module/displayio/OnDiskBitmap.c
#, c-format

View File

@ -27,6 +27,8 @@ CIRCUITPY_PS2IO = 0
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_TOUCHIO = 0
CIRCUITPY_USB_HID = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_ULAB = 0

View File

@ -46,6 +46,7 @@
#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0)
#define MICROPY_PY_FUNCTION_ATTRS (0)
#define MICROPY_PY_REVERSE_SPECIAL_METHODS (0)
#define MICROPY_PY_COLLECTIONS_DEQUE (0)
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)
#define MICROPY_PY_UERRNO_LIST \
X(EPERM) \

View File

@ -108,6 +108,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
bool have_rx = rx != NULL;
bool have_rts = rts != NULL;
bool have_cts = cts != NULL;
uart_config_t uart_config = {0};
bool have_rs485_dir = rs485_dir != NULL;
if (!have_tx && !have_rx) {
mp_raise_ValueError(translate("tx and rx cannot both be None"));
@ -135,25 +137,26 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
}
uart_mode_t mode = UART_MODE_UART;
uart_hw_flowcontrol_t flow_control = UART_HW_FLOWCTRL_DISABLE;
uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE;
if (have_rs485_dir) {
mode = UART_MODE_RS485_HALF_DUPLEX;
if (!rs485_invert) {
// This one is not in the set
uart_set_line_inverse(self->uart_num, UART_SIGNAL_DTR_INV);
}
} else if (have_rts && have_cts) {
flow_control = UART_HW_FLOWCTRL_CTS_RTS;
uart_config.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS;
} else if (have_rts) {
flow_control = UART_HW_FLOWCTRL_RTS;
uart_config.flow_ctrl = UART_HW_FLOWCTRL_RTS;
} else if (have_rts) {
flow_control = UART_HW_FLOWCTRL_CTS;
uart_config.flow_ctrl = UART_HW_FLOWCTRL_CTS;
}
if (receiver_buffer_size <= UART_FIFO_LEN) {
receiver_buffer_size = UART_FIFO_LEN + 8;
}
uint8_t rx_threshold = UART_FIFO_LEN - 8;
uart_config.rx_flow_ctrl_thresh = UART_FIFO_LEN - 8;
// Install the driver before we change the settings.
if (uart_driver_install(self->uart_num, receiver_buffer_size, 0, 20, &self->event_queue, 0) != ESP_OK ||
uart_set_mode(self->uart_num, mode) != ESP_OK) {
@ -175,55 +178,62 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
CONFIG_PTHREAD_TASK_PRIO_DEFAULT,
&self->event_task,
xPortGetCoreID());
uart_set_hw_flow_ctrl(self->uart_num, flow_control, rx_threshold);
// uart_set_hw_flow_ctrl(self->uart_num, uart_config.flow_control, uart_config.rx_flow_ctrl_thresh);
// Set baud rate
common_hal_busio_uart_set_baudrate(self, baudrate);
// common_hal_busio_uart_set_baudrate(self, baudrate);
uart_config.baud_rate = baudrate;
uart_word_length_t word_length = UART_DATA_8_BITS;
uart_config.data_bits = UART_DATA_8_BITS;
switch (bits) {
// Shared bindings prevents data < 7 bits.
// case 5:
// word_length = UART_DATA_5_BITS;
// uart_config.data_bits = UART_DATA_5_BITS;
// break;
// case 6:
// word_length = UART_DATA_6_BITS;
// uart_config.data_bits = UART_DATA_6_BITS;
// break;
case 7:
word_length = UART_DATA_7_BITS;
uart_config.data_bits = UART_DATA_7_BITS;
break;
case 8:
word_length = UART_DATA_8_BITS;
uart_config.data_bits = UART_DATA_8_BITS;
break;
default:
// Won't hit this because shared-bindings limits to 7-9 bits. We error on 9 above.
break;
}
uart_set_word_length(self->uart_num, word_length);
// uart_set_word_length(self->uart_num, uart_config.data_bits);
uart_parity_t parity_mode = UART_PARITY_DISABLE;
uart_config.parity = UART_PARITY_DISABLE;
switch (parity) {
case BUSIO_UART_PARITY_NONE:
parity_mode = UART_PARITY_DISABLE;
uart_config.parity = UART_PARITY_DISABLE;
break;
case BUSIO_UART_PARITY_EVEN:
parity_mode = UART_PARITY_EVEN;
uart_config.parity = UART_PARITY_EVEN;
break;
case BUSIO_UART_PARITY_ODD:
parity_mode = UART_PARITY_ODD;
uart_config.parity = UART_PARITY_ODD;
break;
default:
// Won't reach here because the input is an enum that is completely handled.
break;
}
uart_set_parity(self->uart_num, parity_mode);
// uart_set_parity(self->uart_num, uart_config.parity);
// Stop is 1 or 2 always.
uart_stop_bits_t stop_bits = UART_STOP_BITS_1;
uart_config.stop_bits = UART_STOP_BITS_1;
if (stop == 2) {
stop_bits = UART_STOP_BITS_2;
uart_config.stop_bits = UART_STOP_BITS_2;
}
// uart_set_stop_bits(self->uart_num, stop_bits);
uart_config.source_clk = UART_SCLK_APB; // guessing here...
// config all in one?
if (uart_param_config(self->uart_num, &uart_config) != ESP_OK) {
mp_raise_RuntimeError(translate("UART init"));
}
uart_set_stop_bits(self->uart_num, stop_bits);
self->tx_pin = NULL;
self->rx_pin = NULL;

View File

@ -70,3 +70,4 @@ CIRCUITPY_BLEIO = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_KEYPAD = 1
CIRCUITPY_RGBMATRIX = 0
CIRCUITPY_RTC = 1

View File

@ -0,0 +1,54 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 20212 Matthew McGowan for Blues Wireless Inc
*
* 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 <stdio.h>
#include "py/obj.h"
#include "py/runtime.h"
#include "shared/timeutils/timeutils.h"
#include "shared-bindings/rtc/__init__.h"
#include "common-hal/rtc/RTC.h"
#include "shared-bindings/rtc/RTC.h"
#include "supervisor/port.h"
#include "supervisor/shared/translate/translate.h"
#include "peripherals/rtc.h"
void common_hal_rtc_set_time(timeutils_struct_time_t *tm) {
stm32_peripherals_rtc_set_time(tm);
}
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
stm32_peripherals_rtc_get_time(tm);
}
int common_hal_rtc_get_calibration(void) {
return 0;
}
void common_hal_rtc_set_calibration(int calibration) {
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration);
}

View File

@ -0,0 +1,33 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc
*
* 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.
*/
#ifndef MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H
#define MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H
extern void rtc_init(void);
extern void rtc_reset(void);
#endif // MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H

View File

View File

View File

@ -24,7 +24,7 @@ ifeq ($(MCU_SERIES),F4)
CIRCUITPY_I2CPERIPHERAL ?= 0
CIRCUITPY_NVM ?= 0
CIRCUITPY_ROTARYIO ?= 0
CIRCUITPY_RTC ?= 0
CIRCUITPY_RTC ?= 1
USB_NUM_ENDPOINT_PAIRS = 4
UF2_FAMILY_ID ?= 0x57755a57
endif
@ -42,7 +42,7 @@ ifeq ($(MCU_SERIES),H7)
CIRCUITPY_PULSEIO ?= 0
CIRCUITPY_PWMIO ?= 0
CIRCUITPY_ROTARYIO ?= 0
CIRCUITPY_RTC ?= 0
CIRCUITPY_RTC ?= 1
USB_NUM_ENDPOINT_PAIRS = 9
UF2_FAMILY_ID ?= 0x6db66082
@ -59,7 +59,7 @@ ifeq ($(MCU_SERIES),F7)
CIRCUITPY_NEOPIXEL_WRITE ?= 0
CIRCUITPY_NVM ?= 0
CIRCUITPY_ROTARYIO ?= 0
CIRCUITPY_RTC ?= 0
CIRCUITPY_RTC ?= 1
USB_NUM_ENDPOINT_PAIRS = 6
UF2_FAMILY_ID ?= 0x53b80f00
@ -76,7 +76,7 @@ ifeq ($(MCU_SERIES),L4)
CIRCUITPY_NEOPIXEL_WRITE ?= 0
CIRCUITPY_NVM ?= 0
CIRCUITPY_ROTARYIO ?= 0
CIRCUITPY_RTC ?= 0
CIRCUITPY_RTC ?= 1
# todo - this varies between devices in the series
# 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.

View File

@ -4,6 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2021 Lucian Copeland for Adafruit Industries
* Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -76,6 +77,46 @@ void stm32_peripherals_rtc_init(void) {
HAL_NVIC_EnableIRQ(RTC_Alarm_IRQn);
}
#if CIRCUITPY_RTC
void stm32_peripherals_rtc_get_time(timeutils_struct_time_t *tm) {
RTC_DateTypeDef date = {0};
RTC_TimeTypeDef time = {0};
int code;
if ((code = HAL_RTC_GetTime(&hrtc, &time, RTC_FORMAT_BIN)) == HAL_OK &&
(code = HAL_RTC_GetDate(&hrtc, &date, RTC_FORMAT_BIN)) == HAL_OK) {
tm->tm_hour = time.Hours;
tm->tm_min = time.Minutes;
tm->tm_sec = time.Seconds;
tm->tm_wday = date.WeekDay - 1;
tm->tm_mday = date.Date;
tm->tm_mon = date.Month;
tm->tm_year = date.Year + 2000;
tm->tm_yday = -1;
}
}
void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm) {
RTC_DateTypeDef date = {0};
RTC_TimeTypeDef time = {0};
time.Hours = tm->tm_hour;
time.Minutes = tm->tm_min;
time.Seconds = tm->tm_sec;
date.WeekDay = tm->tm_wday + 1;
date.Date = tm->tm_mday;
date.Month = tm->tm_mon;
date.Year = tm->tm_year - 2000;
time.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
time.StoreOperation = RTC_STOREOPERATION_RESET;
if (HAL_RTC_SetTime(&hrtc, &time, RTC_FORMAT_BIN) != HAL_OK ||
HAL_RTC_SetDate(&hrtc, &date, RTC_FORMAT_BIN) != HAL_OK) {
// todo - throw an exception
}
}
#endif
// This function is called often for timing so we cache the seconds elapsed computation based on the
// register value. The STM HAL always does shifts and conversion if we use it directly.
uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks) {

View File

@ -4,6 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2021 Lucian Copeland for Adafruit Industries
* Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -48,4 +49,10 @@ void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void (*callb
void stm32_peripherals_rtc_set_alarm(uint8_t alarm_idx, uint32_t ticks);
bool stm32_peripherals_rtc_alarm_triggered(uint8_t alarm_idx);
#if CIRCUITPY_RTC
typedef struct _timeutils_struct_time_t timeutils_struct_time_t;
void stm32_peripherals_rtc_get_time(timeutils_struct_time_t *tm);
void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm);
#endif
#endif // __MICROPY_INCLUDED_STM32_PERIPHERALS_RTC_H__

View File

@ -61,6 +61,9 @@
#if CIRCUITPY_ALARM
#include "common-hal/alarm/__init__.h"
#endif
#if CIRCUITPY_RTC
#include "shared-bindings/rtc/__init__.h"
#endif
#include "peripherals/clocks.h"
#include "peripherals/gpio.h"
@ -241,6 +244,10 @@ void SysTick_Handler(void) {
void reset_port(void) {
reset_all_pins();
#if CIRCUITPY_RTC
rtc_reset();
#endif
#if CIRCUITPY_AUDIOPWMIO
audiopwmout_reset();
#endif

View File

@ -226,6 +226,9 @@ typedef long mp_off_t;
#ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD)
#endif
#ifndef MICROPY_PY_COLLECTIONS_DEQUE
#define MICROPY_PY_COLLECTIONS_DEQUE (CIRCUITPY_FULL_BUILD)
#endif
#define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_RE)
#define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_RE)
#define MICROPY_PY_URE_SUB (CIRCUITPY_RE)

View File

@ -139,23 +139,29 @@ STATIC void validate_clip_region(displayio_bitmap_t *bitmap, mp_obj_t clip0_tupl
//| :param bitmap dest_bitmap: Destination bitmap that will be copied into
//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied
//| :param int ox: Horizontal pixel location in destination bitmap where source bitmap
//| point (px,py) is placed
//| point (px,py) is placed. Defaults to None which causes it to use the horizontal
//| midway point of the destination bitmap.
//| :param int oy: Vertical pixel location in destination bitmap where source bitmap
//| point (px,py) is placed
//| point (px,py) is placed. Defaults to None which causes it to use the vertical
//| midway point of the destination bitmap.
//| :param Tuple[int,int] dest_clip0: First corner of rectangular destination clipping
//| region that constrains region of writing into destination bitmap
//| :param Tuple[int,int] dest_clip1: Second corner of rectangular destination clipping
//| region that constrains region of writing into destination bitmap
//| :param int px: Horizontal pixel location in source bitmap that is placed into the
//| destination bitmap at (ox,oy)
//| destination bitmap at (ox,oy). Defaults to None which causes it to use the
//| horizontal midway point in the source bitmap.
//| :param int py: Vertical pixel location in source bitmap that is placed into the
//| destination bitmap at (ox,oy)
//| destination bitmap at (ox,oy). Defaults to None which causes it to use the
//| vertical midway point in the source bitmap.
//| :param Tuple[int,int] source_clip0: First corner of rectangular source clipping
//| region that constrains region of reading from the source bitmap
//| :param Tuple[int,int] source_clip1: Second corner of rectangular source clipping
//| region that constrains region of reading from the source bitmap
//| :param float angle: Angle of rotation, in radians (positive is clockwise direction)
//| :param float scale: Scaling factor
//| :param float angle: Angle of rotation, in radians (positive is clockwise direction).
//| Defaults to None which gets treated as 0.0 radians or no rotation.
//| :param float scale: Scaling factor. Defaults to None which gets treated as 1.0 or same
//| as original source size.
//| :param int skip_index: Bitmap palette index in the source that will not be copied,
//| set to None to copy all pixels"""
//| ...