
#include "globals.h"

U32 mpoolCom[500];
U32 ADC_Calc_Stack[500];				 // Stack for the ADC_Calc_Task


OS_TID idLED_Task;                       /* assigned task id of task: LED_Task    */
OS_TID idButton_Task;                    /* assigned task id of task: Button_Task */
OS_TID idADC_Sample_Task;                /* assigned task id of task: ADC_Task    */
OS_TID idUART_Task;                      /* assigned task id of task: UART_Task   */
OS_TID idADC_Calc_Task;					 /* assigned task id of task: ADC_Calc_Task */
OS_TID idADC_Sample_Task;


/*----------------------------------------------------------------------------
 *        Task 'init': Initialize
 *---------------------------------------------------------------------------*/
__task void init (void) {
    _init_box	(mpoolCom, sizeof(mpoolCom), 125);

    idLED_Task    = os_tsk_create (LED_Task, 20);	      /* create instance of task: LED_Task       */
    idUART_Task   = os_tsk_create (UART_Task, 10);		  /* create instance of task: UART_Task      */
    idButton_Task = os_tsk_create (Button_Task, 30);	  /* create instance of task: Button_Task    */
    idADC_Calc_Task = os_tsk_create_user (ADC_Calc_Task, 1, &ADC_Calc_Stack, sizeof(ADC_Calc_Stack));	  /* create instance of task: ADC_Calc_Task  */
    idADC_Sample_Task =  os_tsk_create (ADC_Sample_Task, 50);	  /* create instance of task: ADC_Sample_Task*/
														 
    os_tsk_delete_self ();							      /* remove instance of task: init           */
}

/*----------------------------------------------------------------------------
 *        Main: Initialize and start RTX Kernel
 *---------------------------------------------------------------------------*/
int main (void) {

    InitHAL   ();                             /* initialize clocks             */
    InitGPIO  ();							  /* initialize GPIO               */
    InitADC   ();						      /* initialize ADC                */
    InitSerial();							  /* initialize Serial             */

    os_sys_init (init);                       /* Initialize RTX and start init */
}

/*----------------------------------------------------------------------------
 * end of file
 *---------------------------------------------------------------------------*/

