+/*
+ * OVERVIEW
+ *
+ * Powering up:
+ * Immediately after reset, we power down the entire system.
+ * We wake up only after the button is pressed for a sufficiently long time.
+ *
+ * Heater output:
+ * The heater output is driven by Timer/Counter 1 in PWM mode.
+ * We want to be able to measure the battery voltage both when the
+ * output is on, and when the output is off. So we set the T/C1 clock
+ * prescaler so that the T/C1 is slow enough, we enable the T/C1 interrupts
+ * both on compare match and on overflow. After the interrupt, we trigger
+ * the battery voltage measurement with ADC.
+ *
+ * ADC:
+ * To avoid transients, we measure each battery state (when the heater is on
+ * and when it is off) separately, and we drop the first few readings.
+ * We calculate a running average of the readings to achieve higher accuracy.
+ *
+ * Buttons:
+ * There are two buttons (+ and -). Any button can wake the system up from
+ * the power-down state.
+ * TODO: When the system is woken up by the "-" button,
+ * it starts with the minimum output power, when it is woken up by the "+"
+ * button, it start with the maximum output power.
+ * When running, the "-" button is used for decreasing the output power,
+ * the "+" button is for increasing it.
+ * When on the lowest power state, the "-" button switches the system off.
+ * TODO: Long "-" button press switches the system off, long "+" button
+ * press sets the output power to maximum.
+ *
+ * Status LED:
+ * When powering up by a button press, the LED goes on to provide a visual
+ * feedback, and is switched off after the button is released.
+ * TODO: After a button press, the # of blinks of the LED reflects the
+ * chosen output power level for some time. Afterwards, it displays
+ * the battery level.
+ * TODO: When the battery is completely exhausted, the output power is switched
+ * off, the LED keeps blinking for some time, and then the whole system is
+ * switched off to avoid deep discharge of the battery.
+ *
+ * Timing:
+ * The firmware is timed by the Watchdog Timer interrupt. Most of the
+ * processing is done from the main loop, IRQs only set various flags
+ * or trigger other events.
+ */
+