From 3ce03df0ff0e04f8ee83e70c33876026a0fb7b9a Mon Sep 17 00:00:00 2001
From: MrKevinWeiss <weiss.kevin604@gmail.com>
Date: Thu, 3 Jan 2019 16:17:26 +0100
Subject: [PATCH] cpu/atmega_common/uart: Comment why brr calc is different
 from datasheet

The brr calculation on the datasheet is different than what is implmented.
This is intentional since it provides better rounding due to truncation.
There was no comment explaining that so this comment should prevent confusion.
---
 cpu/atmega_common/periph/uart.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cpu/atmega_common/periph/uart.c b/cpu/atmega_common/periph/uart.c
index 260191ce58..2a195f78c4 100644
--- a/cpu/atmega_common/periph/uart.c
+++ b/cpu/atmega_common/periph/uart.c
@@ -97,6 +97,7 @@ static void _set_brr(uart_t uart, uint32_t baudrate)
         return;
     }
 #endif
+/* brr calculation is different from the datasheet to provide better rounding */
 #if defined(UART_DOUBLE_SPEED)
     brr = (CLOCK_CORECLOCK + 4UL * baudrate) / (8UL * baudrate) - 1UL;
     _update_brr(uart, brr, true);
-- 
GitLab