drivers: timer: nrf_rtc_timer: Add clearing of previous CC event

Added clearing of CC event which may occure due to previous
CC value which was closed to current counter value.

Fixed int_mask initialization.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c
index 87dd2c5..1ff6053 100644
--- a/drivers/timer/nrf_rtc_timer.c
+++ b/drivers/timer/nrf_rtc_timer.c
@@ -160,12 +160,11 @@
 	uint32_t cc_val = abs_val & COUNTER_MAX;
 	uint32_t prev_cc = get_comparator(chan);
 
-
 	do {
 		now = counter();
 
 		/* Handle case when previous event may generate an event.
-		 * It is handled by setting CC to now (that's furtherst future),
+		 * It is handled by setting CC to now (far in the future),
 		 * in case previous event was set for next tick wait for half
 		 * LF tick and clear event that may have been generated.
 		 */
@@ -174,6 +173,7 @@
 			k_busy_wait(15);
 		}
 
+
 		/* If requested cc_val is in the past or next tick, set to 2
 		 * ticks from now. RTC may not generate event if CC is set for
 		 * 1 tick from now.
@@ -182,6 +182,7 @@
 			cc_val = now + 2;
 		}
 
+		event_clear(chan);
 		event_enable(chan);
 		set_comparator(chan, cc_val);
 		now2 = counter();