Skip to content

Setup

Initialization Phase


Overview

setup() is executed once after power-up or reset.

Its task is to prepare the instrument before normal operation begins.

After setup() has finished, REVA enters the continuous runtime loop.


Responsibilities

The setup phase initializes:

  • GPIO direction,
  • output pins,
  • button inputs,
  • display system,
  • EEPROM-backed parameters,
  • packet library state,
  • Timer1 carrier engine,
  • Timer2 packet scheduler.

Initialization Flow

Power Applied
        ↓
Reset
        ↓
setup()
        ↓
GPIO Configuration
        ↓
EEPROM Loading
        ↓
Packet State Initialization
        ↓
Timer Initialization
        ↓
Display Startup
        ↓
Normal Operation

GPIO Initialization

The output pins are configured before waveform generation begins.

Pin Function
D9 OC1A
D10 OC1B

Button inputs and display lines are also prepared during this phase.


EEPROM Loading

Stored operating values may be loaded during startup.

This allows REVA to recover its previous operating state after reset.

EEPROM activity belongs to the slow domain and is not part of waveform generation.


Timer Initialization

The hardware timers are configured during setup.

Timer Function
Timer1 Carrier generation
Timer2 Packet scheduling

Once configured, timing-critical work is handled by the timer subsystem.


Design Philosophy

setup() establishes a known state.

Runtime behavior should not depend on undefined startup conditions.

This improves repeatability and makes the instrument easier to debug.


See Also