Sleep mode - am I doing this correctly?

Hi all,

I'm trying a new idea - making a battery powered device that operates once when the AVR (tiny85) is reset, then it goes to sleep. Much simpler than using an interrupt to detect a button.

Anyway, please see the attached piece of code and tell me if:

  • I'm doing it correctly (the right order)
  • My assumptions about "useless" parts are correct - can they be removed?
  • I've missed any power saving functions that I SHOULD be using.
// low power settings based on Nick Gammon's info:
// http://www.gammon.com.au/power
int main (void)
{
    IO_DDR = 0x00; // all pins inputs
    IO_OUT = 0x00; // disable pullups

    timerInit (IR_FREQ); // setup 8 bit timer for IR carrier frequency
    sendCmd (shutter, 3); // data, repeat 3 times

    wdt_reset(); // reset watchdog (useless?)
    wdt_disable(); // disable it (useless? WDT already disabled in hfuse)

    ADCSRA = 0x00; // disable ADC (important: this MUST come before PRR)
    power_all_disable(); // power off everything (does nothing in PWR_DOWN mode??)

    set_sleep_mode (SLEEP_MODE_PWR_DOWN); // set full power down mode
    cli(); // disable interrupts
    sleep_enable(); // enable sleep mode
    sleep_bod_disable(); // disable brown-out detector (useless? BOD already disabled in hfuse)
    sei(); // enable interrupts (necessary? we activate via reset)
    sleep_cpu(); // MUST do sleep_cpu directly after brown-out disable
}

Input will be appreciated!

(edit to add): Note most pins have external pullups (except the crystal pins - which has a 1 meg across, a 16.000 crystal across and 18 pf from each to ground). One pin has an external pull DOWN and is also connected to the base of a little TO-92 BJT base through a 220 ohm.

I thought I might share Arduino Power Saving Tutorial: Clock Pre-Scale and Sleep with you. I tend to do better with visuals. I had this bookmarked and I believe it is what you are doing. He adjusts the clock for more power saving as well, but he uses the reset button to wake and show info on a display then goes to sleep again. He also goes through the some of atmel datasheet. I used it as a guide. AFAIK my sketch works fine, but my multimeter is no good for checking amps.