Jump to main content
9.2.1.3 Workflow
Create an FREQM device instance struct, which will be associated with an FREQM peripheral hardware instance.
static
struct
freqm_module freqm_instance;
Note: Device instance structures shall never go out of scope when in use.
Create a new function
configure_freqm() , which will be used to configure the overall FREQM peripheral.
void
configure_freqm(
void
)
Create an FREQM peripheral configuration structure that will be filled out to set the module configuration.
struct
freqm_config config_freqm;
Fill the FREQM peripheral configuration structure with the default module configuration values.
freqm_get_config_defaults(&config_freqm);
config_freqm.ref_clock_circles = 255 ;
Initialize the FREQM peripheral and associate it with the software instance structure that was defined previously.
freqm_init(&freqm_instance, FREQM, &config_freqm);
Create a new callback function.
void
freqm_complete_callback(
void
)
{
freqm_read_done =
true
;
}
Create a callback status software flag.
bool
volatile
freqm_read_done =
false
;
Let the callback function set the flag to true when read job done.
freqm_read_done =
true
;
Create a new function
configure_freqm_callback() , which will be used to configure the callbacks.
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);
}
Register callback function.
freqm_register_callback(&freqm_instance, freqm_complete_callback,
FREQM_CALLBACK_MEASURE_DONE);
Enable the callbacks.
freqm_enable_callback(&freqm_instance, FREQM_CALLBACK_MEASURE_DONE);
Enable the now initialized FREQM peripheral.
freqm_enable(&freqm_instance);
Note: This should not be done until after the FREQM is setup and ready to be used.
The online versions of the documents are provided as a courtesy. Verify all content and data in the device’s PDF documentation found on the device product page.