fat: whitespace-cleanup on all files
[protos/imu.git] / uart.c
diff --git a/uart.c b/uart.c
index df5e1fd..3d218a5 100644 (file)
--- a/uart.c
+++ b/uart.c
@@ -32,7 +32,7 @@
 #define RXCIE RXCIE0
 
 #define UCSRC UCSR0C
 #define RXCIE RXCIE0
 
 #define UCSRC UCSR0C
-#define URSEL 
+#define URSEL
 #define UCSZ0 UCSZ00
 #define UCSZ1 UCSZ01
 #define UCSRC_SELECT 0
 #define UCSZ0 UCSZ00
 #define UCSZ1 UCSZ01
 #define UCSRC_SELECT 0
@@ -80,7 +80,7 @@ void uart_init()
 void uart_putc(uint8_t c)
 {
     if(c == '\n')
 void uart_putc(uint8_t c)
 {
     if(c == '\n')
-        uart_putc('\r');
+       uart_putc('\r');
 
     /* wait until transmit buffer is empty */
     while(!(UCSRA & (1 << UDRE)));
 
     /* wait until transmit buffer is empty */
     while(!(UCSRA & (1 << UDRE)));
@@ -93,15 +93,15 @@ void uart_putc_hex(uint8_t b)
 {
     /* upper nibble */
     if((b >> 4) < 0x0a)
 {
     /* upper nibble */
     if((b >> 4) < 0x0a)
-        uart_putc((b >> 4) + '0');
+       uart_putc((b >> 4) + '0');
     else
     else
-        uart_putc((b >> 4) - 0x0a + 'a');
+       uart_putc((b >> 4) - 0x0a + 'a');
 
     /* lower nibble */
     if((b & 0x0f) < 0x0a)
 
     /* lower nibble */
     if((b & 0x0f) < 0x0a)
-        uart_putc((b & 0x0f) + '0');
+       uart_putc((b & 0x0f) + '0');
     else
     else
-        uart_putc((b & 0x0f) - 0x0a + 'a');
+       uart_putc((b & 0x0f) - 0x0a + 'a');
 }
 
 void uart_putw_hex(uint16_t w)
 }
 
 void uart_putw_hex(uint16_t w)
@@ -123,15 +123,15 @@ void uart_putw_dec(uint16_t w)
 
     while(num > 0)
     {
 
     while(num > 0)
     {
-        uint8_t b = w / num;
-        if(b > 0 || started || num == 1)
-        {
-            uart_putc('0' + b);
-            started = 1;
-        }
-        w -= b * num;
-
-        num /= 10;
+       uint8_t b = w / num;
+       if(b > 0 || started || num == 1)
+       {
+           uart_putc('0' + b);
+           started = 1;
+       }
+       w -= b * num;
+
+       num /= 10;
     }
 }
 
     }
 }
 
@@ -142,33 +142,33 @@ void uart_putdw_dec(uint32_t dw)
 
     while(num > 0)
     {
 
     while(num > 0)
     {
-        uint8_t b = dw / num;
-        if(b > 0 || started || num == 1)
-        {
-            uart_putc('0' + b);
-            started = 1;
-        }
-        dw -= b * num;
-
-        num /= 10;
+       uint8_t b = dw / num;
+       if(b > 0 || started || num == 1)
+       {
+           uart_putc('0' + b);
+           started = 1;
+       }
+       dw -= b * num;
+
+       num /= 10;
     }
 }
 
 void uart_puts(const char* str)
 {
     while(*str)
     }
 }
 
 void uart_puts(const char* str)
 {
     while(*str)
-        uart_putc(*str++);
+       uart_putc(*str++);
 }
 
 void uart_puts_p(PGM_P str)
 {
     while(1)
     {
 }
 
 void uart_puts_p(PGM_P str)
 {
     while(1)
     {
-        uint8_t b = pgm_read_byte_near(str++);
-        if(!b)
-            break;
+       uint8_t b = pgm_read_byte_near(str++);
+       if(!b)
+           break;
 
 
-        uart_putc(b);
+       uart_putc(b);
     }
 }
 
     }
 }
 
@@ -180,7 +180,7 @@ uint8_t uart_getc()
     sei();
 
     while(!(UCSRA & (1 << RXC)))
     sei();
 
     while(!(UCSRA & (1 << RXC)))
-        sleep_mode();
+       sleep_mode();
 
     SREG = sreg;
 #else
 
     SREG = sreg;
 #else
@@ -189,7 +189,7 @@ uint8_t uart_getc()
 
     uint8_t b = UDR;
     if(b == '\r')
 
     uint8_t b = UDR;
     if(b == '\r')
-        b = '\n';
+       b = '\n';
 
     return b;
 }
 
     return b;
 }