Esempio n. 1
0
File: app.c Progetto: rvba/minuit
void app_gl_idle(void)
{
	t_app *app = APP;

	// reset mouse
	app->mouse->dx=0;
	app->mouse->dy=0;

	// loop
	#ifdef HAVE_GLUT
	if(app->loop)
		glutPostRedisplay();
	// or sleep
	else app_sleep(app);
	#endif
}
Esempio n. 2
0
void slave(void)
{
	t_context *C=ctx_get();
	t_app *app = C->app;

	printf("entering slave mode ...\n");

	app->clock->limit=1;
	server_connect(C->server,9901);

	while(1)
	{
		app_sleep(app);
		printf("[%d] hello\n",app->frame);
		//__server(NULL);
	}
}
Esempio n. 3
0
/** Application Main <BR>
  * ======================================================================
  */
void main(void) {
    ///1. Standard Power-on routine (Clocks, Timers, IRQ's, etc)
    ///2. Standard OpenTag Init (most stuff actually will not be used)
    otapi_poweron();
    otapi_init();

    ///3. Palfi Application Initialization
    ///   Palfi app acts as an interupt-driven thread.  An interrupt pre-empts
    ///   the kernel and seeds the thread.  After this, the kernel takes-over
    ///   the execution of the thread.  This function enables these driving
    ///   interrupts.
    palfi_init();

    ///4. Top-level application init
    ///   In this demo, the top-level application does very little.
    app_init();

    OTAPI_LOG_MSG(MSG_utf8, 6, 26, (ot_u8*)"SYS_ON", (ot_u8*)"System on and Mpipe active");

    ///5. MAIN RUNTIME (post-init)  <BR>
    ///<LI> a. Pre-empt the kernel (first run)   </LI>
    ///<LI> b. Go to sleep; OpenTag kernel will run automatically in
    ///        the background  </LI>
    ///<LI> c. The kernel has a built-in applet loader.  It is the best way
    ///        to use applets that generate requests or manipulate the system.
    ///        The applets only load during full-idle, so time slotting or
    ///        any other type of MAC activity is not affected. </LI>
    ///<LI> d. 99.99% (or more) of the time, the kernel is not actually
    ///        running.  You can run parallel, local tasks alongside OpenTag
    ///        as long as they operate above priority 1.  (I/O is usually
    ///        priority 0 and kernel is always priority 1) </LI>
    otapi_preempt();
    while(1) {
        app_manager();
        app_sleep();
    }

    ///6. Note on manually pre-empting the kernel for you own purposes:
    ///   It can be done (many internal tasks do it), but be careful.
    ///   It is recommended that you only do it when sys.mutex <= 1
    ///   (i.e. no radio data transfer underway).  One adaptation of
    ///   this demo is to have the mode-switching applets pre-empt the
    ///   kernel (it works fine, but you need to make your own loader
    ///   instead of using sys.loadapp).
}