Ejemplo n.º 1
0
void APL_TaskHandler(void)
{
	static int init_done = 0;
	if(init_done == 0)
	{	
		/* Init Led */
		init_led();
		
		/* Init Serial Interface for debug */ 
		initSerialInterface();          	
		
		
		DDRD = 0x0F;
		PORTD = 0x0F;
		
		bouttonsTimer.interval = 400L;
		bouttonsTimer.mode     = TIMER_REPEAT_MODE;
		bouttonsTimer.callback = bouttons_task;
		HAL_StartAppTimer(&bouttonsTimer);
		
		init_done = 1;
		uprintf("test_bouttons : init done\r\n");
	}
	SYS_PostTask(APL_TASK_ID);
}
Ejemplo n.º 2
0
/**************************************************************************//**
\brief BSP task handler.
******************************************************************************/
void BSP_TaskHandler(void)
{
#if APP_DISABLE_BSP != 1
  if (bspTaskFlags & BSP_BUTTONS)
  {
    bspTaskFlags &= ~BSP_BUTTONS;
    bspButtonsHandler();
  }
#endif //APP_DISABLE_BSP != 1
  if (bspTaskFlags & BSP_TEMPERATURE)
  {
    bspTaskFlags &= (~BSP_TEMPERATURE);
    bspTemperatureSensorHandler();
  }
  if (bspTaskFlags & BSP_LIGHT)
  {
    bspTaskFlags &= (~BSP_LIGHT);
    bspLightSensorHandler();
  }
  if (bspTaskFlags & BSP_BATTERY)
  {
    bspTaskFlags &= (~BSP_BATTERY);
    bspEmptyBatteryHandler();
  }
  if (bspTaskFlags)
    SYS_PostTask(BSP_TASK_ID);
}
/**************************************************************************//**
\brief BSP task handler.
******************************************************************************/
void BSP_TaskHandler(void)
{
#if APP_DISABLE_BSP != 1
  if (bspTaskFlags & BSP_JOYSTICK)
  {
    bspTaskFlags &= ~BSP_JOYSTICK;
    bspJoystickHandler();
  }
#endif //APP_DISABLE_BSP != 1
  if (bspTaskFlags & BSP_TEMPERATURE)
  {
    bspTaskFlags &= (~BSP_TEMPERATURE);
    bspTemperatureSensorHandler();
  }
  if (bspTaskFlags & BSP_LIGHT)
  {
    bspTaskFlags &= (~BSP_LIGHT);
    bspLightSensorHandler();
  }
  if (bspTaskFlags & BSP_BATTERY)
  {
    bspTaskFlags &= (~BSP_BATTERY);
    bspEmptyBatteryHandler();
  }
  if (bspTaskFlags)
  {
    SYS_PostTask(BSP_TASK_ID);
  }
}
Ejemplo n.º 4
0
void APL_TaskHandler(void)
{
	switch (network_get_state())
	{
		case APP_INITIAL_STATE:
			
			/* Init Led */
			init_led();
			
			/* Init Serial Interface for debug */ 
  			initSerialInterface();          
			
			uid = get_uid();
			
			/* Init network */
			uid = 2;
			network_init(uid);
			
 			network_set_state(APP_NETWORK_JOIN_REQUEST);
			break;
		case APP_NETWORK_JOIN_REQUEST:
			
			/* Activate the network status led blink */
			led_start_blink();
			
			/* St	art network */
			network_start();
			
			network_set_state(APP_NETWORK_JOINING_STATE);
			
		case APP_NETWORK_JOINING_STATE:
			break;
		case APP_NETWORK_LEAVING_STATE:
			break;
		case APP_NETWORK_JOINED_STATE:
			led_stop_blink();
			break;
		default:
			break;
	}
	SYS_PostTask(APL_TASK_ID);
}
Ejemplo n.º 5
0
static void appZdoStartNetworkConf(ZDO_StartNetworkConf_t *startInfo)
{
    /*
    switch (startInfo->status)
    {
    	case 0:
    	PRINT("appZdoStartNetworkConf 0\n");
    	break;

    	case 1:
    	PRINT("appZdoStartNetworkConf 1\n");
    	break;

    	case 2:
    	PRINT("appZdoStartNetworkConf 2\n");
    	break;

    	case 3:
    	PRINT("appZdoStartNetworkConf 3\n");
    	break;

    	case 4:
    	PRINT("appZdoStartNetworkConf 4\n");
    	break;

    	case 5:
    	PRINT("appZdoStartNetworkConf 5\n");
    	break;

    	case 6:
    	PRINT("appZdoStartNetworkConf 6\n");
    	break;

    	case 7:
    	PRINT("appZdoStartNetworkConf 7\n");
    	break;

    	case 8:
    	PRINT("appZdoStartNetworkConf 8\n");
    	break;

    	case 9:
    	PRINT("appZdoStartNetworkConf 9\n");
    	break;

    	case 10:
    	PRINT("appZdoStartNetworkConf 10\n");
    	break;

    	case 11:
    	PRINT("appZdoStartNetworkConf 11\n");
    	break;

    	case 12:
    	PRINT("appZdoStartNetworkConf 12\n");
    	break;

    	case 13:
    	PRINT("appZdoStartNetworkConf 13\n");
    	break;

    	case 14:
    	PRINT("appZdoStartNetworkConf 14\n");
    	break;

    	case 15:
    	PRINT("appZdoStartNetworkConf 15\n");
    	break;

    	case 16:
    	PRINT("appZdoStartNetworkConf 16\n");
    	break;

    	case 17:
    	PRINT("appZdoStartNetworkConf 17\n");
    	break;

    	case 18:
    	PRINT("appZdoStartNetworkConf 18\n");
    	break;

    	case 19:
    	PRINT("appZdoStartNetworkConf 19\n");
    	break;

    	case 231:
    	PRINT("appZdoStartNetworkConf 231\n");
    	break;

    	case 232:
    	PRINT("appZdoStartNetworkConf 232\n");
    	break;

    	case 233:
    	PRINT("appZdoStartNetworkConf 233\n");
    	break;

    	case 234:
    	PRINT("appZdoStartNetworkConf 234\n");
    	break;

    	case 255:
    	PRINT("appZdoStartNetworkConf 255\n");
    	break;

    	default:
    	if(startInfo->status < 232)
    		PRINT("<50\n");
    	else
    		PRINT(">50\n");
    	break;
    }*/

    sprintf(buf,"appZdoStartNetworkConf STATUS:0x%X PANId:0x%X ADDRESS:0x%X CHANNEL:0x%X\r\n", startInfo->status, startInfo->PANId, startInfo->shortAddr, startInfo->activeChannel);
    HAL_WriteUsart(&usart,&buf,strlen(buf));

    if(startInfo->status == ZDO_SUCCESS_STATUS)
    {
        appState = APP_IN_NETWORK_STATE;

        SYS_PostTask(APL_TASK_ID);
    }
}