コード例 #1
0
ファイル: main.cpp プロジェクト: halfbyte/nds-oscpad
//---------------------------------------------------------------------------------
void VblankHandler(void) {
//---------------------------------------------------------------------------------

    u32 i;
    uint8 ct[sizeof(IPC->time.curtime)];

    //sound code  :)
    TransferSound *snd = IPC->soundData;
    IPC->soundData = 0;

    rtcGetTime((uint8 *)ct);
    BCDToInteger((uint8 *)&(ct[1]), 7);

    for(i=0; i<sizeof(ct); i++) {
        IPC->time.curtime[i] = ct[i];
    }

    if (0 != snd) {

        for (i=0; i<snd->count; i++) {
            s32 chan = getFreeSoundChannel();

            if (chan >= 0) {
                startSound(snd->data[i].rate, snd->data[i].data, snd->data[i].len, chan, snd->data[i].vol, snd->data[i].pan, snd->data[i].format);
            }
        }
    }
    Wifi_Update(); // update wireless in vblank
}
コード例 #2
0
ファイル: main.c プロジェクト: troy56/palibds
void PA_VBL() {
   s32 batt=0;
    int t1=0, t2=0;
    uint32 temp=0;
    uint8 ct[sizeof(IPC->time.curtime)];

    batt = touchRead(TSC_MEASURE_BATTERY);
    
    // Read the time
    PA_rtcGetTime((uint8 *)ct);
    BCDToInteger((uint8 *)&(ct[1]), 7);
 
    // Read the temperature
    temp = touchReadTemperature(&t1, &t2);
    IPC->battery   = batt;
    
    u32 i;
    for(i=0; i<sizeof(ct); i++) {
      IPC->time.curtime[i] = ct[i];
    }

    IPC->temperature = temp;
    IPC->tdiode1 = t1;
    IPC->tdiode2 = t2;
	
	if (PA_NewSPI != (IPC->aux)){
		PA_NewSPI = IPC->aux;
		PA_ScreenLight(); // Update the screen lights...
	}
	
	AS_SoundVBL();	// Update AS_Lib
	
	PA_IPCManage(); // PAlib IPC functions (sound busy, panning, etc...)
	
	Wifi_Update();
}
コード例 #3
0
ファイル: main7.c プロジェクト: sypherce/dslua
void VcountHandler()
{
	static int lastbut = -1;
	uint8 ct[sizeof(IPC->time.rtc)];
	
	uint16 but=0, x=0, y=0, xpx=0, ypx=0, z1=0, z2=0;

	but = REG_KEYXY;

	if(!((but ^ lastbut) & (1<<6)))
	{
		tempPos = touchReadXY();
		if(tempPos.x == 0 || tempPos.y == 0)
		{
			but |= (1 <<6);
			lastbut = but;
		}
		else
		{
			x = tempPos.x;
			y = tempPos.y;
			xpx = tempPos.px;
			ypx = tempPos.py;
			z1 = tempPos.z1;
			z2 = tempPos.z2;
		}
	}
	else
	{
		lastbut = but;
		but |= (1 <<6);
	}

	if(vcount == 80)
	{
		first = tempPos;
	}
	else
	{
		if(abs(xpx - first.px) > 10 || abs(ypx - first.py) > 10 || (but & (1<<6)))
		{
			but |= (1 <<6);
			lastbut = but;
		}
		else
		{ 	
			IPC->mailBusy = 1;
			IPC->touchX			= x;
			IPC->touchY			= y;
			IPC->touchXpx		= xpx;
			IPC->touchYpx		= ypx;
			IPC->touchZ1		= z1;
			IPC->touchZ2		= z2;
			IPC->mailBusy = 0;
		}
	}
    // Read the time
    rtcGetTime((uint8 *)ct);
    BCDToInteger((uint8 *)&(ct[1]), 7); 
	u8 i;
	u8 *temp;
	temp = (u8*)&IPC->time.rtc;
	for(i=0; i<sizeof(ct); i++)
	{
		temp[i] = ct[i];
	} 

	IPC->buttons		= but;
	vcount ^= (80 ^ 130);
	SetYtrigger(vcount);
}