diff main.c @ 41:1701457e6007

fix tabbing
author Matt Johnston <matt@ucc.asn.au>
date Sat, 23 Jun 2012 22:12:07 +0800
parents 9b5b202129c3
children 96c336896201
line wrap: on
line diff
--- a/main.c	Sat Jun 23 22:10:23 2012 +0800
+++ b/main.c	Sat Jun 23 22:12:07 2012 +0800
@@ -126,10 +126,10 @@
     DDR_LED |= _BV(PIN_LED);
     DDR_SHDN |= _BV(PIN_SHDN);
 
-	// INT0 setup
-	EIMSK = _BV(INT0);
-	// set pullup
-	PORTD |= _BV(PD2);
+    // INT0 setup
+    EIMSK = _BV(INT0);
+    // set pullup
+    PORTD |= _BV(PD2);
 }
 
 static void
@@ -179,7 +179,7 @@
     UCSR0B = _BV(RXCIE0) | _BV(RXEN0) | _BV(TXEN0);
     //8N1
     UCSR0C = _BV(UCSZ01) | _BV(UCSZ00);
-	uart_enabled = 1;
+    uart_enabled = 1;
 }
 
 static void 
@@ -187,7 +187,7 @@
 {
     // Turn of interrupts and disable tx/rx
     UCSR0B = 0;
-	uart_enabled = 0;
+    uart_enabled = 0;
 
     // Power reduction register
     //PRR |= _BV(PRUSART0);
@@ -196,10 +196,10 @@
 int 
 uart_putchar(char c, FILE *stream)
 {
-	if (!uart_enabled)
-	{
-		return EOF;
-	}
+    if (!uart_enabled)
+    {
+        return EOF;
+    }
     // XXX could perhaps sleep in the loop for power.
     if (c == '\n')
     {
@@ -376,21 +376,21 @@
 static void
 cmd_add_all()
 {
-	uint8_t id[OW_ROMCODE_SIZE];
+    uint8_t id[OW_ROMCODE_SIZE];
     printf_P("Adding all\n");
     ow_reset();
-	for( uint8_t diff = OW_SEARCH_FIRST; diff != OW_LAST_DEVICE; )
-	{
-		diff = ow_rom_search( diff, &id[0] );
-		if( diff == OW_PRESENCE_ERR ) {
-			printf_P( PSTR("No Sensor found\r") );
-			return;
-		}
-		
-		if( diff == OW_DATA_ERR ) {
-			printf_P( PSTR("Bus Error\r") );
-			return;
-		}
+    for( uint8_t diff = OW_SEARCH_FIRST; diff != OW_LAST_DEVICE; )
+    {
+        diff = ow_rom_search( diff, &id[0] );
+        if( diff == OW_PRESENCE_ERR ) {
+            printf_P( PSTR("No Sensor found\r") );
+            return;
+        }
+        
+        if( diff == OW_DATA_ERR ) {
+            printf_P( PSTR("Bus Error\r") );
+            return;
+        }
         add_sensor(id);
     }
 }
@@ -464,7 +464,7 @@
 
 ISR(INT0_vect)
 {
-	need_comms = 1;
+    need_comms = 1;
     blink();
     _delay_ms(100);
     blink();
@@ -512,7 +512,7 @@
 {
     TCNT2 = 0;
     measure_count ++;
-	comms_count ++;
+    comms_count ++;
 
     clock_epoch ++;
 
@@ -528,11 +528,11 @@
         need_measurement = 1;
     }
 
-	if (comms_count >= COMMS_WAKE)
-	{
-		comms_count = 0;
-		need_comms = 1;
-	}
+    if (comms_count >= COMMS_WAKE)
+    {
+        comms_count = 0;
+        need_comms = 1;
+    }
 
 }
 
@@ -669,14 +669,14 @@
 static void
 do_comms()
 {
-	// turn on bluetooth
+    // turn on bluetooth
     set_aux_power(1);
     uart_on();
-	
-	// write sd card here? same 3.3v regulator...
-	
-	for (comms_timeout = WAKE_SECS; comms_timeout > 0;  )
-	{
+    
+    // write sd card here? same 3.3v regulator...
+    
+    for (comms_timeout = WAKE_SECS; comms_timeout > 0;  )
+    {
         if (need_measurement)
         {
             need_measurement = 0;
@@ -690,8 +690,8 @@
         }
 
         // wait for commands from the master
-		idle_sleep();
-	}
+        idle_sleep();
+    }
 
     uart_off();
     set_aux_power(0);
@@ -758,17 +758,17 @@
         {
             need_measurement = 0;
             do_measurement();
-			continue;
+            continue;
         }
 
         if (need_comms)
         {
             need_comms = 0;
             do_comms();
-			continue;
+            continue;
         }
 
-		deep_sleep();
+        deep_sleep();
         blink();
     }