astyle -A1 -s2

This commit is contained in:
maniacbug 2011-07-08 22:15:37 -07:00
parent 062d83346b
commit d5a3e79c66
8 changed files with 192 additions and 190 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
*.o *.o
.*.swp .*.swp
*.orig
docs/ docs/
output/ output/
ojam/ ojam/

View File

@ -199,8 +199,8 @@ void loop(void)
uint8_t state = ! digitalRead(button_pins[i]); uint8_t state = ! digitalRead(button_pins[i]);
if ( state != button_states[i] ) if ( state != button_states[i] )
{ {
different = true; different = true;
button_states[i] = state; button_states[i] = state;
} }
} }
@ -210,9 +210,9 @@ void loop(void)
printf("Now sending..."); printf("Now sending...");
bool ok = radio.write( button_states, num_button_pins ); bool ok = radio.write( button_states, num_button_pins );
if (ok) if (ok)
printf("ok\n\r"); printf("ok\n\r");
else else
printf("failed\n\r"); printf("failed\n\r");
} }
// Try again in a short while // Try again in a short while
@ -238,16 +238,16 @@ void loop(void)
// Spew it // Spew it
printf("Got buttons\n\r"); printf("Got buttons\n\r");
// For each button, if the button now on, then toggle the LED // For each button, if the button now on, then toggle the LED
int i = num_led_pins; int i = num_led_pins;
while(i--) while(i--)
{ {
if ( button_states[i] ) if ( button_states[i] )
{ {
led_states[i] ^= HIGH; led_states[i] ^= HIGH;
digitalWrite(led_pins[i],led_states[i]); digitalWrite(led_pins[i],led_states[i]);
} }
} }
} }
} }
} }

View File

@ -234,7 +234,7 @@ void loop(void)
done = radio.read( &got_time, sizeof(unsigned long) ); done = radio.read( &got_time, sizeof(unsigned long) );
// Spew it. Include our time, because the ping_out millis counter is unreliable // Spew it. Include our time, because the ping_out millis counter is unreliable
// due to it sleeping // due to it sleeping
printf("Got payload %lu @ %lu...",got_time,millis()); printf("Got payload %lu @ %lu...",got_time,millis());
} }
@ -260,28 +260,29 @@ void loop(void)
void setup_watchdog(uint8_t prescalar) void setup_watchdog(uint8_t prescalar)
{ {
prescalar = min(9,prescalar); prescalar = min(9,prescalar);
uint8_t wdtcsr = prescalar & 7; uint8_t wdtcsr = prescalar & 7;
if ( prescalar & 8 ) if ( prescalar & 8 )
wdtcsr |= _BV(WDP3); wdtcsr |= _BV(WDP3);
MCUSR &= ~_BV(WDRF); MCUSR &= ~_BV(WDRF);
WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = _BV(WDCE) | _BV(WDE);
WDTCSR = _BV(WDCE) | wdtcsr | _BV(WDIE); WDTCSR = _BV(WDCE) | wdtcsr | _BV(WDIE);
} }
ISR(WDT_vect) { ISR(WDT_vect)
{
--sleep_cycles_remaining; --sleep_cycles_remaining;
} }
void do_sleep(void) void do_sleep(void)
{ {
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable(); sleep_enable();
sleep_mode(); // System sleeps here sleep_mode(); // System sleeps here
sleep_disable(); // System continues execution here when watchdog timed out sleep_disable(); // System continues execution here when watchdog timed out
} }
// vim:ai:cin:sts=2 sw=2 ft=cpp // vim:ai:cin:sts=2 sw=2 ft=cpp

View File

@ -108,7 +108,7 @@ void loop(void)
// Did we get a carrier? // Did we get a carrier?
if ( radio.testCarrier() ) if ( radio.testCarrier() )
++values[i]; ++values[i];
} }
} }