From a689cb6e82eb20158743479823c53b80dc66e545 Mon Sep 17 00:00:00 2001 From: lcgamboa Date: Sat, 6 Jul 2024 16:43:20 -0300 Subject: [PATCH] chg: Add support to set baud rate in bitbang_uart (STM32 boards) --- src/boards/board_Blue_Pill.cc | 9 +++++++-- src/boards/board_STM32_H103.cc | 9 +++++++-- tests/in_out/in_out_esp32.pzw | Bin 504389 -> 504424 bytes tests/in_out/in_out_esp32c3.pzw | Bin 214299 -> 214334 bytes tests/in_out/in_out_stm32.pzw | Bin 17801 -> 17835 bytes 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/boards/board_Blue_Pill.cc b/src/boards/board_Blue_Pill.cc index 44ab8f78..635e7ddc 100644 --- a/src/boards/board_Blue_Pill.cc +++ b/src/boards/board_Blue_Pill.cc @@ -290,7 +290,9 @@ void cboard_Blue_Pill::Reset(void) { MReset(1); - PICSimLab.UpdateStatus(PS_SERIAL, "Serial: " + std::string(SERIALDEVICE)); + uint32_t baud_rate = *qemu_picsimlab_get_internals(QEMU_INTERNAL_UART0_BAUD); + bitbang_uart_set_speed(&master_uart[0], baud_rate); + PICSimLab.UpdateStatus(PS_SERIAL, "Serial: " + std::string(SERIALDEVICE) + "(" + std::to_string(baud_rate) + ")"); if (use_spare) SpareParts.Reset(); @@ -306,7 +308,10 @@ void cboard_Blue_Pill::RegisterRemoteControl(void) { void cboard_Blue_Pill::RefreshStatus(void) { if (serial_open) { - PICSimLab.UpdateStatus(PS_SERIAL, "Serial: " + std::string(SERIALDEVICE)); + uint32_t baud_rate = *qemu_picsimlab_get_internals(QEMU_INTERNAL_UART0_BAUD); + bitbang_uart_set_speed(&master_uart[0], baud_rate); + PICSimLab.UpdateStatus(PS_SERIAL, + "Serial: " + std::string(SERIALDEVICE) + "(" + std::to_string(baud_rate) + ")"); } else { PICSimLab.UpdateStatus(PS_SERIAL, "Serial: Error"); } diff --git a/src/boards/board_STM32_H103.cc b/src/boards/board_STM32_H103.cc index 202f0115..0bb9f255 100644 --- a/src/boards/board_STM32_H103.cc +++ b/src/boards/board_STM32_H103.cc @@ -311,7 +311,9 @@ void cboard_STM32_H103::Reset(void) { MReset(1); - PICSimLab.UpdateStatus(PS_SERIAL, "Serial: " + std::string(SERIALDEVICE)); + uint32_t baud_rate = *qemu_picsimlab_get_internals(QEMU_INTERNAL_UART0_BAUD); + bitbang_uart_set_speed(&master_uart[0], baud_rate); + PICSimLab.UpdateStatus(PS_SERIAL, "Serial: " + std::string(SERIALDEVICE) + "(" + std::to_string(baud_rate) + ")"); if (use_spare) SpareParts.Reset(); @@ -330,7 +332,10 @@ void cboard_STM32_H103::RegisterRemoteControl(void) { void cboard_STM32_H103::RefreshStatus(void) { if (serial_open) { - PICSimLab.UpdateStatus(PS_SERIAL, "Serial: " + std::string(SERIALDEVICE)); + uint32_t baud_rate = *qemu_picsimlab_get_internals(QEMU_INTERNAL_UART0_BAUD); + bitbang_uart_set_speed(&master_uart[0], baud_rate); + PICSimLab.UpdateStatus(PS_SERIAL, + "Serial: " + std::string(SERIALDEVICE) + "(" + std::to_string(baud_rate) + ")"); } else { PICSimLab.UpdateStatus(PS_SERIAL, "Serial: Error"); } diff --git a/tests/in_out/in_out_esp32.pzw b/tests/in_out/in_out_esp32.pzw index a79f7790e3a10ec64580675ca6f67bcef6ac90d8..fc9161854f82d88f253c3eee57459302fd67a7b7 100644 GIT binary patch delta 517 zcmX^5MDE2Cx#n7y_F5K3AZ7w$W*`RfS%H{sdo2q)^XkoNjET&=yHcM=w96-N5MpFt z_&vRIJ-cyz!0D{R1_FCtYqRXsOZ&R%&7G)O4hu{yr^IzXUeS4QV~^_h-@A+E%y3%m zxWW3&8NJ_c+b;azGf3=>oXIKnYE`MRve6v5*R>f*K~b}t0~hqhNw2Ouo^gW)L<#<;asp=C>Ee^q)G^Rqp7>)m@A26Ntj^Exm0b3J=vtH-(!&vWMaZyqdu{X!yK{AJAo z9+AmY%Vq>TisAUStCCZpXCd=Mr_2eeAGweG5%(yQINWOAZ}_Y45O+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