Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
dd11711
Add support for 7-bit modes: 7N1 and 7N2
doc-hex Dec 20, 2017
31bbad3
Port may specify a subset of UART's to run in half-duplex (all the time)
doc-hex Dec 20, 2017
6d6a145
Bugfix: second DMA on a channel crashes because ChannelIndex gots res…
doc-hex Dec 20, 2017
992bd77
If MICROPY_HW_SPIn_MISO undefined, do not claim pin: permits output-o…
doc-hex Dec 20, 2017
da6f810
Correct compilier error (unused static) if no I2C ports defined by port
doc-hex Dec 20, 2017
3874c12
Move to corrected capitalization of HAL_SD_CardStateTypedef (not Type…
doc-hex Dec 20, 2017
6d598d2
Merge branch 'master' of https://github.com/micropython/micropython
doc-hex Dec 20, 2017
d1d570f
unix/Makefile: allow override of mpconfigport.mk
doc-hex Jan 4, 2018
0756daa
Merge remote-tracking branch 'upstream/master'
doc-hex Jan 4, 2018
492859f
drivers/display/ssd1306.py: call super as function
doc-hex Jan 4, 2018
0524998
ports/stm32/system_stm32.c: make SystemClock_Config() a weak symbol
doc-hex Jan 4, 2018
e5c9377
toplevel/.gitignore: add .tags file to ignore
doc-hex Jan 10, 2018
790470f
ports/stm32/modmachine.c: handle case of no MICROPY_PY_MACHINE_I2C
doc-hex Jan 4, 2018
6026823
As the last living person using ctags, no need to share this
doc-hex Jan 10, 2018
025c305
stm32/system_stm32.c: Make it easier to override VECT_TAB_OFFSET default
doc-hex Mar 1, 2018
112dbe3
Merge remote-tracking branch 'upstream/master' into resync-021803
doc-hex Mar 29, 2018
89bd790
MCU_SERIES_L4 => STM32L4
doc-hex Mar 29, 2018
5017aa4
stm32/main.c: Enable VCP+MSC in default boot.py if USB enabled for board
doc-hex Mar 29, 2018
8dca42e
Supress noise for CC project
doc-hex Apr 2, 2018
4bc05bf
stm32/main: allow override of init_flash_fs() and file contents
doc-hex Apr 2, 2018
b2494d4
stm32/main.c: no need to enable USB in boot.py, see #3689
doc-hex Apr 10, 2018
9c79154
stm32/dma.c: move re-init code into dma_init_handle() as suggested by…
doc-hex Apr 10, 2018
0bfc7e9
extmod/vfs_fat: enable FAT32 (and maybe ExFAT) in mkfs so larger card…
doc-hex Apr 12, 2018
dfbd1c4
stm32/dma: STM32L4: always deinit/reinit DMA channels
doc-hex Apr 13, 2018
4f0b68f
stm32/sdcard: sdcard_wait_finished() bugfix: remove WFI for STM32L4 case
doc-hex Apr 13, 2018
b9231d9
stm32/sdcard.c: implement BP_IOCTL_SEC_COUNT so we can mkfs sdcards
doc-hex Apr 13, 2018
501b1e7
stm32/system_stm32: Reconfigure SysTick IRQ priority for L4 MCUs.
dpgeorge Apr 27, 2018
ff286a7
Undo hack regarding WFI
doc-hex Apr 27, 2018
24cc1c1
usbd_hid_interface.c: address possible race condition vs. interrupt
doc-hex May 11, 2018
92b1f3a
usbd_cdc_msc_hid.c: bugfix: dont replace existing outgoing report if …
doc-hex May 11, 2018
6372f60
Support override of USB vender/product strings
doc-hex May 17, 2018
b526e07
Merge remote-tracking branch 'upstream/master'
doc-hex Jun 13, 2018
9aeacb9
Correct hash: 92f23d6
doc-hex Jun 13, 2018
d2f3293
Correct hash: 1fe30d1
doc-hex Jun 13, 2018
a6b981a
Bugfix for typo in merge
doc-hex Jun 13, 2018
31e8a48
extmod/vfs_posix.c: Add stdio.h include for rename()
doc-hex Jun 13, 2018
a177941
unix/modos.c: align ilistdir type value with docs
doc-hex Jun 15, 2018
e5a86f8
stm32/fatfs_port.c: bugfix when MICROPY_HW_ENABLE_RTC not set
doc-hex Jul 13, 2018
743147b
stm32/flashbdev.c: Bugfix: was dereferencing 0x800 rather than using …
doc-hex Jul 13, 2018
3a13819
stm32/flashbdev.c: Bugfix: was dereferencing 0x800 rather than using …
doc-hex Jul 13, 2018
302ddb5
stm32/mphalport.c: make mp_hal_stdin_rx_chr() and mp_hal_stdout_tx_st…
doc-hex Jul 17, 2018
2fbcf3b
Define ptr to end of fs cache, rather than length in linker script
doc-hex Jul 17, 2018
d48b6a4
Merge branch 'pr-fl2'
doc-hex Jul 17, 2018
c04dfcd
ports/stm32/gccollect.c: dont assume end of stack == end of RAM
doc-hex Apr 11, 2019
be04812
More flexibility in heap size/location
doc-hex Jul 8, 2019
37afd6d
lib/utils/printf: Exclude __GI_vsnprintf alias for gcc 9 and above.
doc-hex Oct 28, 2019
b0d1dd0
Extend SDCard.info() with CSD and CID values from the card itself
doc-hex Apr 27, 2020
39bc837
Quite a warning w/ py37
doc-hex Apr 29, 2020
4c945ff
unix/modos: Add uos.rename and uos.rmdir.
dpgeorge Dec 28, 2019
a094a0a
unix/modos: Rename unlink to remove to be consistent with other ports.
pfalcon Nov 16, 2018
db4e297
Oops
doc-hex Aug 4, 2020
0f1973f
Merge remote-tracking branch 'upstream/master'
doc-hex Feb 1, 2021
cfb6444
extmod/moduhashlib: allow multiple calls to digest() method
doc-hex Feb 5, 2021
79b973a
Improve portability and avoid 'dereferencing type-punned pointer'
doc-hex Feb 9, 2021
a23693d
Merge remote-tracking branch 'upstream/master'
doc-hex Mar 30, 2021
aa63cf6
extmod/vfs_fat: support FAT32 in mkfs=T case on mount
doc-hex Mar 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions drivers/dht/dht.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifdef MICROPY_HW_ENABLE_DHT
/*
* This file is part of the MicroPython project, http://micropython.org/
*
Expand Down Expand Up @@ -92,3 +93,5 @@ STATIC mp_obj_t dht_readinto(mp_obj_t pin_in, mp_obj_t buf_in) {
mp_raise_OSError(MP_ETIMEDOUT);
}
MP_DEFINE_CONST_FUN_OBJ_2(dht_readinto_obj, dht_readinto);

#endif
8 changes: 6 additions & 2 deletions extmod/moduhashlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
vstr_t vstr;
vstr_init_len(&vstr, 32);
mbedtls_sha256_finish_ret((mbedtls_sha256_context *)&self->state, (unsigned char *)vstr.buf);
mbedtls_sha256_context tmp_ctx;
memcpy(&tmp_ctx, self->state, sizeof(tmp_ctx));
mbedtls_sha256_finish_ret(&tmp_ctx, (unsigned char *)vstr.buf);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}

Expand Down Expand Up @@ -129,7 +131,9 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
mp_obj_hash_t *self = MP_OBJ_TO_PTR(self_in);
vstr_t vstr;
vstr_init_len(&vstr, SHA256_BLOCK_SIZE);
sha256_final((CRYAL_SHA256_CTX *)self->state, (byte *)vstr.buf);
CRYAL_SHA256_CTX tmp_ctx;
memcpy(&tmp_ctx, self->state, sizeof(tmp_ctx));
sha256_final(&tmp_ctx, (byte *)vstr.buf);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
#endif
Expand Down
3 changes: 3 additions & 0 deletions extmod/vfs_fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ STATIC mp_obj_t vfs_fat_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs
if (res == FR_NO_FILESYSTEM && mp_obj_is_true(mkfs)) {
uint8_t working_buf[FF_MAX_SS];
res = f_mkfs(&self->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf));
if (res == FR_MKFS_ABORTED) { // Probably doesn't support FAT16
res = f_mkfs(&self->fatfs, FM_FAT32, 0, working_buf, sizeof(working_buf));
}
}
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
Expand Down
1 change: 1 addition & 0 deletions extmod/vfs_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <string.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>

typedef struct _mp_obj_vfs_posix_t {
mp_obj_base_t base;
Expand Down
5 changes: 5 additions & 0 deletions ports/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# this file only useful for Coldcard project
stm32/boards/COLDCARD
unix/coldcard-mpy
unix/unix_random.P

4 changes: 4 additions & 0 deletions ports/stm32/modpyb.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#include "py/runtime.h"
#include "py/mphal.h"
#include "lib/utils/pyexec.h"
#if MICROPY_HW_ENABLE_DHT
#include "drivers/dht/dht.h"
#endif
#include "stm32_it.h"
#include "irq.h"
#include "led.h"
Expand Down Expand Up @@ -189,8 +191,10 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) },
#endif

#if MICROPY_HW_ENABLE_DHT
// This function is not intended to be public and may be moved elsewhere
{ MP_ROM_QSTR(MP_QSTR_dht_readinto), MP_ROM_PTR(&dht_readinto_obj) },
#endif

{ MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&pyb_timer_type) },

Expand Down
11 changes: 11 additions & 0 deletions ports/stm32/mpconfigboard_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@
#define MICROPY_HW_UART_IS_RESERVED(uart_id) (false)
#endif

// Defines which UART ports are to be half-duplex
#ifndef MICROPY_HW_UARTn_IS_HALF_DUPLEX
#define MICROPY_HW_UARTn_IS_HALF_DUPLEX(n) (0)
#endif

/*****************************************************************************/
// General configuration

Expand Down Expand Up @@ -399,3 +404,9 @@
#endif

#define MICROPY_HW_USES_BOOTLOADER (MICROPY_HW_VTOR != 0x08000000)

// drivers/dht ... a specific enviro sensor of some sort
#ifndef MICROPY_HW_ENABLE_DHT
#define MICROPY_HW_ENABLE_DHT (1)
#endif

13 changes: 10 additions & 3 deletions ports/stm32/sdcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,25 +730,32 @@ STATIC mp_obj_t sd_info(mp_obj_t self) {
uint32_t card_type;
uint32_t log_block_nbr;
uint32_t log_block_size;
const uint8_t *CSD = NULL, *CID = NULL;
#if MICROPY_HW_ENABLE_MMCARD
if (pyb_sdmmc_flags & PYB_SDMMC_FLAG_MMC) {
card_type = sdmmc_handle.mmc.MmcCard.CardType;
log_block_nbr = sdmmc_handle.mmc.MmcCard.LogBlockNbr;
log_block_size = sdmmc_handle.mmc.MmcCard.LogBlockSize;
CSD = sdmmc_handle.mmc.MmcCard.CSD;
CID = sdmmc_handle.mmc.MmcCard.CID;
} else
#endif
{
card_type = sdmmc_handle.sd.SdCard.CardType;
log_block_nbr = sdmmc_handle.sd.SdCard.LogBlockNbr;
log_block_size = sdmmc_handle.sd.SdCard.LogBlockSize;
CSD = sdmmc_handle.sd.SdCard.CSD;
CID = sdmmc_handle.sd.SdCard.CID;
}
// cardinfo.SD_csd and cardinfo.SD_cid have lots of info but we don't use them
mp_obj_t tuple[3] = {
// cardinfo.SD_csd and cardinfo.SD_cid have lots of info so let's share them
mp_obj_t tuple[5] = {
mp_obj_new_int_from_ull((uint64_t)log_block_nbr * (uint64_t)log_block_size),
mp_obj_new_int_from_uint(log_block_size),
mp_obj_new_int(card_type),
mp_obj_new_bytes(CSD, 16),
mp_obj_new_bytes(CID, 16),
};
return mp_obj_new_tuple(3, tuple);
return mp_obj_new_tuple(5, tuple);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(sd_info_obj, sd_info);

Expand Down
2 changes: 1 addition & 1 deletion ports/stm32/system_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void __fatal_error(const char *msg);
*
* Timers run from APBx if APBx_PRESC=1, else 2x APBx
*/
void SystemClock_Config(void) {
MP_WEAK void SystemClock_Config(void) {
#if defined(STM32F7)
// The DFU bootloader changes the clocksource register from its default power
// on reset value, so we set it back here, so the clocksources are the same
Expand Down
207 changes: 206 additions & 1 deletion ports/stm32/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,13 @@ bool uart_init(pyb_uart_obj_t *uart_obj,
huart.Init.Mode = UART_MODE_TX_RX;
huart.Init.HwFlowCtl = flow;
huart.Init.OverSampling = UART_OVERSAMPLING_16;
HAL_UART_Init(&huart);
if(MICROPY_HW_UARTn_IS_HALF_DUPLEX(uart_obj->uart_id)) {
// init in half-duplex mode
HAL_HalfDuplex_Init(&uart_obj->uart);
} else {
// init UARTx
HAL_UART_Init(&uart_obj->uart);
}

// Disable all individual UART IRQs, but enable the global handler
uart_obj->uartx->CR1 &= ~USART_CR1_IE_ALL;
Expand Down Expand Up @@ -925,10 +931,209 @@ void uart_irq_handler(mp_uint_t uart_id) {
}
}
}
<<<<<<< HEAD
}

/******************************************************************************/
/* MicroPython bindings */

STATIC void pyb_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_uart_obj_t *self = self_in;
if (!self->is_enabled) {
mp_printf(print, "UART(%u)", self->uart_id);
} else {
mp_int_t bits;
switch (self->uart.Init.WordLength) {
#ifdef UART_WORDLENGTH_7B
case UART_WORDLENGTH_7B: bits = 7; break;
#endif
case UART_WORDLENGTH_8B: bits = 8; break;
case UART_WORDLENGTH_9B: default: bits = 9; break;
}
if (self->uart.Init.Parity != UART_PARITY_NONE) {
bits -= 1;
}
mp_printf(print, "UART(%u, baudrate=%u, bits=%u, parity=",
self->uart_id, self->uart.Init.BaudRate, bits);
if (self->uart.Init.Parity == UART_PARITY_NONE) {
mp_print_str(print, "None");
} else {
mp_printf(print, "%u", self->uart.Init.Parity == UART_PARITY_EVEN ? 0 : 1);
}
if (self->uart.Init.HwFlowCtl) {
mp_printf(print, ", flow=");
if (self->uart.Init.HwFlowCtl & UART_HWCONTROL_RTS) {
mp_printf(print, "RTS%s", self->uart.Init.HwFlowCtl & UART_HWCONTROL_CTS ? "|" : "");
}
if (self->uart.Init.HwFlowCtl & UART_HWCONTROL_CTS) {
mp_printf(print, "CTS");
}
}
if(MICROPY_HW_UARTn_IS_HALF_DUPLEX(self->uart_id)) {
mp_printf(print, ", half=1");
}
mp_printf(print, ", stop=%u, timeout=%u, timeout_char=%u, read_buf_len=%u)",
self->uart.Init.StopBits == UART_STOPBITS_1 ? 1 : 2,
self->timeout, self->timeout_char,
self->read_buf_len == 0 ? 0 : self->read_buf_len - 1); // -1 to adjust for usable length of buffer
}
}

/// \method init(baudrate, bits=8, parity=None, stop=1, *, timeout=1000, timeout_char=0, flow=0, read_buf_len=64)
///
/// Initialise the UART bus with the given parameters:
///
/// - `baudrate` is the clock rate.
/// - `bits` is the number of bits per byte, 7, 8 or 9.
/// - `parity` is the parity, `None`, 0 (even) or 1 (odd).
/// - `stop` is the number of stop bits, 1 or 2.
/// - `timeout` is the timeout in milliseconds to wait for the first character.
/// - `timeout_char` is the timeout in milliseconds to wait between characters.
/// - `flow` is RTS | CTS where RTS == 256, CTS == 512
/// - `read_buf_len` is the character length of the read buffer (0 to disable).
STATIC mp_obj_t pyb_uart_init_helper(pyb_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_baudrate, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 9600} },
{ MP_QSTR_bits, MP_ARG_INT, {.u_int = 8} },
{ MP_QSTR_parity, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_stop, MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_flow, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_HWCONTROL_NONE} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1000} },
{ MP_QSTR_timeout_char, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_read_buf_len, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 64} },
};

