format code according to conventions [skip ci]

This commit is contained in:
QMK Bot 2020-02-21 11:04:05 +00:00
parent 1751c3cc25
commit a7d859dab8

View file

@ -32,35 +32,35 @@
#include "uart.h" #include "uart.h"
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__) #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega328P__)
# define UDRn UDR0 # define UDRn UDR0
# define UBRRn UBRR0 # define UBRRn UBRR0
# define UCSRnA UCSR0A # define UCSRnA UCSR0A
# define UCSRnB UCSR0B # define UCSRnB UCSR0B
# define UCSRnC UCSR0C # define UCSRnC UCSR0C
# define U2Xn U2X0 # define U2Xn U2X0
# define RXENn RXEN0 # define RXENn RXEN0
# define TXENn TXEN0 # define TXENn TXEN0
# define RXCIEn RXCIE0 # define RXCIEn RXCIE0
# define UCSZn1 UCSZ01 # define UCSZn1 UCSZ01
# define UCSZn0 UCSZ00 # define UCSZn0 UCSZ00
# define UDRIEn UDRIE0 # define UDRIEn UDRIE0
# define UDRE_vect USART_UDRE_vect # define UDRE_vect USART_UDRE_vect
# define RX_vect USART_RX_vect # define RX_vect USART_RX_vect
#elif defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U2__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__) #elif defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega32U2__) || defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
# define UDRn UDR1 # define UDRn UDR1
# define UBRRn UBRR1 # define UBRRn UBRR1
# define UCSRnA UCSR1A # define UCSRnA UCSR1A
# define UCSRnB UCSR1B # define UCSRnB UCSR1B
# define UCSRnC UCSR1C # define UCSRnC UCSR1C
# define U2Xn U2X1 # define U2Xn U2X1
# define RXENn RXEN1 # define RXENn RXEN1
# define TXENn TXEN1 # define TXENn TXEN1
# define RXCIEn RXCIE1 # define RXCIEn RXCIE1
# define UCSZn1 UCSZ11 # define UCSZn1 UCSZ11
# define UCSZn0 UCSZ10 # define UCSZn0 UCSZ10
# define UDRIEn UDRIE1 # define UDRIEn UDRIE1
# define UDRE_vect USART1_UDRE_vect # define UDRE_vect USART1_UDRE_vect
# define RX_vect USART1_RX_vect # define RX_vect USART1_RX_vect
#endif #endif
// These buffers may be any size from 2 to 256 bytes. // These buffers may be any size from 2 to 256 bytes.
@ -92,14 +92,14 @@ void uart_putchar(uint8_t c) {
i = tx_buffer_head + 1; i = tx_buffer_head + 1;
if (i >= TX_BUFFER_SIZE) i = 0; if (i >= TX_BUFFER_SIZE) i = 0;
// return immediately to avoid deadlock when interrupt is disabled(called from ISR) // return immediately to avoid deadlock when interrupt is disabled(called from ISR)
if (tx_buffer_tail == i && (SREG & (1<<SREG_I)) == 0) return; if (tx_buffer_tail == i && (SREG & (1 << SREG_I)) == 0) return;
while (tx_buffer_tail == i) while (tx_buffer_tail == i)
; // wait until space in buffer ; // wait until space in buffer
// cli(); // cli();
tx_buffer[i] = c; tx_buffer[i] = c;
tx_buffer_head = i; tx_buffer_head = i;
UCSRB = (1 << RXENn) | (1 << TXENn) | (1 << RXCIEn) | (1 << UDRIEn); UCSRB = (1 << RXENn) | (1 << TXENn) | (1 << RXCIEn) | (1 << UDRIEn);
// sei(); // sei();
} }