Exemplo n.º 1
0
/*********************************************************************
*
*       MainTask
*/
void MainTask(void) {
  #ifdef WIN32
    WSADATA WSAData;
  #endif
  double lon  =  6.9158935; // Longitude
  double lat  = 51.1793436; // Latitude
  int x, y, Zoom;

  GUI_Init();
  #ifdef WIN32
    WSACleanup();
    if (WSAStartup(MAKEWORD(2,0), &WSAData) != 0) {
      return;
    }
  #else
    IP_Init();
    IP_AddLogFilter(IP_MTYPE_APPLICATION);
    _IFaceId = IP_INFO_GetNumInterfaces() - 1;                               // Get the last registered interface ID as this is most likely the interface we want to use in this sample.
    OS_SetPriority(OS_GetTaskID(), TASK_PRIO_IP_TASK);                       // For now, this task has highest prio except IP management tasks.
    OS_CREATETASK(&_IPTCB, "IP_Task", IP_Task, TASK_PRIO_IP_TASK, _IPStack); // Start the IP_Task.
    IP_Connect(_IFaceId);                                                    // Connect the interface if necessary.
    OS_SetPriority(OS_GetTaskID(), TASK_PRIO_IP_CLIENT);                     // Important: Client task priority must be less than priority of IP task!!!
    while (IP_IFaceIsReadyEx(_IFaceId) == 0) {
      OS_Delay(50);
    }
  #endif
  Zoom = 16;
  x = _Long2TileX(lon, Zoom);
  y = _Lat2TileY(lat, Zoom);
  _TileScreen(x, y, Zoom);
  while(1) {
    GUI_Delay(20);
  }
}
Exemplo n.º 2
0
void FTPServerTask(void) {
  while (IP_IFaceIsReady() == 0) {
    OS_Delay(50);
  }
  OS_SetPriority(OS_GetTaskID(), TASKPRIO_FTPSPARENT);                                  // This task has highest prio!
  OS_SetTaskName(OS_GetTaskID(), "IP_FTP_Server");
  _FTPServerParentTask();
}
Exemplo n.º 3
0
void MainTask(void) {

    USBH_Init();
    OS_SetPriority(OS_GetTaskID(), TASK_PRIO_APP);                                       // This task has highest prio for real-time application
    OS_CREATETASK(&_TCBMain, "USBH_Task", USBH_Task, TASK_PRIO_USBH_MAIN, _StackMain);   // Start USBH main task
    OS_CREATETASK(&_TCBIsr, "USBH_isr", USBH_ISRTask, TASK_PRIO_USBH_ISR, _StackIsr);    // Start USBH main task
    USBH_HID_Init();
    while (1) {
        BSP_ToggleLED(1);
        if (USBH_HID_GetNumDevices(NULL, 0)) {
            USBH_HID_HANDLE hDevice;
            USBH_HID_DEVICE_INFO aDevInfo[20];
            unsigned NumItems = COUNTOF(_aReportInfo);

            USBH_HID_GetNumDevices(aDevInfo, COUNTOF(aDevInfo));
            hDevice = USBH_HID_Open("hid000");
            if (hDevice) {
                USBH_HID_GetReportDescriptorParsed(hDevice, &_aReportInfo[0], &NumItems);
                USBH_HID_GetReport(hDevice, _aReport, sizeof(_aReport), NULL, NULL);
                USBH_HID_Close(hDevice);
            }
        }
        OS_Delay(100);
    }
}
Exemplo n.º 4
0
void MainTask(void) {
  IP_Init();
  OS_SetPriority(OS_GetTaskID(), 255);                                 // This task has highest prio for real-time application
  OS_CREATETASK(&_TCB,       "IP_Task", IP_Task, 150, _Stack);         // Start the IP task
  OS_CREATETASK(&_TCBMailer, "Mailer",  _Mailer, 100, _StackMailer);   // Start the mailer
  while (1) {
    BSP_ToggleLED(1);
    if (IP_GetCurrentLinkSpeed() == 0) {
      OS_Delay(50);
    } else {
      OS_Delay (200);
    }
  }
}
Exemplo n.º 5
0
void MainTask(void) {
  BSP_ClrLED(0);
  BSP_ClrLED(1);
  BSP_ClrLED(2);
  IP_Init();
  OS_SetPriority(OS_GetTaskID(), 255);
  OS_CREATETASK(&_TCBIP       , "IP_Task"  , IP_Task  , 150, _StackIP);
#if USE_RX_TASK
  OS_CREATETASK(&_TCBIPRx     , "IP_RxTask", IP_RxTask, 250, _StackIPRx);
#endif
  OS_CREATETASK_EX(&_TCBClient, "Client"   ,  _Client , 100, _StackClient, NULL);
  while (1) {
    BSP_ToggleLED(2);
    OS_Delay (200);
  }
}
Exemplo n.º 6
0
void MainTask(void) {
  IP_Init();
  OS_SetPriority(OS_GetTaskID(), 255);                                      // This task has highest prio for real-time application
  OS_CREATETASK(&_TCB     , "IP_Task"  , IP_Task       , 150, _Stack);      // Start the IP task
#if USE_RX_TASK
  OS_CREATETASK(&_IPRxTCB , "IP_RxTask", IP_RxTask     , 140, _IPRxStack);  // Start the IP_RxTask, optional.
#endif
  OS_CREATETASK(&_TCBShell, "Shell"    , IP_ShellServer, 100, _StackShell); // Start the shell server

  while (IP_IFaceIsReady() == 0) {
    OS_Delay(50);
  }
  while (1) {
    BSP_ToggleLED(1);
    OS_Delay (200);
  }
}
Exemplo n.º 7
0
U32  GUI_X_GetTaskId(void) { return (U32)OS_GetTaskID(); }