// parse args
struct {
mp_arg_val_t baudrate, bits, parity, stop, flow, timeout, timeout_char, read_buf_len;
} args;
mp_arg_parse_all(n_args, pos_args, kw_args,
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);

// set the UART configuration values
memset(&self->uart, 0, sizeof(self->uart));
UART_InitTypeDef *init = &self->uart.Init;

// baudrate
init->BaudRate = args.baudrate.u_int;

// parity
mp_int_t bits = args.bits.u_int;
if (args.parity.u_obj == mp_const_none) {
init->Parity = UART_PARITY_NONE;
} else {
mp_int_t parity = mp_obj_get_int(args.parity.u_obj);
init->Parity = (parity & 1) ? UART_PARITY_ODD : UART_PARITY_EVEN;
bits += 1; // STs convention has bits including parity
}

// number of bits
if (bits == 8) {
init->WordLength = UART_WORDLENGTH_8B;
} else if (bits == 9) {
init->WordLength = UART_WORDLENGTH_9B;
#ifdef UART_WORDLENGTH_7B
} else if (bits == 7) {
init->WordLength = UART_WORDLENGTH_7B;
#endif
} else {
mp_raise_ValueError("unsupported combination of bits and parity");
}

// stop bits
switch (args.stop.u_int) {
case 1: init->StopBits = UART_STOPBITS_1; break;
default: init->StopBits = UART_STOPBITS_2; break;
}

