Skip to content

Commit 227a1cf

Browse files
committed
Remove redundant cast in UART transmit writes
Simplify UART transmit code in lib-gd32/src/gd32_uart.cpp by removing unnecessary (uint32_t) casts when writing bytes to USART_TDATA in Gd32UartTransmit and Gd32UartTransmitString. This cleans up the expressions without changing behavior and may reduce compiler warnings.
1 parent 80cfdd7 commit 227a1cf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib-gd32/src/gd32_uart.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void Gd32UartTransmit(uint32_t usart_periph, const uint8_t* data, uint32_t lengt
309309
while (length-- != 0) {
310310
while (RESET == usart_flag_get(usart_periph, USART_FLAG_TBE));
311311
#if defined(GD32H7XX)
312-
USART_TDATA(usart_periph) = USART_TDATA_TDATA & (uint32_t)*data++;
312+
USART_TDATA(usart_periph) = USART_TDATA_TDATA & *data++;
313313
#else
314314
USART_DATA(usart_periph) = (USART_DATA_DATA & *data++);
315315
#endif
@@ -324,7 +324,7 @@ void Gd32UartTransmitString(uint32_t usart_periph, const char* data) {
324324
while (*data != '\0') {
325325
while (RESET == usart_flag_get(USART0, USART_FLAG_TBE));
326326
#if defined(GD32H7XX)
327-
USART_TDATA(usart_periph) = USART_TDATA_TDATA & (uint32_t)*data++;
327+
USART_TDATA(usart_periph) = USART_TDATA_TDATA & *data++;
328328
#else
329329
USART_DATA(usart_periph) = (USART_DATA_DATA & *data++);
330330
#endif

0 commit comments

Comments
 (0)