/* Read the measurement data result. 
Reads the measurement data result. */
enum freqm_status freqm_get_result_value(struct freqm_module *const module_inst, uint32_t *result)
/* Read the measurement data result. 
Reads the measurement data result. */
enum freqm_status freqm_get_result_value(struct freqm_module *const module_inst, uint32_t *result)
{
	Assert(module_inst);
	Assert(module_inst->hw);
	Assert(result);
	Freqm *const freqm_hw = module_inst->hw;
	uint32_t result_cal;
	*result = result_cal= 0;
	if (freqm_hw->STATUS.reg & FREQM_STATUS_BUSY) {
		return FREQM_STATUS_MEASURE_BUSY;
	} else {
		if (freqm_hw->STATUS.reg & FREQM_STATUS_OVF) {
			return FREQM_STATUS_CNT_OVERFLOW;
		} else {
			result_cal = freqm_hw->VALUE.reg;
			freqm_hw->INTFLAG.reg = FREQM_INTFLAG_DONE;
			*result = result_cal * module_inst->ref_clock_freq / freqm_hw->CFGA.reg;
			return FREQM_STATUS_MEASURE_DONE;
		}
	}
}