亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? key.c

?? 一些ucos的外圍接口原代碼,如鍵盤LCDLED
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
        return (code);                           /* Return the scan code of the key pressed            */
    } else {
        OS_EXIT_CRITICAL();                      /* End of critical section of code                    */
        return (0xFF);                           /* No scan codes in the buffer, return -1             */
    }
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                  GET HOW LONG KEY HAS BEEN PRESSED
*
* Description : This function returns the amount of time the key has been pressed.
* Arguments   : none
* Returns     : key down time in 'milliseconds'
*********************************************************************************************************
*/

INT32U  KeyGetKeyDownTime (void)
{
    INT16U tmr;


    OS_ENTER_CRITICAL();
    tmr = KeyDownTmr;
    OS_EXIT_CRITICAL();
    return (tmr * KEY_SCAN_TASK_DLY);
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                        SEE IF ANY KEY IN BUFFER
*
* Description : This function checks to see if a key was pressed
* Arguments   : none
* Returns     : TRUE   if a key has been pressed
*               FALSE  if no key pressed
*********************************************************************************************************
*/

BOOLEAN  KeyHit (void)
{
    BOOLEAN hit;


    OS_ENTER_CRITICAL();
    hit = (BOOLEAN)(KeyNRead > 0) ? TRUE : FALSE;
    OS_EXIT_CRITICAL();
    return (hit);
}

/*
*********************************************************************************************************
*                                       KEYBOARD INITIALIZATION
*
* Description: Keyboard initialization function.  KeyInit() must be called before calling any other of
*              the user accessible functions.
* Arguments  : none
* Returns    : none
*********************************************************************************************************
*/

void  KeyInit (void)
{
    KeySelRow(KEY_ALL_ROWS);                     /* Select all row                                     */
    KeyScanState = KEY_STATE_UP;                 /* Keyboard should not have a key pressed             */
    KeyNRead     = 0;                            /* Clear the number of keys read                      */
    KeyDownTmr   = 0;
    KeyBufInIx   = 0;                            /* Key codes inserted at  the beginning of the buffer */
    KeyBufOutIx  = 0;                            /* Key codes removed from the beginning of the buffer */
    KeySemPtr    = OSSemCreate(0);               /* Initialize the keyboard semaphore                  */
    KeyInitPort();                               /* Initialize I/O ports used in keyboard driver       */
    OSTaskCreate(KeyScanTask, (void *)0, &KeyScanTaskStk[KEY_SCAN_TASK_STK_SIZE], KEY_SCAN_TASK_PRIO);
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                           SEE IF KEY PRESSED
*
* Description : This function checks to see if a key is pressed
* Arguments   : none
* Returns     : TRUE   if a key is     pressed
*               FALSE  if a key is not pressed
* Note        : (1 << KEY_MAX_COLS) - 1   is used as a mask to isolate the column inputs (i.e. mask off
*                                         the SHIFT keys).
*********************************************************************************************************
*/

static  BOOLEAN  KeyIsKeyDown (void)
{
    if (KeyGetCol() & ((1 << KEY_MAX_COLS) - 1)) {         /* Key not pressed if 0                     */
        OS_ENTER_CRITICAL();
        KeyDownTmr++;                                      /* Update key down counter                  */
        OS_EXIT_CRITICAL();
        return (TRUE);
    } else {
        return (FALSE);
    }
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                         KEYBOARD SCANNING TASK
*
* Description : This function contains the body of the keyboard scanning task.  The task should be
*               assigned a low priority.  The scanning period is determined by KEY_SCAN_TASK_DLY.
* Arguments   : 'data'   is a pointer to data passed to task when task is created (NOT USED).
* Returns     : KeyScanTask() never returns.
* Notes       : - An auto repeat of the key pressed will be executed after the key has been pressed for
*                 more than KEY_RPT_START_DLY scan times.  Once the auto repeat has started, the key will
*                 be repeated every KEY_RPT_DLY scan times as long as the key is pressed.  For example,
*                 if the scanning of the keyboard occurs every 50 mS and KEY_RPT_START_DLY is set to 40
*                 and KEY_RPT_DLY is set to 2, then the auto repeat function will engage after 2 seconds
*                 and will repeat every 100 mS (10 times per second).
*********************************************************************************************************
*/

/*$PAGE*/
static  void  KeyScanTask (void *data)
{
    INT8U code;


    data = data;                                           /* Avoid compiler warning (uC/OS-II req.)   */
    for (;;) {
        OSTimeDlyHMSM(0, 0, 0, KEY_SCAN_TASK_DLY);         /* Delay between keyboard scans             */
        switch (KeyScanState) {
            case KEY_STATE_UP:                             /* See if need to look for a key pressed    */
                 if (KeyIsKeyDown()) {                     /* See if key is pressed                    */
                     KeyScanState = KEY_STATE_DEBOUNCE;    /* Next call we will have debounced the key */
                     KeyDownTmr   = 0;                     /* Reset key down timer                     */
                 }
                 break;

            case KEY_STATE_DEBOUNCE:                       /* Key pressed, get scan code and buffer    */
                 if (KeyIsKeyDown()) {                     /* See if key is pressed                    */
                     code              = KeyDecode();      /* Determine the key scan code              */
                     KeyBufIn(code);                       /* Input scan code in buffer                */
                     KeyRptStartDlyCtr = KEY_RPT_START_DLY;/* Start delay to auto-repeat function      */
                     KeyScanState      = KEY_STATE_RPT_START_DLY;
                 } else {
                     KeySelRow(KEY_ALL_ROWS);              /* Select all row                           */
                     KeyScanState      = KEY_STATE_UP;     /* Key was not pressed after all!           */
                 }
                 break;

            case KEY_STATE_RPT_START_DLY:
                 if (KeyIsKeyDown()) {                     /* See if key is still pressed              */
                     if (KeyRptStartDlyCtr > 0) {          /* See if we need to delay before auto rpt  */
                         KeyRptStartDlyCtr--;              /* Yes, decrement counter to start of rpt   */
                         if (KeyRptStartDlyCtr == 0) {     /* If delay to auto repeat is completed ... */
                             code         = KeyDecode();   /* Determine the key scan code              */
                             KeyBufIn(code);               /* Input scan code in buffer                */
                             KeyRptDlyCtr = KEY_RPT_DLY;   /* Load delay before next repeat            */
                             KeyScanState = KEY_STATE_RPT_DLY;
                         }
                     }
                 } else {
                     KeyScanState = KEY_STATE_DEBOUNCE;    /* Key was not pressed after all            */
                 }
                 break;

            case KEY_STATE_RPT_DLY:
                 if (KeyIsKeyDown()) {                     /* See if key is still pressed              */
                     if (KeyRptDlyCtr > 0) {               /* See if we need to wait before repeat key */
                         KeyRptDlyCtr--;                   /* Yes, dec. wait time to next key repeat   */
                         if (KeyRptDlyCtr == 0) {          /* See if it's time to repeat key           */
                             code         = KeyDecode();   /* Determine the key scan code              */
                             KeyBufIn(code);               /* Input scan code in buffer                */
                             KeyRptDlyCtr = KEY_RPT_DLY;   /* Reload delay counter before auto repeat  */
                         }
                     }
                 } else {
                     KeyScanState = KEY_STATE_DEBOUNCE;    /* Key was not pressed after all            */
                 }
                 break;
        }
    }
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                              READ COLUMNS
*
* Description : This function is called to read the column port.
* Arguments   : none
* Returns     : the complement of the column port thus, ones are keys pressed
*********************************************************************************************************
*/

#ifndef CFG_C
INT8U  KeyGetCol (void)
{
    return (~inp(KEY_PORT_COL));                 /* Complement columns (ones indicate key is pressed)  */
}
#endif


/*
*********************************************************************************************************
*                                         INITIALIZE I/O PORTS
*********************************************************************************************************
*/

#ifndef CFG_C
void  KeyInitPort (void)
{
    outp(KEY_PORT_CW, 0x82);                     /* Initialize 82C55: A=OUT, B=IN (COLS), C=OUT (ROWS) */
}
#endif


/*
*********************************************************************************************************
*                                            SELECT A ROW
*
* Description : This function is called to select a row on the keyboard.
* Arguments   : 'row'  is the row number (0..7) or KEY_ALL_ROWS
* Returns     : none
* Note        : The row is selected by writing a LOW.
*********************************************************************************************************
*/

#ifndef CFG_C
void  KeySelRow (INT8U row)
{
    if (row == KEY_ALL_ROWS) {
        outp(KEY_PORT_ROW, 0x00);                /* Force all rows LOW                                 */
    } else {
        outp(KEY_PORT_ROW, ~(1 << row));         /* Force desired row LOW                              */
    }
}
#endif

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美女一区二区三区在线观看| 香港成人在线视频| 丰满少妇久久久久久久| 欧美激情资源网| 成人高清视频在线| 一区二区三区四区在线免费观看 | 免费观看日韩av| 精品国免费一区二区三区| 国内精品国产成人国产三级粉色| 中文字幕一区日韩精品欧美| 亚洲精品在线观| 国产一区二区精品在线观看| 国产日韩欧美综合一区| 国产精品影视在线| 中文在线一区二区 | 青青草91视频| 亚洲午夜激情网站| 一本久久综合亚洲鲁鲁五月天| 亚洲一区二区av在线| 亚洲精选免费视频| 国产精品久久免费看| 久久久久一区二区三区四区| 日韩欧美色综合| 欧美一区二区三区视频免费 | 久久人人爽人人爽| 欧美成人官网二区| 日韩午夜激情av| 日韩亚洲国产中文字幕欧美| 精品视频资源站| 欧美视频在线一区二区三区 | 91成人国产精品| 91看片淫黄大片一级在线观看| 国产成人精品免费看| 国产精品一区二区三区99| 韩国午夜理伦三级不卡影院| 久久99精品网久久| 国产精品综合一区二区三区| 国产一区二区h| 国产精品一区二区在线播放 | 欧美剧在线免费观看网站| 欧美亚洲综合网| 欧美亚洲丝袜传媒另类| 欧美视频三区在线播放| 欧美日韩国产小视频| 欧美精品vⅰdeose4hd| 欧美嫩在线观看| 日韩欧美精品三级| 精品国产一区二区三区忘忧草| 日韩女优毛片在线| 精品噜噜噜噜久久久久久久久试看| 日韩一区二区免费在线电影| 日韩午夜小视频| 久久久久久久久久久久久女国产乱| 精品久久久影院| 国产亚洲欧美色| 成人欧美一区二区三区1314 | 一区二区三区中文在线| 亚洲永久免费av| 日本在线不卡视频| 国产精品白丝av| 91女人视频在线观看| 欧美日韩一区二区三区在线看| 在线综合视频播放| 精品国产91亚洲一区二区三区婷婷| 久久精品日韩一区二区三区| 亚洲人成网站色在线观看| 日韩精品一二三区| 国产精品影视网| 欧美中文字幕一二三区视频| 精品人在线二区三区| 亚洲国产成人自拍| 亚洲国产综合人成综合网站| 精品在线免费观看| 不卡的电影网站| 欧美丰满少妇xxxbbb| 国产午夜精品美女毛片视频| 亚洲国产精品一区二区久久| 久久爱另类一区二区小说| av电影在线观看完整版一区二区 | 亚洲国产成人自拍| 天堂蜜桃91精品| 成人激情午夜影院| 欧美日韩中文一区| 国产精品网友自拍| 免费成人在线网站| 91婷婷韩国欧美一区二区| 日韩欧美一级二级| 一区二区三区高清不卡| 国产精品66部| 欧美日韩极品在线观看一区| 欧美国产在线观看| 蜜臀久久久久久久| 91在线看国产| 久久久午夜精品理论片中文字幕| 亚洲精品一二三| 国产精品一二三四区| 欧美日韩视频一区二区| 一区在线观看免费| 国产一区二区三区免费看| 欧美精品久久99久久在免费线| 国产日本欧洲亚洲| 老汉av免费一区二区三区| 在线亚洲欧美专区二区| 中文一区二区在线观看| 狠狠色丁香婷婷综合| 欧美高清dvd| 亚洲午夜精品网| 91麻豆自制传媒国产之光| 国产色91在线| 久久精品噜噜噜成人88aⅴ| 欧美日韩久久久| 一区二区在线观看视频| 成人a级免费电影| 精品久久久久久久久久久院品网 | 日产国产欧美视频一区精品| eeuss鲁片一区二区三区在线看| 欧美精品一区二| 丝瓜av网站精品一区二区| 色域天天综合网| 国产精品美女久久久久久久| 国产一区91精品张津瑜| 日韩亚洲欧美在线| 日韩激情在线观看| 欧美日韩亚洲另类| 亚洲电影欧美电影有声小说| 欧美中文字幕一区| 国产麻豆一精品一av一免费| 这里是久久伊人| 日本不卡123| 91精品国产欧美一区二区成人| 亚洲国产日韩在线一区模特| 91美女福利视频| 亚洲午夜私人影院| 欧美日韩成人高清| 午夜激情一区二区三区| 欧美日韩一区二区三区四区| 婷婷夜色潮精品综合在线| 精品1区2区3区| 亚洲风情在线资源站| 欧美高清精品3d| 久久精品久久精品| 久久久亚洲国产美女国产盗摄| 国产成人欧美日韩在线电影| 国产精品视频九色porn| caoporn国产一区二区| 亚洲欧美国产高清| 欧美性极品少妇| 青娱乐精品视频在线| 精品国产乱码久久久久久影片| 国产一区久久久| 中文字幕欧美区| 色菇凉天天综合网| 五月天网站亚洲| 欧美va日韩va| 成人午夜激情在线| 亚洲精品美腿丝袜| 日韩一区二区三区观看| 国产不卡视频在线播放| 亚洲人一二三区| 9191成人精品久久| 九九在线精品视频| 久久久久久免费毛片精品| 波多野结衣91| 天天综合天天综合色| 久久久久久久久久看片| 色综合色狠狠天天综合色| 香蕉久久夜色精品国产使用方法| 日韩欧美久久一区| 97se亚洲国产综合自在线不卡| 亚洲成人av免费| 久久先锋影音av鲁色资源| a4yy欧美一区二区三区| 天天色综合天天| 欧美高清在线一区| 欧美日本在线播放| 国v精品久久久网| 日韩不卡免费视频| 国产精品久久夜| 日韩丝袜情趣美女图片| www.av亚洲| 麻豆国产欧美日韩综合精品二区| 亚洲欧洲无码一区二区三区| 91精品蜜臀在线一区尤物| 成人免费av资源| 久久精品国产免费| 一区二区三区毛片| 久久精品亚洲麻豆av一区二区| 欧美日韩国产一级片| 99久久综合色| 激情欧美日韩一区二区| 亚洲国产综合色| 最新久久zyz资源站| 2023国产一二三区日本精品2022| 在线观看视频一区二区欧美日韩| 国模一区二区三区白浆| 午夜精品福利一区二区三区av| 国产精品免费av| 26uuu精品一区二区| 7777精品伊人久久久大香线蕉最新版| av中文字幕不卡|