void ds2_main(void)
{
    int err;
    ds2_setCPUclocklevel(11);

    //Initial video and audio and other input and output
    err = ds2io_init(1024);
    if(err) goto _failure;

    ConsoleInit(RGB15(31, 31, 31), RGB15(0, 0, 0), DOWN_SCREEN, 2);

    unsigned int Time = getSysTime();

    //go to user main funtion
    main (0, 0);

    Time = getSysTime() - Time;

    printf("%u units\n\nof 42.667 us", Time);

    ds2_setCPUclocklevel(0);

    struct key_buf inputdata;

    do
        ds2_getrawInput(&inputdata);
    while (inputdata.key == 0);
    ds2_setBacklight(3);
    ds2_plug_exit();
    while (1);

_failure:
    ds2_plug_exit();
}
Esempio n. 2
0
u32 readkey()
{
    struct key_buf inputdata;

    ds2_getrawInput(&inputdata);

    touch.x = inputdata.x;
    touch.y = inputdata.y;
	return inputdata.key;
}
Esempio n. 3
0
/*--------------------------------------------------------
	Wait all key in [key_list] released
	if key_list == NULL, return at all key released
--------------------------------------------------------*/
void wait_Allkey_release(unsigned int key_list)
{
	unsigned int key;
    struct key_buf inputdata;

	while(1)
	{
		ds2_getrawInput(&inputdata);
		key = inputdata.key;

		if(0 == key) break;
		else if(!key_list) continue;
		else if(0 == (key_list & key)) break;
	}
}