Skip to content
Snippets Groups Projects
Commit a7c75b4a authored by cnlohr's avatar cnlohr
Browse files

Merge branch 'master' of https://github.com/cnlohr/ch32v003fun

parents c8684b88 6737d4bd
No related branches found
No related tags found
No related merge requests found
...@@ -12452,10 +12452,9 @@ void SystemInit(void); ...@@ -12452,10 +12452,9 @@ void SystemInit(void);
#else #else
#define UART_BAUD_RATE 115200 #define UART_BAUD_RATE 115200
#endif #endif
#define OVER4DIV 4 // Debug UART baud rate register calculation. Works assuming HCLK prescaler is off.
#define INTEGER_DIVIDER (((25 * (FUNCONF_SYSTEM_CORE_CLOCK)) / ((OVER4DIV) * (UART_BAUD_RATE)))) // Computes UART_BRR = CORE_CLOCK / BAUD_RATE with rounding to closest integer
#define FRACTIONAL_DIVIDER ((INTEGER_DIVIDER)%100) #define UART_BRR (((FUNCONF_SYSTEM_CORE_CLOCK) + (UART_BAUD_RATE)/2) / (UART_BAUD_RATE))
#define UART_BRR ((((INTEGER_DIVIDER) / 100) << 4) | (((((FRACTIONAL_DIVIDER) * ((OVER4DIV)*4)) + 50)/100)&15))
// Put an output debug UART on Pin D5. // Put an output debug UART on Pin D5.
// You can write to this with printf(...) or puts(...) // You can write to this with printf(...) or puts(...)
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment