summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a366ae1)
- early HW setup, run once after reset, is moved to the first_boot()
function
- main loop iteration is in a separate function main_loop_iteration()
- both functions (and hw_suspend() as well) are made inline
set_sleep_mode(SLEEP_MODE_IDLE);
}
set_sleep_mode(SLEEP_MODE_IDLE);
}
-static void hw_suspend()
+static void inline hw_suspend()
{
susp_pwm();
susp_adc();
{
susp_pwm();
susp_adc();
+static void inline first_boot()
{
unsigned char mcusr_save;
{
unsigned char mcusr_save;
power_down(mcusr_save & _BV(WDRF));
sei();
power_down(mcusr_save & _BV(WDRF));
sei();
-#if 1
- while (1) {
- cli();
- if (TIMER1_IS_ON()) {
- set_sleep_mode(SLEEP_MODE_IDLE);
- } else if (adc_is_on) {
- set_sleep_mode(SLEEP_MODE_ADC);
- } else {
- set_sleep_mode(SLEEP_MODE_PWR_DOWN);
- }
- sleep_enable();
- // keep BOD active, no sleep_bod_disable();
- sei();
- sleep_cpu();
- sleep_disable();
+static void inline main_loop_iteration()
+{
+ cli();
+ if (TIMER1_IS_ON()) {
+ set_sleep_mode(SLEEP_MODE_IDLE);
+ } else if (adc_is_on) {
+ set_sleep_mode(SLEEP_MODE_ADC);
+ } else {
+ set_sleep_mode(SLEEP_MODE_PWR_DOWN);
+
+ sleep_enable();
+ // keep BOD active, no sleep_bod_disable();
+ sei();
+ sleep_cpu();
+ sleep_disable();
+}
+
+int main(void)
+{
+ first_boot();
+
+ while (1)
+ main_loop_iteration();