Main Routine

In the beginning of your code, a result buffer for the ADC conversion and the conversion complete-flag should be defined globally.
/* Buffer for ADC sample storage */
#define ADC_SAMPLES 128
uint16_t adc_result_buffer[ADC_SAMPLES];

/* ADC interrupt flag */
volatile bool adc_read_done = false;
In the main function, the OPAMP and ADC modules are initialized and enabled using the defined configuration functions. After running the configuration functions for the OPAMP and ADC modules, it remaines to enable global interrupts and start the first ADC sampling. The adc_read_buffer_job() function handles the read buffer interrupts and excecutes ADC_SAMPLES number of samples before calling the user-defined callback routine.
/* Enable global interrupts */
system_interrupt_enable_global();

/* Start ADC conversion */
adc_read_buffer_job(&adc_instance, adc_result_buffer, ADC_SAMPLES);
After the ADC sampling is initiated, the processor is available to perform other tasks. The ADC will interrupt when the conversion is complete. In the following main function, the application enters a while loop and waits for the ADC callback.
/* Main function */
int main(void)
{
	system_init();
	
	/* Initialize OPAMP2 and ADC */
	configure_opamp2();
	configure_adc();
	configure_adc_callbacks();
	
	/* Enable global interrupts */
	system_interrupt_enable_global();
	
	/* Start ADC conversion */
	adc_read_buffer_job(&adc_instance, adc_result_buffer, ADC_SAMPLES);
	
	while (adc_read_done == false) {
		/* Wait for asynchronous ADC read to complete */
	}
	
	while(true) {
		/* Do nothing */
	}
}
Note: The amplified signal voltage can be calculated from the ADC result buffer values according to: adc_result_buffer * V_REF / ADC_MAX_VALUE, where V_REF is the sampling voltage reference (ADC_REFERENCE_INTVCC1) and ADC_MAX_VALUE is 0xFFF for a 12-bit conversion.