/**
 * Generated by Eclipse Mita 0.1.0.
 * @date 2022-05-14 23:02:00
 */


#include <FreeRTOS.h>
#include <BCDS_Basics.h>
#include <BCDS_CmdProcessor.h>
#include <timers.h>
#include <BCDS_Retcode.h>
#include "MitaTime.h"
#include "SensorButton_two.h"
#include "SensorButton_one.h"
#include "MitaExceptions.h"
#include "MitaEvents.h"

static TimerHandle_t timerHandleEvery50Millisecond1;
static TimerHandle_t timerHandleEvery5Second1;
static TimerHandle_t timerHandleEvery100Millisecond1;
static TimerHandle_t timerHandleEvery5Millisecond1;
static TimerHandle_t timerHandleEvery5Minute1;

static void InternalHandleEvery50Millisecond1(TimerHandle_t xTimer)
{
	BCDS_UNUSED(xTimer);
	CmdProcessor_Enqueue(&Mita_EventQueue, HandleEvery50Millisecond1, NULL, 0);
}

static void InternalHandleEvery5Second1(TimerHandle_t xTimer)
{
	BCDS_UNUSED(xTimer);
	CmdProcessor_Enqueue(&Mita_EventQueue, HandleEvery5Second1, NULL, 0);
}

static void InternalHandleEvery100Millisecond1(TimerHandle_t xTimer)
{
	BCDS_UNUSED(xTimer);
	CmdProcessor_Enqueue(&Mita_EventQueue, HandleEvery100Millisecond1, NULL, 0);
}

static void InternalHandleEvery5Millisecond1(TimerHandle_t xTimer)
{
	BCDS_UNUSED(xTimer);
	CmdProcessor_Enqueue(&Mita_EventQueue, HandleEvery5Millisecond1, NULL, 0);
}

static void InternalHandleEvery5Minute1(TimerHandle_t xTimer)
{
	BCDS_UNUSED(xTimer);
	CmdProcessor_Enqueue(&Mita_EventQueue, HandleEvery5Minute1, NULL, 0);
}


Retcode_T SetupTime(void)
{
	
	timerHandleEvery50Millisecond1 = xTimerCreate("timerHandleEvery50Millisecond1", UINT32_C(50), pdTRUE, NULL, InternalHandleEvery50Millisecond1);
	
	timerHandleEvery5Second1 = xTimerCreate("timerHandleEvery5Second1", UINT32_C(5000), pdTRUE, NULL, InternalHandleEvery5Second1);
	
	timerHandleEvery100Millisecond1 = xTimerCreate("timerHandleEvery100Millisecond1", UINT32_C(100), pdTRUE, NULL, InternalHandleEvery100Millisecond1);
	
	timerHandleEvery5Millisecond1 = xTimerCreate("timerHandleEvery5Millisecond1", UINT32_C(5), pdTRUE, NULL, InternalHandleEvery5Millisecond1);
	
	timerHandleEvery5Minute1 = xTimerCreate("timerHandleEvery5Minute1", UINT32_C(300000), pdTRUE, NULL, InternalHandleEvery5Minute1);
	
	if(timerHandleEvery50Millisecond1 == NULL || timerHandleEvery5Second1 == NULL || timerHandleEvery100Millisecond1 == NULL || timerHandleEvery5Millisecond1 == NULL || timerHandleEvery5Minute1 == NULL)
	{
		return RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_OUT_OF_RESOURCES);
	}
	
	return NO_EXCEPTION;
}

Retcode_T EnableTime(void)
{
	Retcode_T result = NO_EXCEPTION;

	
	result = EveryHandleEvery50Millisecond1_Enable();
	if(result != NO_EXCEPTION)
	{
		return result;
	}
	
	result = EveryHandleEvery5Second1_Enable();
	if(result != NO_EXCEPTION)
	{
		return result;
	}
	
	result = EveryHandleEvery100Millisecond1_Enable();
	if(result != NO_EXCEPTION)
	{
		return result;
	}
	
	result = EveryHandleEvery5Millisecond1_Enable();
	if(result != NO_EXCEPTION)
	{
		return result;
	}
	
	result = EveryHandleEvery5Minute1_Enable();
	if(result != NO_EXCEPTION)
	{
		return result;
	}
	
	return NO_EXCEPTION;
}

Retcode_T EveryHandleEvery50Millisecond1_Enable(void)
{
	xTimerStart(timerHandleEvery50Millisecond1, 0);
	
	return NO_EXCEPTION;
}

Retcode_T EveryHandleEvery5Second1_Enable(void)
{
	xTimerStart(timerHandleEvery5Second1, 0);
	
	return NO_EXCEPTION;
}

Retcode_T EveryHandleEvery100Millisecond1_Enable(void)
{
	xTimerStart(timerHandleEvery100Millisecond1, 0);
	
	return NO_EXCEPTION;
}

Retcode_T EveryHandleEvery5Millisecond1_Enable(void)
{
	xTimerStart(timerHandleEvery5Millisecond1, 0);
	
	return NO_EXCEPTION;
}

Retcode_T EveryHandleEvery5Minute1_Enable(void)
{
	xTimerStart(timerHandleEvery5Minute1, 0);
	
	return NO_EXCEPTION;
}


