Skip to content

Commit

Permalink
chg: Add support to set baud rate in bitbang_uart (STM32 boards)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcgamboa committed Jul 7, 2024
1 parent 23aa33d commit a689cb6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/boards/board_Blue_Pill.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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");
}
Expand Down
9 changes: 7 additions & 2 deletions src/boards/board_STM32_H103.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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");
}
Expand Down
Binary file modified tests/in_out/in_out_esp32.pzw
Binary file not shown.
Binary file modified tests/in_out/in_out_esp32c3.pzw
Binary file not shown.
Binary file modified tests/in_out/in_out_stm32.pzw
Binary file not shown.

0 comments on commit a689cb6

Please sign in to comment.