Re: Consumer IRDa Remote control by Henrik
Henrik
Fri Jan 06 05:18:57 CST 2006
The code was written for another platform that had the capability to
hook up alternating counters to be trigged by gpio flanks, which
greatly simplified the algoritm, so it would be of marignal use for
you.
Anyway, if it works when you're not playing mp3, the extra cpu-load the
mp3 decoder is creating might cause your IST to miss its deadlines. If
you havn't allready, you could try raising the IST priority and see if
things stabilize.
Henrik Viklund
Himanth wrote:
> Dear Mr. Henrik Viklund
> Thanks for your reply.
> you r right i am using IR remote controller(like TV.remote).
> i am developing mp3 player based on samsug2440.
> i tryed method u mentioned.
> my problem is when i use hw timer it detects only 18 bits.
> my code works fine except when music is playing.
> once the player started after remote is not functioning.
> can u please send me sample code.
> my mail id is himanthyes(@)hotmail.com.
>
> snippet from my driver.
>
> switch(dwEvent)
> {
> case WAIT_OBJECT_0:
> if(IRStart == FALSE)
> {
> IRStart = TRUE;
> }
> else
> {
> IRStart = FALSE;
> while(!((v_pIOPregs->rGPHDAT) & (1 << 7)))
> {
> // IRCount++;
> }
> while(((v_pIOPregs->rGPHDAT) & (1 << 7)))
> {
> IRCount++;
> }
> RETAILMSG(1,(TEXT("%d "),IRCount));
> if(IRCount > 30000)
> {
> IRIndex =0;
> for(Cnt =0; Cnt < 31; Cnt++) IRDataBuff[Cnt] =0;
> RETAILMSG(1,(TEXT("\n")));
> }
> else if(IRCount > 10000)
> {
> IRDataBuff[IRIndex]= 1;IRIndex++;
> }
> else
> {
> IRDataBuff[IRIndex]= 0;IRIndex++;
> }
> if(IRIndex > 31)
> {
> Data =0;
> for(Cnt = 0; Cnt < 8; Cnt++)
> {
> Data = Data << 1;
> Data = Data | IRDataBuff[Cnt];
> }
> IRCustomData1 = Data;
> RETAILMSG(1,(TEXT(" %d "),Data));
> Data=0;
> for(Cnt = 8; Cnt < 16; Cnt++)
> {
> Data = Data << 1;
> Data = Data | IRDataBuff[Cnt];
> }
> IRCustomData2 = Data;
> RETAILMSG(1,(TEXT(" %d "),Data));
> Data=0;
> for(Cnt = 16; Cnt <24; Cnt++)
> {
> Data = Data << 1;
> Data = Data | IRDataBuff[Cnt];
> }
> IRData1 = Data;
> RETAILMSG(1,(TEXT(" %d "),Data));
> Data=0;
> for(Cnt = 24; Cnt < 32; Cnt++)
> {
> Data = Data << 1;
> Data = Data | IRDataBuff[Cnt];
> }
> IRData2 = Data;
> RETAILMSG(1,(TEXT(" %d \n"),Data));
>
> if((IRData1 + IRData2)==0xFF)
> {
> switch(IRData1)
> {
> case 0x81:
> v_pDriverGlobals->baUDID[0] = KEY1;
> RETAILMSG(1,(TEXT("F1 Key\n")));
> break;
> case 0x41:
> v_pDriverGlobals->baUDID[0] = KEY2;
> RETAILMSG(1,(TEXT("F2 Key\n")));
> break;
> case 0x61:
> v_pDriverGlobals->baUDID[0] = KEY3;
> RETAILMSG(1,(TEXT("F3 Key\n")));
> break;
> case 0x21:
> v_pDriverGlobals->baUDID[0] = KEY4;
> RETAILMSG(1,(TEXT("F4 Key\n")));
> break;
> }
>
> }
> }
> IRCount =0;
> }
> InterruptDone(SYSINTR_IR);
>
> break;
> case WAIT_TIMEOUT:
> IRIndex =0;
> IRCount =0;
> break;
> }
>
> warm regards
>
> Himanth