/* Calibrate for too-slow or too-fast oscillator. 
If no correction is needed, set value to zero. */
enum status_code rtc_count_frequency_correction(struct rtc_module *const module, const int8_t value)
/* Calibrate for too-slow or too-fast oscillator. 
If no correction is needed, set value to zero. */
enum status_code rtc_count_frequency_correction(struct rtc_module *const module, const int8_t value)
{
	Assert(module);
	Assert(module->hw);
	Rtc *const rtc_module = module->hw;
	if (abs(value) > 0x7F) {
		return STATUS_ERR_INVALID_ARG;
	}
	uint32_t new_correction_value;
	new_correction_value = abs(value);
	if (value < 0) {
		new_correction_value |= RTC_FREQCORR_SIGN;
	}
	while (rtc_count_is_syncing(module)) {
	}
	rtc_module->MODE0.FREQCORR.reg = new_correction_value;
	return STATUS_OK;
}