Code

Copy-paste the following setup code to your user application:
bool volatile freqm_read_done = false;

void configure_freqm(void);
void configure_freqm_callback(void);
void freqm_complete_callback(void);

/* FREQM module software instance (must not go out of scope while in use) */
static struct freqm_module freqm_instance;

void configure_freqm(void)
{
    /* Create a new configuration structure for the FREQM settings
     * and fill with the default module settings. */
    struct freqm_config config_freqm;
    freqm_get_config_defaults(&config_freqm);
    config_freqm.ref_clock_circles = 255;

    /* Alter any FREQM configuration settings here if required */

    /* Initialize FREQM with the user settings */
    freqm_init(&freqm_instance, FREQM, &config_freqm);
}

void freqm_complete_callback(void)
{
    freqm_read_done = true;
}

void configure_freqm_callback(void)
{
    freqm_register_callback(&freqm_instance, freqm_complete_callback,
            FREQM_CALLBACK_MEASURE_DONE);
    freqm_enable_callback(&freqm_instance, FREQM_CALLBACK_MEASURE_DONE);
}
Add to user application initialization (typically the start of main()):
system_init();
configure_freqm();
configure_freqm_callback();

freqm_enable(&freqm_instance);