diff --git a/Helios.cpp b/Helios.cpp index a2396682..bc0f4519 100644 --- a/Helios.cpp +++ b/Helios.cpp @@ -85,6 +85,9 @@ bool Helios::init() #elif F_CPU == 8000000L // 1ms at 8mhz clock with prescaler of 64 OCR0A = 124; +#elif F_CPU == 1000000L + // 1ms at 1mhz clock with prescaler of 64 + OCR0A = 15; // Adjusted value for 1 MHz clock #endif TIMSK |= (1 << OCIE0A); // Start timer with prescaler of 64 @@ -92,6 +95,7 @@ bool Helios::init() // enable interrupts sei(); #endif + return true; } @@ -125,8 +129,6 @@ void Helios::tick() void Helios::enter_sleep() { #ifdef HELIOS_EMBEDDED - // init the output pins to prevent any floating pins - clear_output_pins(); // Enable wake on interrupt for the button Button::enableWake(); // Set sleep mode to POWER DOWN mode @@ -143,15 +145,6 @@ void Helios::enter_sleep() #endif } -#ifdef HELIOS_EMBEDDED -void Helios::clear_output_pins() { - // Set all pins to output - DDRB = 0xFF; - // Set all pins low - PORTB = 0x00; -} -#endif - void Helios::wakeup() { #ifdef HELIOS_EMBEDDED // nothing needed here, this interrupt firing will make the mainthread resume diff --git a/Helios.h b/Helios.h index 2e6a06e0..d22a0fdf 100644 --- a/Helios.h +++ b/Helios.h @@ -65,10 +65,6 @@ class Helios static void save_global_flags(); static void show_selection(RGBColor color); -#ifdef HELIOS_EMBEDDED - static void clear_output_pins(); -#endif - enum State : uint8_t { STATE_MODES, STATE_COLOR_SELECT_SLOT, diff --git a/Makefile b/Makefile index c401e37b..9a8d4bc5 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ $(TARGET).elf: $(OBJS) %.o: %.cpp $(CC) $(CFLAGS) -c $< -o $@ -upload: $(TARGET).hex +upload: set_fuses $(TARGET).hex $(AVRDUDE) $(AVRDUDE_FLAGS) -Uflash:w:$(TARGET).hex:i upload_eeprom: $(TARGET).eep @@ -155,8 +155,8 @@ install: @echo "Download and extraction complete. You'll find the toolchain and pack files in $(INSTALL_DIR)" endif -set_16mhz_fuses: - $(AVRDUDE) $(AVRDUDE_FLAGS) -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xff:m +set_fuses: + $(AVRDUDE) $(AVRDUDE_FLAGS) -U lfuse:w:0xe1:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m set_default_fuses: $(AVRDUDE) $(AVRDUDE_FLAGS) -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m