// PD9902_KEYA(KEYB)_V1.0 2009.11.23 //set all key i/o to high level WriteKey0(1); WriteKey1(1); WriteKey2(1); WriteKey3(1); CTimerDelayXms(1); //first: scan line, if find low level, id this, and keystate = key if (!ReadKey0()) { //DebugPrintf("\n key1", 1); //COsdFxClearText(1,0,3,3); //COsdFxShowNumber(1, 0, 1, 0x33, _CP_RED); return _RIGHT_KEY_MASK;//USE; } else if (!ReadKey1()) { DebugPrintf("\n key2", 1); return _UP_KEY_MASK;//USE; } else if (!ReadKey2()) { DebugPrintf("\n key3", 1); return _ENTER_KEY_MASK; //USE } else if (!ReadKey3()) { DebugPrintf("\n key4", 1); return _DOWN_KEY_MASK;// NOUSE ; } else { //second: loop scan line, set line1 to low level, and check cross line, if WriteKey0(0); WriteKey1(1); WriteKey2(1); WriteKey3(1); CTimerDelayXms(1); if (!ReadKey1()) { DebugPrintf("\n key5", 1); return _PLAYPAUSE_KEY_MASK;// USE; } else if (!ReadKey2()) { DebugPrintf("\n key6", 1); return _VOLDEC_KEY_MASK; //USE } else if (!ReadKey3()) { DebugPrintf("\n key7", 1); return _LEFT_KEY_MASK;// USE;// } else { WriteKey0(1); WriteKey1(0); WriteKey2(1); WriteKey3(1); CTimerDelayXms(1); if (!ReadKey0()) { DebugPrintf("\n key8", 1); return _SDUSB_KEY_MASK;//USE; } else if (!ReadKey2()) { DebugPrintf("\n key9", 1); return _SOURCE_KEY_MASK; //USE } else if (!ReadKey3()) { DebugPrintf("\n key10", 1); return _SUBTITLE_KEY_MASK;//USE; } else { WriteKey0(1); WriteKey1(1); WriteKey2(0); WriteKey3(1); CTimerDelayXms(1); if (!ReadKey0()) { DebugPrintf("\n key11", 1); return _AUDIO_KEY_MASK; //USE } else if (!ReadKey1()) { DebugPrintf("\n key10", 1); return _VOLINC_KEY_MASK; //USE } else if (!ReadKey3()) { DebugPrintf("\n key13", 1); return _PBC_KEY_MASK; //USE } else { WriteKey0(1); WriteKey1(1); WriteKey2(1); WriteKey3(0); CTimerDelayXms(1); if (!ReadKey0()) { DebugPrintf("\n key11", 1); return _SETUP_KEY_MASK;//USE;; } else if (!ReadKey1()) { DebugPrintf("\n key12", 1); return _MENU_KEY_MASK;// USE; } else if (!ReadKey2()) { DebugPrintf("\n key13", 1); return _STOP_KEY_MASK;// USE;; } else { return keystate; } } } } }