#include <ctl_api.h>

CTL_TASK_t main_task, new_task;

#define CALLSTACKSIZE 16
#define STACKSIZE 64          
unsigned new_task_stack[STACKSIZE];

void 
new_task_code(void *p)
{  
  unsigned int v=0;
  while (1)
    {      
      // task logic goes here      
      v++;
    }  
}

void
ctl_handle_error(CTL_ERROR_CODE_t e)
{
  while (1);
}

int main(void)
{
  unsigned int v=0;
  ctl_task_init(&main_task, 0, "main");
  start_timer();
  ctl_task_run(&new_task, 1, new_task_code, 0, "new_task", STACKSIZE, new_task_stack, CALLSTACKSIZE);
  while (1)
    {    
      // power down can go here if supported      
      v++;
    }
  return 0;
}
