/* Set the current count value to desired value. 
Sets the value of the counter to the specified value. */
enum status_code rtc_count_set_count(struct rtc_module *const module, const uint32_t count_value)
/* Set the current count value to desired value. 
Sets the value of the counter to the specified value. */
enum status_code rtc_count_set_count(struct rtc_module *const module, const uint32_t count_value)
{
	Assert(module);
	Assert(module->hw);
	Rtc *const rtc_module = module->hw;
	while (rtc_count_is_syncing(module)) {
	}
	switch(module->mode){
		case RTC_COUNT_MODE_32BIT:
			rtc_module->MODE0.COUNT.reg = count_value;
			break;
		case RTC_COUNT_MODE_16BIT:
			if(count_value > 0xffff){
				return STATUS_ERR_INVALID_ARG;
			}
			rtc_module->MODE1.COUNT.reg = (uint32_t)count_value;
			break;
		default:
			Assert(false);
			return STATUS_ERR_INVALID_ARG;
	}
	return STATUS_OK;
}