Code

Copy-paste the following setup code to your user application:
void configure_non_inverting_pga_opamp0(void)
{
    struct opamp0_config conf;

    opamp_module_init();

    opamp0_get_config_defaults(&conf);

    /* Set the the OPAMP0 as "Non-Inverting PGA" mode. */
    conf.negative_input = OPAMP0_NEG_MUX_TAP0;
    conf.positive_input = OPAMP0_POS_MUX_PIN0;
    conf.r1_connection = OPAMP0_RES1_MUX_GND;
    conf.config_common.r1_enable = true;
    conf.config_common.r2_out = true;

    /* Set up OA0NEG pin and OA0OUT pin. */
    struct system_pinmux_config opamp0_neg_pin_conf;
    system_pinmux_get_config_defaults(&opamp0_neg_pin_conf);
    opamp0_neg_pin_conf.direction    = SYSTEM_PINMUX_PIN_DIR_INPUT;
    opamp0_neg_pin_conf.mux_position = MUX_PA06B_OPAMP_OAPOS0;
    system_pinmux_pin_set_config(PIN_PA06B_OPAMP_OAPOS0, &opamp0_neg_pin_conf);
    struct system_pinmux_config opamp0_out_pin_conf;
    system_pinmux_get_config_defaults(&opamp0_out_pin_conf);
    opamp0_out_pin_conf.direction    = SYSTEM_PINMUX_PIN_DIR_OUTPUT;
    opamp0_out_pin_conf.mux_position = MUX_PA07B_OPAMP_OAOUT0;
    system_pinmux_pin_set_config(PIN_PA07B_OPAMP_OAOUT0, &opamp0_out_pin_conf);

    opamp0_set_config(&conf);
    opamp_enable(OPAMP_0);

    /* Wait for the output ready. */
    while(!opamp_is_ready(OPAMP_0));
}
Add to user application initialization (typically the start of main()):
configure_non_inverting_pga_opamp0();