Commit 3e9d94b2 authored by Jan Kasprzak's avatar Jan Kasprzak
Browse files

power off by default, power on/off with button

parent ffb49825
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -120,21 +120,12 @@ void init_adc()
	start_next_adc();
}

#if 0
void susp_adc()
{
	ADCSRA = 0;
	DIDR0 = 0;
}

static void adc1_gain20_adc(uint16_t adcsum)
{
	// running average
	adc1_gain20_offset += adcsum
			- (adc1_gain20_offset >> ADC1_GAIN20_OFFSET_SHIFT);
}
#endif

static void inline adc_based_timer()
{
	static unsigned char count;
+1 −2
Original line number Diff line number Diff line
@@ -77,8 +77,7 @@ void short_press()

void long_press()
{
	e.shutdown_in_progress = 0;
	pattern_reload();
	power_down();
}

pattern_t *pwmled_pattern_select()
+2 −5
Original line number Diff line number Diff line
@@ -26,16 +26,14 @@ static void hw_setup()
	set_sleep_mode(SLEEP_MODE_IDLE);
}

#if 0
static void hw_suspend()
{
	susp_pwm();
	susp_adc();
	susp_tmr();
	susp_gpio();
	susp_buttons();

	wdt_disable();
	power_all_disable();
}

void power_down()
@@ -60,7 +58,6 @@ void power_down()
	// ok, so I will wake up
	hw_setup();
}
#endif

int main(void)
{
@@ -69,7 +66,7 @@ int main(void)
	log_set_state(3);

	hw_setup();
	// power_down(); - not while still debugging
	power_down();

	sei();
#if 1
+3 −9
Original line number Diff line number Diff line
@@ -39,22 +39,16 @@ void init_pwm()
	PORTB &= ~_BV(PB4); // set to zero
}

#if 0
void susp_pwm()
{
	unsigned char i;

	for (i = 0; i < N_PWMLEDS; i++)
		pwm[i] = 0;

	DDRB &= ~(_BV( PB1 ) | _BV( PB3 ) | _BV( PB5 ));
	TCCR1D = TCCR1C = TCCR1B = TCCR1A = 0;
	DDRB &= ~(_BV( PB4 ));
	PORTB &= ~(_BV( PB4 ));
	TCCR1 = 0;
	TIMSK = 0;
	TIFR = 0;

	PLLCSR &= ~(_BV(PLLE) | _BV(PCKE));
}
#endif

void pwm_off()
{