In this use case, the Frequency Meter (FREQM) module is configured for:
- The FREQM peripheral will not be stopped in standby sleep mode.
This use case will read measurement data in polling mode repeatly. After reading a data, the board LED will be toggled.
Setup
Prerequisites
There are no special setup requirements for this use-case.
Code
Copy-paste the following setup code to your user application:
void configure_freqm(void)
{
freqm_init(&freqm_instance, FREQM, &config_freqm);
}
Add to user application initialization (typically the start of main()
):
Workflow
- Create an FREQM device instance struct, which will be associated with a FREQM peripheral hardware 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.
- Fill the FREQM peripheral configuration structure with the default module configuration values.
- Initialize the FREQM peripheral and associate it with the software instance structure that was defined previously.
freqm_init(&freqm_instance, FREQM, &config_freqm);
- Enable the now initialized FREQM peripheral.
Implementation
Code
Copy-paste the following code to your user application:
uint32_t measure_result;
};
switch(status) {
LED_On(LED_0_PIN);
while (true) {
}
while (true) {
LED_Toggle(LED_0_PIN);
volatile uint32_t delay = 50000;
while(delay--) {
}
}
default:
break;
}
Workflow
- Start FREQM measurement and wait until measure done then read result data.
- The board LED is on to indicate a measurement data is read.
LED_On(LED_0_PIN);
while (true) {
}
- The board LED is toggle to indicate measurement is overflow.
while (true) {
LED_Toggle(LED_0_PIN);
volatile uint32_t delay = 50000;
while(delay--) {
}
}