?? rd_usekey.s
字號:
.dbline 201
; }
xjmp L6
L5:
.dbline 203
; else
; {
.dbline 204
; s_cKeyNum = KEY_NULL;
ldi R24,255
sts _s_cKeyNum,R24
.dbline 205
; if ((g_wKeyPressTimeCounter > _USE_KEY_LONG_PRESS_DELAY_TIME) && (IfLongKeyPress == FALSE))
ldi R24,1024
ldi R25,4
lds R2,_g_wKeyPressTimeCounter
lds R3,_g_wKeyPressTimeCounter+1
cp R24,R2
cpc R25,R3
brsh L9
X4:
lds R2,L3
tst R2
brne L9
X5:
.dbline 206
; {
.dbline 208
; #ifdef _USE_KEY_LONG_PRESS_REPEAT
; if (LongPressAcceleration > _USE_KEY_LONG_PRESS_FASTEST_SPEED)
ldi R24,127
ldi R25,0
lds R2,L4
lds R3,L4+1
cp R24,R2
cpc R25,R3
brsh L11
X6:
.dbline 209
; {
.dbline 210
; LongPressAcceleration >>= 1;
lsr R3
ror R2
sts L4+1,R3
sts L4,R2
.dbline 211
; }
L11:
.dbline 213
; #endif
; s_cLongKeyPressNum = NowKeyCode;
sts _s_cLongKeyPressNum,R20
.dbline 214
; IfLongKeyPress = TRUE;
ldi R24,1
sts L3,R24
.dbline 215
; }
xjmp L10
L9:
.dbline 217
; else
; {
.dbline 219
; #ifdef _USE_KEY_LONG_PRESS_REPEAT
; if (!(g_wKeyPressTimeCounter & LongPressAcceleration))
lds R2,L4
lds R3,L4+1
lds R4,_g_wKeyPressTimeCounter
lds R5,_g_wKeyPressTimeCounter+1
and R4,R2
and R5,R3
tst R4
brne L13
tst R5
brne L13
X7:
.dbline 220
; {
.dbline 221
; IfLongKeyPress = FALSE;
clr R2
sts L3,R2
.dbline 222
; }
xjmp L14
L13:
.dbline 224
; else
; {
.dbline 225
; s_cLongKeyPressNum = KEY_NULL;
ldi R24,255
sts _s_cLongKeyPressNum,R24
.dbline 226
; }
L14:
.dbline 230
; #else
; s_cLongKeyPressNum = KEY_NULL;
; #endif
; }
L10:
.dbline 231
; }
L6:
.dbline -2
L1:
.dbline 0 ; func end
ld R20,y+
ret
.dbsym r NowKeyCode0 20 c
.dbend
.dbfunc e Add_Key_Code _Add_Key_Code fV
.even
_Add_Key_Code::
.dbline -1
.dbline 242
;
; }
;
; /***********************************************************
; * 函數(shù)說明:鍵盤緩沖處理函數(shù) *
; * 輸入: 無 *
; * 輸出: 無 *
; * 調(diào)用函數(shù):_Key_Scan() *
; ***********************************************************/
; void Add_Key_Code(void)
; {
.dbline 243
; _Key_Scan();
xcall __Key_Scan
.dbline 245
;
; if ((s_cKeyNum == KEY_NULL) && (s_cLongKeyPressNum == KEY_NULL))
lds R24,_s_cKeyNum
cpi R24,255
brne L16
X8:
lds R24,_s_cLongKeyPressNum
cpi R24,255
brne L16
X9:
.dbline 246
; {
.dbline 247
; return ;
xjmp L15
L16:
.dbline 250
; }
;
; if ((s_cKeyBUFFHeadPoint == s_cKeyBUFFTailPoint) && (s_cKeyBUFFCounter != NULL))
lds R2,_s_cKeyBUFFTailPoint
lds R3,_s_cKeyBUFFHeadPoint
cp R3,R2
brne L18
X10:
lds R2,_s_cKeyBUFFCounter
tst R2
breq L18
X11:
.dbline 251
; {
.dbline 252
; return ;
xjmp L15
L18:
.dbline 255
; }
;
; s_cKeyBUFF[s_cKeyBUFFTailPoint][0] = s_cKeyNum;
ldi R24,<_s_cKeyBUFF
ldi R25,>_s_cKeyBUFF
lds R30,_s_cKeyBUFFTailPoint
clr R31
lsl R30
rol R31
add R30,R24
adc R31,R25
lds R2,_s_cKeyNum
std z+0,R2
.dbline 256
; s_cKeyBUFF[s_cKeyBUFFTailPoint][1] = s_cLongKeyPressNum;
ldi R24,<_s_cKeyBUFF+1
ldi R25,>_s_cKeyBUFF+1
lds R30,_s_cKeyBUFFTailPoint
clr R31
lsl R30
rol R31
add R30,R24
adc R31,R25
lds R2,_s_cLongKeyPressNum
std z+0,R2
.dbline 258
;
; s_cKeyBUFFTailPoint ++;
lds R24,_s_cKeyBUFFTailPoint
subi R24,255 ; addi 1
sts _s_cKeyBUFFTailPoint,R24
.dbline 259
; if (s_cKeyBUFFTailPoint == KEY_BUFF_SIZE)
cpi R24,8
brne L21
X12:
.dbline 260
; {
.dbline 261
; s_cKeyBUFFTailPoint = 0;
clr R2
sts _s_cKeyBUFFTailPoint,R2
.dbline 262
; }
L21:
.dbline 263
; s_cKeyBUFFCounter ++;
lds R24,_s_cKeyBUFFCounter
subi R24,255 ; addi 1
sts _s_cKeyBUFFCounter,R24
.dbline -2
L15:
.dbline 0 ; func end
ret
.dbend
.dbfunc e Get_Key_Code _Get_Key_Code fc
.even
_Get_Key_Code::
.dbline -1
.dbline 276
; }
;
; /***********************************************************
; * 函數(shù)說明:從鍵盤緩沖區(qū)中獲得一個按鍵掃描碼 *
; * 輸出: 返回操作是否成功TRUE / FALSE *
; * 輸入: 無 *
; * 調(diào)用函數(shù):Add_Key_Code() *
; * -------------------------------------------------------- *
; * [說 明] *
; * 將按鍵掃描碼放到專門的臨時緩沖變量中 *
; ***********************************************************/
; unsigned char Get_Key_Code(void)
; {
.dbline 277
; g_cReturnKeyNum = KEY_NULL;
ldi R24,255
sts _g_cReturnKeyNum,R24
.dbline 278
; g_cReturnLongPressKeyNum = KEY_NULL;
sts _g_cReturnLongPressKeyNum,R24
.dbline 284
;
; #ifdef _USE_KEY_MANUL_REFRESH
; Add_Key_Code();
; #endif
;
; if ((s_cKeyBUFFHeadPoint == s_cKeyBUFFTailPoint) && (s_cKeyBUFFCounter == NULL))
lds R2,_s_cKeyBUFFTailPoint
lds R3,_s_cKeyBUFFHeadPoint
cp R3,R2
brne L24
X13:
lds R2,_s_cKeyBUFFCounter
tst R2
brne L24
X14:
.dbline 285
; {
.dbline 286
; return FALSE;
clr R16
xjmp L23
L24:
.dbline 289
; }
;
; g_cReturnKeyNum = s_cKeyBUFF[s_cKeyBUFFHeadPoint][0];
ldi R24,<_s_cKeyBUFF
ldi R25,>_s_cKeyBUFF
lds R30,_s_cKeyBUFFHeadPoint
clr R31
lsl R30
rol R31
add R30,R24
adc R31,R25
ldd R2,z+0
sts _g_cReturnKeyNum,R2
.dbline 290
; g_cReturnLongPressKeyNum = s_cKeyBUFF[s_cKeyBUFFHeadPoint][1];
ldi R24,<_s_cKeyBUFF+1
ldi R25,>_s_cKeyBUFF+1
lds R30,_s_cKeyBUFFHeadPoint
clr R31
lsl R30
rol R31
add R30,R24
adc R31,R25
ldd R2,z+0
sts _g_cReturnLongPressKeyNum,R2
.dbline 292
;
; s_cKeyBUFFCounter--;
lds R24,_s_cKeyBUFFCounter
subi R24,1
sts _s_cKeyBUFFCounter,R24
.dbline 293
; s_cKeyBUFFHeadPoint++;
lds R24,_s_cKeyBUFFHeadPoint
subi R24,255 ; addi 1
sts _s_cKeyBUFFHeadPoint,R24
.dbline 294
; if (s_cKeyBUFFHeadPoint == KEY_BUFF_SIZE)
cpi R24,8
brne L27
X15:
.dbline 295
; {
.dbline 296
; s_cKeyBUFFHeadPoint = 0;
clr R2
sts _s_cKeyBUFFHeadPoint,R2
.dbline 297
; }
L27:
.dbline 299
;
; return TRUE;
ldi R16,1
.dbline -2
L23:
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile O:\2007全國電子設(shè)計大賽\鍵盤顯示模塊\RD_UseKey.c
_s_cKeyBUFF:
.blkb 16
.dbsym s s_cKeyBUFF _s_cKeyBUFF A[16:8:2]c
; }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -