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
.*.swp
*.orig
docs/
output/
ojam/

View File

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

View File

@ -234,7 +234,7 @@ void loop(void)
done = radio.read( &got_time, sizeof(unsigned long) );
// 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());
}
@ -260,28 +260,29 @@ void loop(void)
void setup_watchdog(uint8_t prescalar)
{
prescalar = min(9,prescalar);
uint8_t wdtcsr = prescalar & 7;
if ( prescalar & 8 )
wdtcsr |= _BV(WDP3);
prescalar = min(9,prescalar);
uint8_t wdtcsr = prescalar & 7;
if ( prescalar & 8 )
wdtcsr |= _BV(WDP3);
MCUSR &= ~_BV(WDRF);
WDTCSR = _BV(WDCE) | _BV(WDE);
WDTCSR = _BV(WDCE) | wdtcsr | _BV(WDIE);
MCUSR &= ~_BV(WDRF);
WDTCSR = _BV(WDCE) | _BV(WDE);
WDTCSR = _BV(WDCE) | wdtcsr | _BV(WDIE);
}
ISR(WDT_vect) {
ISR(WDT_vect)
{
--sleep_cycles_remaining;
}
void do_sleep(void)
{
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable();
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
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

View File

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