/* Delete the timer that was created by osTimerCreate.  */
osStatus_t osTimerDelete(osTimerId_t timer_id)
/* Delete the timer that was created by osTimerCreate.  */
osStatus_t osTimerDelete(osTimerId_t timer_id)
{
	struct cv2_timer *timer = (struct cv2_timer *) timer_id;
	if (timer == NULL) {
		return osErrorParameter;
	}
	if (k_is_in_isr()) {
		return osErrorISR;
	}
	if (timer->status == ACTIVE) {
		k_timer_stop(&timer->z_timer);
		timer->status = NOT_ACTIVE;
	}
	k_mem_slab_free(&cv2_timer_slab, (void *)timer);
	return osOK;
}