示例#1
0
void Clock::sleep()
{
  if(!sleepOk) sleep_time = 0; else if(!sleepWasOk) awake();
  sleepWasOk = sleepOk;
  if(sleepOk && sleep_time >= (uint16_t) conf.sysOffTime * 10)
  {
//    lcd.off();
/*    attachInterrupt(1,wakeupFunction,LOW);
    sleep_mode();
    detachInterrupt(1);*/
    hardware_off();
    awake();
    wasSleeping = 1;
  }
  else if(backlightVal == 0 && light_time >= (uint16_t) conf.lcdBacklightTime * 10)
  {
    backlightVal = lcd.getBacklight();
    lcd.backlight(0);
  }
  if(hardware_flashlightIsOn())
  {
    if(flashlight_time >= (uint16_t) conf.flashlightOffTime * 10)
    {
      hardware_flashlight(0);
    }
  }
  else
  {
    flashlight_time = 0;
  }
}
void hardware_flashlight_toggle()
{
    if(hardware_flashlightIsOn())
    {
        hardware_flashlight(0);
    }
    else
    {
        hardware_flashlight(1);
    }
}