示例#1
0
文件: main.c 项目: RWTH-OS/HermitCore
int main(int argc, char *argv[])
{
    printf("hourglass\n");

    opt(argc, argv, &opts);
    init(&opts);

    report_params(&opts);

    setup(&opts);
    run(&opts, &results);
    setdown(&opts);

    report(&opts, &results);

    run_free(&opts, &results);

    deinit(&opts);

    return EXIT_SUCCESS;
}
示例#2
0
void getup()
{
    SetMotor_Code(1, 1, 0);
    SetMotor_Code(2, 1, 0);
    SetTenthS(2);
    SetMotor_Code(1, 0, 30);
    SetMotor_Code(2, 2, 30);
    SetThousandthS(5);
    SetMotor_Code(1, 1, 35);
    SetMotor_Code(2, 1, 35);
    SetTenthS(3);
    SetOneServo(_SERVOCTRL_ST_, 2, 150, 100);
    SetTenthS(10);
    SetOneServo(_SERVOCTRL_ST_, 2, 100, 500);
    SetTenthS(10);
    SetOneServo(_SERVOCTRL_ST_, 1, 156, 0);
    SetTenthS(3);
    SetOneServo(_SERVOCTRL_ST_, 2, 50, 800);
    SetTenthS(15);
    SetOneServo(_SERVOCTRL_ST_, 2, 49, 400);
    SetOneServo(_SERVOCTRL_ST_, 1, 180, 400);
    SetTenthS(8);
    setdown();
}
示例#3
0
int
main(int argc, char **argv)
{
   WNDCLASS            wc;
   RECT                rect;
   HINSTANCE           hinstance;
   MSG                 msg;
   HWND                window;
   LPDIRECTDRAW        object;
   LPDIRECTDRAWSURFACE surface_primary;
   LPDIRECTDRAWSURFACE surface_back;
   int                 depth;
   int                 running;
   int                 pause_me = 0;

   hinstance = GetModuleHandle(0);

   wc.style = 0;
   wc.lpfnWndProc = MainWndProc;
   wc.cbClsExtra = 0;
   wc.cbWndExtra = 0;
   wc.hInstance = hinstance;
   wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
   wc.hCursor = LoadCursor (NULL, IDC_ARROW);
   wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
   wc.lpszMenuName =  NULL;
   wc.lpszClassName = "Evas_Software_DDraw_Test";

   if(!RegisterClass(&wc)) return EXIT_FAILURE;

   rect.left = 0;
   rect.top = 0;
   rect.right = win_w;
   rect.bottom = win_h;
   AdjustWindowRect (&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE);

   window = CreateWindowEx(0,
			   "Evas_Software_DDraw_Test",
			   "Evas_Software_DDraw_Test",
			   WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
			   CW_USEDEFAULT, CW_USEDEFAULT,
                           rect.right - rect.left, rect.bottom - rect.top,
			   NULL, NULL, hinstance, NULL);
   if (!window) return EXIT_FAILURE;

   if (!_directdraw_init(window,
			 &object,
			 &surface_primary,
			 &surface_back,
			 &depth, win_w, win_h))
     return EXIT_FAILURE;

   ShowWindow(window, SW_SHOWDEFAULT);
   UpdateWindow(window);

   /* test evas_free....  :) */
   evas_init();
   evas = evas_new();
   evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
   evas_output_size_set(evas, win_w, win_h);
   evas_output_viewport_set(evas, 0, 0, win_w, win_h);
   {
      Evas_Engine_Info_Software_DDraw *einfo;

      einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(evas);

      /* the following is specific to the engine */
      einfo->info.window = window;
      einfo->info.object = object;
      einfo->info.surface_primary = surface_primary;
      einfo->info.surface_back = surface_back;
      einfo->info.depth = depth;
      einfo->info.rotation = 0;
      evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);
   }
   setup();
   printf("################ evas free\n");
   setdown();
   evas_free(evas);
   printf("evas freed. DONE\n");

   evas = evas_new();
   evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
   evas_output_size_set(evas, win_w, win_h);
   evas_output_viewport_set(evas, 0, 0, win_w, win_h);
   {
      Evas_Engine_Info_Software_DDraw *einfo;

      einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas);

      /* the following is specific to the engine */
      einfo->info.window = window;
      einfo->info.object = object;
      einfo->info.surface_primary = surface_primary;
      einfo->info.surface_back = surface_back;
      einfo->info.depth = depth;
      einfo->info.rotation = 0;
      evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);
   }
   setup();
   printf("################ evas free\n");
   setdown();
   evas_free(evas);
   printf("evas freed. DONE\n");

   evas = evas_new();
   evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
   evas_output_size_set(evas, win_w, win_h);
   evas_output_viewport_set(evas, 0, 0, win_w, win_h);
   {
      Evas_Engine_Info_Software_DDraw *einfo;

      einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas);

      /* the following is specific to the engine */
      einfo->info.window = window;
      einfo->info.object = object;
      einfo->info.surface_primary = surface_primary;
      einfo->info.surface_back = surface_back;
      einfo->info.depth = depth;
      einfo->info.rotation = 0;
      evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);
   }
   setup();
   printf("################ evas free\n");
   setdown();
   evas_free(evas);
   printf("evas freed. DONE\n");

   evas = evas_new();
   evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
   evas_output_size_set(evas, win_w, win_h);
   evas_output_viewport_set(evas, 0, 0, win_w, win_h);
   {
      Evas_Engine_Info_Software_DDraw *einfo;

      einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas);

      /* the following is specific to the engine */
      einfo->info.window = window;
      einfo->info.object = object;
      einfo->info.surface_primary = surface_primary;
      einfo->info.surface_back = surface_back;
      einfo->info.depth = depth;
      einfo->info.rotation = 0;
      evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);
   }
   setup();
   printf("################ evas free\n");
   setdown();
   evas_free(evas);
   printf("evas freed. DONE\n");

   evas = evas_new();
   evas_output_method_set(evas, evas_render_method_lookup("software_ddraw"));
   evas_output_size_set(evas, win_w, win_h);
   evas_output_viewport_set(evas, 0, 0, win_w, win_h);
   {
      Evas_Engine_Info_Software_DDraw *einfo;

      einfo = (Evas_Engine_Info_Software_DDraw *) evas_engine_info_get(evas);

      /* the following is specific to the engine */
      einfo->info.window = window;
      einfo->info.object = object;
      einfo->info.surface_primary = surface_primary;
      einfo->info.surface_back = surface_back;
      einfo->info.depth = depth;
      einfo->info.rotation = 0;
      evas_engine_info_set(evas, (Evas_Engine_Info *) einfo);
   }
   setup();
   orig_start_time = start_time = get_time();

   running = 1;
   while (running)
     {
        while (PeekMessage (&msg, window, 0, 0, PM_NOREMOVE))
	  {
	     int res;

	     res = GetMessage (&msg, NULL, 0, 0);
	     TranslateMessage (&msg);
	     DispatchMessage (&msg);
	     if (res == 0)
	       running = 0;
	  }
	if (!(pause_me == 1))
	  {
	     loop();
	     evas_render(evas);
	  }
     }

 exit:
   setdown();
   evas_free(evas);
   if (surface_primary)
     IDirectDrawSurface7_Release (surface_primary);
   if (object)
      IDirectDraw7_Release (object);
   evas_shutdown();

   return EXIT_SUCCESS;
}
示例#4
0
文件: ds.c 项目: good2000mo/JMC2014
void ds(unsigned int speed, double toAngle, double dcode)
{
    unsigned int s1 = 0;
    unsigned int s2 = 0;
    double code = 0;
    unsigned int b4 = 0;
    setdown();
    SetMotorCode0(2);
    SetMotor_Code(1, 0, speed);
    SetMotor_Code(2, 2, speed);
    while (1)
    {
        code = GetMotorCode(2);
        if ( (code/dcode)<=-toAngle )
        {
            break;
        }
        b4 = GetColorSensor(_COLOR_1_, 1, 4);
        if ( b4==3 )
        {
            getup();
            SetMotor_Code(1, 0, speed);
            SetMotor_Code(2, 2, speed);
        }
    }
    SetMotor_Code(1, 1, speed);
    SetMotor_Code(2, 1, speed);
    SetTenthS(2);
    SetMotor_Code(1, 2, speed);
    SetMotor_Code(2, 0, speed);
    while (1)
    {
        code = GetMotorCode(2);
        if ( (code/dcode)>=toAngle )
        {
            break;
        }
        b4 = GetColorSensor(_COLOR_1_, 1, 4);
        if ( b4==3 )
        {
            getup();
            SetMotor_Code(1, 2, speed);
            SetMotor_Code(2, 0, speed);
        }
    }
    SetMotorCode0(2);
    SetMotor_Code(1, 0, speed);
    SetMotor_Code(2, 2, speed);
    while (1)
    {
        code = GetMotorCode(2);
        if ( (code/dcode)<=-toAngle )
        {
            break;
        }
        b4 = GetColorSensor(_COLOR_1_, 1, 4);
        if ( b4==3 )
        {
            getup();
            SetMotor_Code(1, 0, speed);
            SetMotor_Code(2, 2, speed);
        }
    }
    SetMotor_Code(1, 1, speed);
    SetMotor_Code(2, 1, speed);
}