Configure two op amps with internal DACs and two ADC channels.
Set up a UART interface for data output and a timer to control the
sampling rate.
Power up the system and initialize DAC outputs to bias both op
amp stages into valid operating ranges.
Define system-specific parameters such as amplifier gains, ADC
thresholds, smoothing factor, and packet size in the customizable
features header file.
Measure the first-stage output voltage, estimate the DC
component using an EMA filter, and adjust the DAC to center the
signal around the ADC midpoint.
Use the outputs from both stages to compute the final cascaded
signal corresponding to the amplified input.
Monitor the second-stage output and adjust the DAC bias to keep
the signal within range and prevent clipping or saturation.
Package the final amplified value into a
4-byte frame and send over UART for external logging or
analysis.