aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/AVR/serial_lld.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms/AVR/serial_lld.h')
-rw-r--r--os/hal/platforms/AVR/serial_lld.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/os/hal/platforms/AVR/serial_lld.h b/os/hal/platforms/AVR/serial_lld.h
index f7bea9568..d6f893e74 100644
--- a/os/hal/platforms/AVR/serial_lld.h
+++ b/os/hal/platforms/AVR/serial_lld.h
@@ -76,9 +76,9 @@ typedef struct {
*/
uint16_t sc_brr;
/**
- * @brief Initialization value for the CSRC register.
+ * @brief Number of bits per character (USART_CHAR_SIZE_5 to USART_CHAR_SIZE_9).
*/
- uint8_t sc_csrc;
+ uint8_t sc_bits_per_char;
} SerialConfig;
/**
@@ -112,7 +112,7 @@ typedef struct {
* @brief Macro for baud rate computation when U2Xn == 1.
* @note Make sure the final baud rate is within tolerance.
*/
-#define UBRR2(b) (((F_CPU / b) >> 3) - 1)
+#define UBRR2x(b) (((F_CPU / b) >> 3) - 1)
/**
* @brief Macro for baud rate computation.
@@ -126,7 +126,13 @@ typedef struct {
* @note Make sure the final baud rate is within tolerance.
* @note This version uses floating point math for greater accuracy.
*/
-#define UBRR2_F(b) ((((double) F_CPU / (double) b) / 8.0) - 0.5)
+#define UBRR2x_F(b) ((((double) F_CPU / (double) b) / 8.0) - 0.5)
+
+#define USART_CHAR_SIZE_5 0
+#define USART_CHAR_SIZE_6 1
+#define USART_CHAR_SIZE_7 2
+#define USART_CHAR_SIZE_8 3
+#define USART_CHAR_SIZE_9 4
/*===========================================================================*/
/* External declarations. */