From 4ec412bf434ab5c837ea8e05a393ca517d9fb11d Mon Sep 17 00:00:00 2001 From: Kizarm Date: Fri, 18 Oct 2024 19:45:45 +0200 Subject: [PATCH] baud zero divide --- V203/usb/ch32v203/usart.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/V203/usb/ch32v203/usart.cpp b/V203/usb/ch32v203/usart.cpp index 30c17a8..5f168eb 100644 --- a/V203/usb/ch32v203/usart.cpp +++ b/V203/usb/ch32v203/usart.cpp @@ -69,6 +69,7 @@ uint32_t Usart::Down(const char * data, const uint32_t len) { return n; } void Usart::SetBaud (const uint32_t _baud) const { + if (_baud == 0u) return; // ! zero divide const ONE_BIT b = USART1.CTLR1.B.UE; if (b == SET) USART1.CTLR1.B.UE = RESET; const uint32_t HCLK = SystemCoreClock; // hodiny pro USART zde nejsou děleny