]> www.fi.muni.cz Git - tinyboard.git/commitdiff
power off by default, power on/off with button
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 May 2013 22:09:32 +0000 (00:09 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 1 May 2013 22:09:32 +0000 (00:09 +0200)
projects/step-up/adc.c
projects/step-up/control.c
projects/step-up/main.c
projects/step-up/pwm.c

index b8c253e24af5f84eba25e4334df7afcbddaec372..326588a1253d5dc8cbba468d918cf87432852e08 100644 (file)
@@ -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;
index f6272622ef64f1ced964dfb883465daeed85e210..c8c38cd0b41ae075ce5e7a95a95f3199f6b6499c 100644 (file)
@@ -77,8 +77,7 @@ void short_press()
 
 void long_press()
 {
-       e.shutdown_in_progress = 0;
-       pattern_reload();
+       power_down();
 }
 
 pattern_t *pwmled_pattern_select()
index 383aa5eed990ead218315efe687846100b1f3df0..69657a8a70052d37b5b4cdd1545febfeba8ad456 100644 (file)
@@ -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
index 18a14253552a7c7628f1dc9dde24e1512af83437..e3b477c26b34345e4316c5e846796fbd8f11b313 100644 (file)
@@ -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()
 {