this piece of code in running on ATmega2560, so what is the difference between these two:
while(UCSR0A & 0b00100000 == 0); // check UDRE0 bit if it is 1
and:
loop_until_bit_is_set(UCSR0A, UDRE0);
as you can see this is for UART transmission, but if i use the first one I could't get desired output on terminal, for example if i do printf("Hello world\n");
the actual terminal display is: HeHeHe......
. However the latter one works. You can find this piece of code in stdio.h
.