From 2bc19d499c1d4dff873827268ac236d37f0ef4fb Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Tue, 24 Oct 2017 23:51:52 +0000 Subject: [PATCH] stm32:usart: Pull stop bit definitions up as common --- include/libopencm3/stm32/common/usart_common_all.h | 9 +++++++++ include/libopencm3/stm32/common/usart_common_f124.h | 8 -------- include/libopencm3/stm32/f3/usart.h | 8 -------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/include/libopencm3/stm32/common/usart_common_all.h b/include/libopencm3/stm32/common/usart_common_all.h index f838dfea..a8e0272e 100644 --- a/include/libopencm3/stm32/common/usart_common_all.h +++ b/include/libopencm3/stm32/common/usart_common_all.h @@ -85,6 +85,15 @@ specific memorymap.h header before including this header file.*/ #define USART_STOPBITS_1_5 USART_CR2_STOPBITS_1_5 /* 1.5 stop bit*/ /**@}*/ +/* STOP[13:12]: STOP bits */ +#define USART_CR2_STOPBITS_1 (0x00 << 12) /* 1 stop bit */ +#define USART_CR2_STOPBITS_0_5 (0x01 << 12) /* 0.5 stop bits */ +#define USART_CR2_STOPBITS_2 (0x02 << 12) /* 2 stop bits */ +#define USART_CR2_STOPBITS_1_5 (0x03 << 12) /* 1.5 stop bits */ +#define USART_CR2_STOPBITS_MASK (0x03 << 12) +#define USART_CR2_STOPBITS_SHIFT 12 + + /* CR3_CTSE/CR3_RTSE combined values */ /****************************************************************************/ /** @defgroup usart_cr3_flowcontrol USART Hardware Flow Control Selection diff --git a/include/libopencm3/stm32/common/usart_common_f124.h b/include/libopencm3/stm32/common/usart_common_f124.h index cd6f56ff..283503d2 100644 --- a/include/libopencm3/stm32/common/usart_common_f124.h +++ b/include/libopencm3/stm32/common/usart_common_f124.h @@ -195,14 +195,6 @@ specific memorymap.h header before including this header file.*/ /* LINEN: LIN mode enable */ #define USART_CR2_LINEN (1 << 14) -/* STOP[13:12]: STOP bits */ -#define USART_CR2_STOPBITS_1 (0x00 << 12) /* 1 stop bit */ -#define USART_CR2_STOPBITS_0_5 (0x01 << 12) /* 0.5 stop bits */ -#define USART_CR2_STOPBITS_2 (0x02 << 12) /* 2 stop bits */ -#define USART_CR2_STOPBITS_1_5 (0x03 << 12) /* 1.5 stop bits */ -#define USART_CR2_STOPBITS_MASK (0x03 << 12) -#define USART_CR2_STOPBITS_SHIFT 12 - /* CLKEN: Clock enable */ #define USART_CR2_CLKEN (1 << 11) diff --git a/include/libopencm3/stm32/f3/usart.h b/include/libopencm3/stm32/f3/usart.h index 10964a80..4d3766f7 100644 --- a/include/libopencm3/stm32/f3/usart.h +++ b/include/libopencm3/stm32/f3/usart.h @@ -50,14 +50,6 @@ #define USART_CR2_ABRMOD_FRAME_0x7F (0x2 << 21) #define USART_CR2_ABRMOD_FRAME_0x55 (0x3 << 21) -/* STOP[13:12]: STOP bits */ -#define USART_CR2_STOPBITS_1 (0x00 << 12) /* 1 stop bit */ -#define USART_CR2_STOPBITS_0_5 (0x01 << 12) /* 0.5 stop bits */ -#define USART_CR2_STOPBITS_2 (0x02 << 12) /* 2 stop bits */ -#define USART_CR2_STOPBITS_1_5 (0x03 << 12) /* 1.5 stop bits */ -#define USART_CR2_STOPBITS_MASK (0x03 << 12) -#define USART_CR2_STOPBITS_SHIFT 12 - /* ADD[3:0]: Address of the usart node #define USART_CR2_ADD_MASK 0xF */