MachineSetingのTPキャリブレーションをまともに動くよう修正。

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@82 b08762b0-b915-fc4b-9d8c-17b2551a87ff
This commit is contained in:
yosiokat 2007-10-31 03:11:40 +00:00
parent ade0aa93fa
commit c76d8a0b17
11 changed files with 49 additions and 45 deletions

View File

@ -154,7 +154,7 @@ int MachineSettingMain( void )
BOOL tp_select;
GetAndDrawRtcData();
ReadTpData();
ReadTP();
//--------------------------------------
// キー入力処理
@ -226,10 +226,10 @@ void DrawOKCancelButton(void)
// OK or CANCELボタン押下チェック
void CheckOKCancelButton(BOOL *tp_ok, BOOL *tp_cancel)
{
*tp_cancel = InRangeTp( CANCEL_BUTTON_LT_X, CANCEL_BUTTON_LT_Y - 4,
CANCEL_BUTTON_RB_X, CANCEL_BUTTON_RB_Y - 4, &tpd.disp );
*tp_ok = InRangeTp( OK_BUTTON_LT_X, OK_BUTTON_LT_Y - 4,
OK_BUTTON_RB_X, OK_BUTTON_RB_Y - 4, &tpd.disp );
*tp_cancel = InRangeTp( CANCEL_BUTTON_LT_X, CANCEL_BUTTON_LT_Y,
CANCEL_BUTTON_RB_X, CANCEL_BUTTON_RB_Y, &tpd.disp );
*tp_ok = InRangeTp( OK_BUTTON_LT_X, OK_BUTTON_LT_Y,
OK_BUTTON_RB_X, OK_BUTTON_RB_Y, &tpd.disp );
}

View File