// flow control
init->HwFlowCtl = args.flow.u_int;

// extra config (not yet configurable)
init->Mode = UART_MODE_TX_RX;
init->OverSampling = UART_OVERSAMPLING_16;

// init UART (if it fails, it's because the port doesn't exist)
if (!uart_init2(self)) {
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "UART(%d) doesn't exist", self->uart_id));
}

// set timeout
self->timeout = args.timeout.u_int;

// set timeout_char
// make sure it is at least as long as a whole character (13 bits to be safe)
// minimum value is 2ms because sys-tick has a resolution of only 1ms
self->timeout_char = args.timeout_char.u_int;
uint32_t min_timeout_char = 13000 / init->BaudRate + 2;
if (self->timeout_char < min_timeout_char) {
self->timeout_char = min_timeout_char;
}

// setup the read buffer
m_del(byte, self->read_buf, self->read_buf_len << self->char_width);
if (init->WordLength == UART_WORDLENGTH_9B && init->Parity == UART_PARITY_NONE) {
self->char_mask = 0x1ff;
self->char_width = CHAR_WIDTH_9BIT;
} else {
if (init->WordLength == UART_WORDLENGTH_9B || init->Parity == UART_PARITY_NONE) {
self->char_mask = 0xff;
} else {
self->char_mask = 0x7f;
}
self->char_width = CHAR_WIDTH_8BIT;
}
self->read_buf_head = 0;
self->read_buf_tail = 0;
if (args.read_buf_len.u_int <= 0) {
// no read buffer
self->read_buf_len = 0;
self->read_buf = NULL;
HAL_NVIC_DisableIRQ(self->irqn);
__HAL_UART_DISABLE_IT(&self->uart, UART_IT_RXNE);
} else {
// read buffer using interrupts
self->read_buf_len = args.read_buf_len.u_int + 1; // +1 to adjust for usable length of buffer
self->read_buf = m_new(byte, self->read_buf_len << self->char_width);
__HAL_UART_ENABLE_IT(&self->uart, UART_IT_RXNE);
NVIC_SetPriority(IRQn_NONNEG(self->irqn), IRQ_PRI_UART);
HAL_NVIC_EnableIRQ(self->irqn);
}

