I thought this was okay although a little expanded:
(A) = (USART1->CR2&~USART_CR2_STOP) will clear bits 12 and 13 in a copy of CR2 to make room for eventually setting both bits
(B) = (~USART_CR2_STOP_1&~USART_CR2_STOP_0) will also clear bits 12 and 13 (or set one or both if needed)
So USART1->CR2=(A) | (B) will clear bits 12 and 13 of CR2 meaning using 1 stopbit. You shouldn't be ORing them, B ends up being something like 0xCFFF, and so does CR2. The net effect will be to break the USART. Would strongly suggest tracing/stepping through with a JTAG Debugger, and looking at the register settings. Also I'd recommend using the library code, as you get less involved in the low level stuff and have more portable code. Or you can spend hours debugging your code..
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..