Skip to content

Commit

Permalink
Saving
Browse files Browse the repository at this point in the history
  • Loading branch information
livingkurt committed Jan 19, 2024
1 parent 1879e41 commit 01aaed9
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,47 +1,14 @@
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>
#include <avr/io.h>
#include <avr/interrupt.h> // Include this for sei()


int main()
{

while (1)
{
// Disable the Watchdog Timer
MCUSR &= ~(1 << WDRF);
wdt_disable();
// Configure all I/O pins as input with pull-up enabled
DDRB = 0x00; // Set all pins on Port B as input
// PORTB = 0xFF; // Enable pull-up resistors on all Port B pins

// Disable digital input buffers
DIDR0 = 0xFF;

// Set the sleep mode to Power-down
// Set sleep mode to POWER DOWN mode
set_sleep_mode(SLEEP_MODE_PWR_DOWN);

// // Disable ADC
// ADCSRA &= ~(1 << ADEN);

// Activate PRR (Power Reduction Register)
PRR |= (1 << PRTIM1) | (1 << PRTIM0) | (1 << PRUSI) | (1 << PRADC);

// Disable the BOD
sleep_bod_disable();

// Enable global interrupts
sei();

// Put the device to sleep
// enter sleep
sleep_mode();

// The program will continue from here after wakeup

// Disable sleep mode
sleep_disable();
}
return 0;
}
Expand Down

0 comments on commit 01aaed9

Please sign in to comment.