// compute actual baudrate that was configured
// (this formula assumes UART_OVERSAMPLING_16)
uint32_t actual_baudrate = 0;
#if defined(STM32F0)
actual_baudrate = HAL_RCC_GetPCLK1Freq();
#elif defined(STM32F7) || defined(STM32H7)
UART_ClockSourceTypeDef clocksource = UART_CLOCKSOURCE_UNDEFINED;
UART_GETCLOCKSOURCE(&self->uart, clocksource);
switch (clocksource) {
#if defined(STM32H7)
case UART_CLOCKSOURCE_D2PCLK1: actual_baudrate = HAL_RCC_GetPCLK1Freq(); break;
case UART_CLOCKSOURCE_D3PCLK1: actual_baudrate = HAL_RCC_GetPCLK1Freq(); break;
case UART_CLOCKSOURCE_D2PCLK2: actual_baudrate = HAL_RCC_GetPCLK2Freq(); break;
#else
case UART_CLOCKSOURCE_PCLK1: actual_baudrate = HAL_RCC_GetPCLK1Freq(); break;
case UART_CLOCKSOURCE_PCLK2: actual_baudrate = HAL_RCC_GetPCLK2Freq(); break;
case UART_CLOCKSOURCE_SYSCLK: actual_baudrate = HAL_RCC_GetSysClockFreq(); break;
#endif
#if defined(STM32H7)
case UART_CLOCKSOURCE_CSI: actual_baudrate = CSI_VALUE; break;
#endif
case UART_CLOCKSOURCE_HSI: actual_baudrate = HSI_VALUE; break;
case UART_CLOCKSOURCE_LSE: actual_baudrate = LSE_VALUE; break;
#if defined(STM32H7)
case UART_CLOCKSOURCE_PLL2:
case UART_CLOCKSOURCE_PLL3:
#endif
case UART_CLOCKSOURCE_UNDEFINED: break;
=======
// If RXNE is clear but ORE set then clear the ORE flag (it's tied to RXNE IRQ)
#if defined(STM32F4)
else if (self->uartx->SR & USART_SR_ORE) {
(void)self->uartx->DR;
>>>>>>> upstream/master
}
#else
else if (self->uartx->ISR & USART_ISR_ORE) {
Expand Down
20 changes: 10 additions & 10 deletions tests/extmod/uhashlib_sha256.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
# 56 bytes is a boundary case in the algorithm
print(hashlib.sha256(b"\xff" * 56).digest())

# TODO: running .digest() several times in row is not supported()
# h = hashlib.sha256(b'123')
# print(h.digest())
# print(h.digest())

# TODO: partial digests are not supported
# h = hashlib.sha256(b'123')
# print(h.digest())
# h.update(b'456')
# print(h.digest())
# running .digest() several times in row is now supported
h = hashlib.sha256(b'123')
print(h.digest())
print(h.digest())

# partial digests are supported
h = hashlib.sha256(b'123')
print(h.digest())
h.update(b'456')
print(h.digest())
Loading