@ -23,20 +23,20 @@
// OKボタンLCD領域
#define OK_BUTTON_TOP_X ( 2 * 8 )
#define OK_BUTTON_TOP_Y ( 20 * 8 )
#define OK_BUTTON_BOTTOM_X ( (OK_BUTTON_TOP_X + 8) * 8 )
#define OK_BUTTON_BOTTOM_Y ( (OK_BUTTON_TOP_Y + 2) * 8 )
#define OK_BUTTON_BOTTOM_X ( OK_BUTTON_TOP_X + 8 * 8 )
#define OK_BUTTON_BOTTOM_Y ( OK_BUTTON_TOP_Y + 4 * 8 )
// キャンセルボタンLCD領域
#define CANCEL_BUTTON_TOP_X ( 11 * 8 )
#define CANCEL_BUTTON_TOP_Y ( 20 * 8 )
#define CANCEL_BUTTON_BOTTOM_X ( (CANCEL_BUTTON_TOP_X+8) * 8 )
#define CANCEL_BUTTON_BOTTOM_Y ( (CANCEL_BUTTON_TOP_Y+2) * 8 )
#define CANCEL_BUTTON_BOTTOM_X ( CANCEL_BUTTON_TOP_X + 8 * 8 )
#define CANCEL_BUTTON_BOTTOM_Y ( CANCEL_BUTTON_TOP_Y + 4 * 8 )
// リトライボタンLCD領域
#define RETRY_BUTTON_TOP_X ( 20 * 8 )
#define RETRY_BUTTON_TOP_Y ( 20 * 8 )
#define RETRY_BUTTON_BOTTOM_X ( (RETRY_BUTTON_TOP_X+8) * 8 )
#define RETRY_BUTTON_BOTTOM_Y ( (RETRY_BUTTON_TOP_Y+2) * 8 )
#define RETRY_BUTTON_BOTTOM_X ( RETRY_BUTTON_TOP_X + 8 * 8 )
#define RETRY_BUTTON_BOTTOM_Y ( RETRY_BUTTON_TOP_Y + 4 * 8 )
// キャリブレーション用OBJデータ
const u16 bitmapOBJPoint[8 * 8 * 5];
@ -158,6 +158,8 @@ static inline void SetPoint16x16(u16 pos_x, u16 pos_y)
*---------------------------------------------------------------------------*/
static void DisplayInit()
{
MI_CpuClearFast( (void *)HW_OAM, 0x20 );
MI_CpuClearFast( s_oamBak, sizeof(s_oamBak) );
GX_SetOBJVRamModeBmp( GX_OBJVRAMMODE_BMP_1D_128K ); // 2D mapping OBJ
/* Load charactor bitmap data */
GX_LoadOBJ( (const void *)IMAGE_DATA, 0x3000 /* 0 */, IMAGE_DATA_SIZE ); // Transfer OBJ bitmap data to VRAM
@ -391,12 +393,12 @@ int TP_CalibrationMain( void )
SetPoint16x16( tpd.disp.x, tpd.disp.y );
// [OK] [CANCEL] [RETRY]ボタン押下チェック
tp_ok = InRangeTp( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y - 4 * 8,
OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y - 4 * 8, &tpd.disp );
tp_cancel = InRangeTp( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y - 4 * 8,
CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y - 4 * 8, &tpd.disp );
tp_retry = InRangeTp( RETRY_BUTTON_TOP_X, RETRY_BUTTON_TOP_Y - 4 * 8,
RETRY_BUTTON_BOTTOM_X, RETRY_BUTTON_BOTTOM_Y - 4 * 8, &tpd.disp );
tp_ok = InRangeTp( OK_BUTTON_TOP_X, OK_BUTTON_TOP_Y,
OK_BUTTON_BOTTOM_X, OK_BUTTON_BOTTOM_Y, &tpd.disp );
tp_cancel = InRangeTp( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y,
CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp );
tp_retry = InRangeTp( RETRY_BUTTON_TOP_X, RETRY_BUTTON_TOP_Y,
RETRY_BUTTON_BOTTOM_X, RETRY_BUTTON_BOTTOM_Y, &tpd.disp );
if( tpd.raw.validity==TP_VALIDITY_VALID ) {
OS_TPrintf( "( %3d, %3d ) -> ( %4d, %4d )\n", tpd.disp.x, tpd.disp.y, tpd.raw.x, tpd.raw.y );

View File

@ -331,7 +331,7 @@ void ReadKeyPad(void)
// タッチパネルデータの取得-----------------------
void ReadTpData(void)
void ReadTP(void)
{
TP_GetCalibratedPoint( &tpd.last, &tpd.raw ); // 前回のTPデータを退避
@ -444,9 +444,9 @@ BOOL SelectMenuByTP( u16 *nowCsr, const MenuParam *pMenu )
if( tpd.disp.touch ) { // タッチパネルがメニューの要素上でタッチされているなら、
NNSG2dTextRect rect = NNS_G2dTextCanvasGetTextRect( &gTextCanvas, (pMenu->str_elem)[ i ] );
u16 top_x = (u16)( pMenu->pos[ i ].x ); // メニュー要素のLCD座標を算出
u16 top_y = (u16)( pMenu->pos[ i ].y - 4 );
u16 top_y = (u16)( pMenu->pos[ i ].y );
u16 bottom_x = (u16)( top_x + rect.width );
u16 bottom_y = (u16)( top_y + rect.height + 4 ); // ※Y座標は±4のマージン
u16 bottom_y = (u16)( top_y + rect.height );
OS_TPrintf( "MENU[ %d ] : top_x = %02d top_y = %02d bot_x = %02d bot_y = %02d : ",
i, top_x, top_y, bottom_x, bottom_y );
@ -488,6 +488,8 @@ BOOL InRangeTp( int top_x, int top_y, int bottom_x, int bottom_y, TPData *tgt )
( tgt->x <= bottom_x ) &&
( tgt->y >= top_y ) &&
( tgt->y <= bottom_y ) ) {
OS_TPrintf( "\nRANGE : tx=%3d ty=%3d bx=%3d by=%3d : x=%3d y=%3d\n",
top_x, top_y, bottom_x, bottom_y, tgt->x, tgt->y );
return TRUE;
}else {
return FALSE;

View File

@ -136,7 +136,7 @@ void PutStringUTF16Sub( int x, int y, int color, const u16 *strUTF16 );
void PrintfSJIS ( int x, int y, int color, const char *fmt, ... );
void PrintfSJISSub( int x, int y, int color, const char *fmt, ... );
void ReadKeyPad( void );
void ReadTpData( void );
void ReadTP( void );
BOOL WaitDetachTP( void );
void StartDetachTP( void );
void DrawMenu( u16 nowCsr, const MenuParam *pMenu );

View File

@ -92,7 +92,7 @@ int SEQ_AgbLcdSelect(void)
BOOL tp_select;
BOOL tp_cancel = FALSE;
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
//--------------------------------------
// キー入力処理
@ -105,8 +105,8 @@ int SEQ_AgbLcdSelect(void)
// [CANCEL]ボタン押下チェック
if(tpd.disp.touch) {
tp_cancel = InRangeTp(CANCEL_BUTTON_LT_X*8, CANCEL_BUTTON_LT_Y*8-4,
CANCEL_BUTTON_RB_X*8, CANCEL_BUTTON_RB_Y*8-4, &tpd.disp);
tp_cancel = InRangeTp(CANCEL_BUTTON_LT_X*8, CANCEL_BUTTON_LT_Y*8,
CANCEL_BUTTON_RB_X*8, CANCEL_BUTTON_RB_Y*8, &tpd.disp);
}
if((pad.trg & PAD_BUTTON_A) || (tp_select)) { // メニュー項目への分岐
@ -123,7 +123,7 @@ int SEQ_AgbLcdSelect(void)
return 0;
}
ReadTpData();
ReadTP();
return 0;
}

View File

@ -92,7 +92,7 @@ int SEQ_AutoBootSelect(void)
BOOL tp_select;
BOOL tp_cancel = FALSE;
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
//--------------------------------------
// キー入力処理
@ -105,8 +105,8 @@ int SEQ_AutoBootSelect(void)
// [CANCEL]ボタン押下チェック
if(tpd.disp.touch) {
tp_cancel = InRangeTp(CANCEL_BUTTON_LT_X*8, CANCEL_BUTTON_LT_Y*8-4,
CANCEL_BUTTON_RB_X*8, CANCEL_BUTTON_RB_Y*8-4, &tpd.disp);
tp_cancel = InRangeTp(CANCEL_BUTTON_LT_X*8, CANCEL_BUTTON_LT_Y*8,
CANCEL_BUTTON_RB_X*8, CANCEL_BUTTON_RB_Y*8, &tpd.disp);
}
if((pad.trg & PAD_BUTTON_A) || (tp_select)) { // メニュー項目への分岐
@ -123,7 +123,7 @@ int SEQ_AutoBootSelect(void)
return 0;
}
ReadTpData();
ReadTP();
return 0;
}

View File

@ -103,7 +103,7 @@ int SelectLanguageMain( void )
{
BOOL tp_select,tp_cancel = FALSE;
ReadTpData(); // TP入力の取得
ReadTP(); // TP入力の取得
//--------------------------------------
// キー入力処理
@ -123,8 +123,8 @@ int SelectLanguageMain( void )
// [CANCEL]ボタン押下チェック
if( tpd.disp.touch ) {
tp_cancel = InRangeTp( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y - 4 * 8,
CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y - 4 * 8, &tpd.disp );
tp_cancel = InRangeTp( CANCEL_BUTTON_TOP_X, CANCEL_BUTTON_TOP_Y,
CANCEL_BUTTON_BOTTOM_X, CANCEL_BUTTON_BOTTOM_Y, &tpd.disp );
}
if( ( pad.trg & PAD_BUTTON_A ) || tp_select ) { // メニュー項目への分岐

View File

@ -253,7 +253,7 @@ int SEQ_OwnerInfo(void)
BOOL tp_select;
BOOL tp_return = FALSE;
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
if(tpd.disp.touch) { // [RETURN]ボタン押下チェック
tp_return = InRangeTp(RETURN_BUTTON_LT_X*8, RETURN_BUTTON_LT_Y*8-4,
@ -356,7 +356,7 @@ static int SEQ_InputBirthday(void)
};
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
ow->inp.y_offset = 0;
@ -526,7 +526,7 @@ static int SEQ_InputFavoriteColor(void)
};
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
ow->inp.y_offset = 0;
@ -656,7 +656,7 @@ static int SEQ_InputNickname(void)
ow->csr_old = ow->csr_now; // 前フレームのカーソル位置を保存
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
tp_input = MoveCharCursorTp(&ow->csr_now); // TP入力によるカーソル移動
@ -867,7 +867,7 @@ static BOOL MoveCharCursorTp(CsrPos *csrp)
if(InRangeTp(CLIST_LT_X*8, CLIST_LT_Y*8-4, CLIST_RB_X*8-1, CLIST_RB_Y*8-4, &tpd.disp)) {
// 少しマージンあり。
temp.x = (u16)((tpd.disp.x - CLIST_LT_X * 8) / 8);
temp.y = (u16)((tpd.disp.y - (CLIST_LT_Y * 8 - 4)) / 16);
temp.y = (u16)((tpd.disp.y - (CLIST_LT_Y * 8)) / 16);
x_bak = temp.x; // 5文字ごとにある空白列の補正
while(x_bak >= 5) {
x_bak -= 6;

View File

@ -130,14 +130,14 @@ int SetRTCMain( void )
BOOL tp_set = FALSE;
BOOL tp_return = FALSE;
ReadTpData(); // TP入力の取得
ReadTP(); // TP入力の取得
if(tpd.disp.touch) {
tp_set = InRangeTp( DATE_TOP_X, DATE_TOP_Y - 4, // [RTC設定]領域押下チェック
(TIME_TOP_X + 8), (TIME_TOP_Y + 2) - 4, &tpd.disp );
tp_set = InRangeTp( DATE_TOP_X, DATE_TOP_Y, // [RTC設定]領域押下チェック
( TIME_TOP_X + 8 * 8 ), (TIME_TOP_Y + 2 * 8 ), &tpd.disp );
// [RETURN]ボタン押下チェック
tp_return = InRangeTp( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y - 4,
RETURN_BUTTON_BOTTOM_X, RETURN_BUTTON_BOTTOM_Y - 4, &tpd.disp );
tp_return = InRangeTp( RETURN_BUTTON_TOP_X, RETURN_BUTTON_TOP_Y,
RETURN_BUTTON_BOTTOM_X, RETURN_BUTTON_BOTTOM_Y, &tpd.disp );
}
if( g_initialSet && !GetNCDWork()->option.input_rtc ) {
tp_set = TRUE;
@ -216,7 +216,7 @@ static int InputRtcDateTimeMain( void )
SEQ_RETURN=64
};
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
CheckOKCancelButton( &tp_ok, &tp_cancel ); // [OK],[CANCEL]ボタン押下チェック
s_pRTCWork->inp.y_offset = 0;

View File

@ -62,7 +62,7 @@ void PictoChatMain(void)
{
BOOL tp_cancel = FALSE;
ReadTpData(); // タッチパネル入力の取得
ReadTP(); // タッチパネル入力の取得
// [RETURN]ボタン押下チェック
if(tpd.disp.touch) {

View File

@ -71,7 +71,7 @@ void TwlMain(void)
OS_WaitIrq(1, OS_IE_V_BLANK); // Vブランク割り込み待ち
ReadKeyPad(); // キー入力の取得
ReadTpData(); // TP入力の取得
ReadTP(); // TP入力の取得
PictoChatMain();
}