It is recommended that GD unify the macro names of enable and disable in the standard library[Copy link]
Today I tried GD's DMA+UART and encountered such a problem. On the one hand, it can be said that it was caused by my carelessness. On the other hand, I also hope that GD can unify some macro names of enable and disable, instead of doing each item separately.
For example, the several enable and disable in the figure above, although the enabled and disabled items are different, these shifts can be processed in the function, and these macros can all be replaced by the same one. I wrote this piece of code today:
is to use DMA to send the serial port. There is a problem in the above code, that is, I confused USART_DENR_ENABLE and USART_DENT_ENABLE and wrote it wrong. Then there was nothing in the serial port, because the initialization process only focused on the called API, and did not check whether the parameters were correct. After wondering for a few minutes and preparing to rewrite, I suddenly focused on USART_DENR_ENABLE, and changed it to USART_DENT_ENABLE and there was no problem. These two ENABLEs, when provided to users, mainly mean enable, why can't we use a unified macro, so that it is convenient to call. The difference between the two can be completely handled in the API.