在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 門限滯回設(shè)置的C程序代碼

            門限滯回設(shè)置的C程序代碼

            作者: 時(shí)間:2012-06-24 來(lái)源:網(wǎng)絡(luò) 收藏

            將接近檢測(cè)傳感器集成到系統(tǒng)后,一個(gè)經(jīng)常遇到的問(wèn)題是如何正確選擇接近檢測(cè)的門限,以便在用戶通話期間打開(kāi)或關(guān)閉屏幕。門限須確保出現(xiàn)錯(cuò)誤判斷的幾率非常低,而且能夠支持絕大多數(shù)使用者的情況。
            門限滯回例程

            本文引用地址:http://www.biyoush.com/article/171238.htm

            #define MAX44000_ADDR	0x94#define INT_STATUS_REG	0x00#define OFF_THRESHOLD	4600#define OFF_DELAY		1#define ON_THRESHOLD	4000#define ON_DELAY		3uint8 screenStatus;	// 0 means off, 1 means on/*i2cWriteBytes()Arguments:uint8 address - device addressuint8 start_reg - register where the first byte is writtenuint8 *data - data to writeuint8 nbytes - number of bytes to writeConsecutively writes several bytes to some i2c device starting at some specified address -- implemented elsewhere*/void i2cWriteBytes(uint8 address,uint8 start_reg,uint8 *data,uint8 nbytes);/*MAX44000InterruptHandler()

            以下用于實(shí)現(xiàn)MAX44000 INT引腳的中斷處理,假設(shè)MAX44000的接近檢測(cè)傳感器為14位模式,并已使能中斷。此外,假設(shè)屏幕狀態(tài)初始化為1或0,詳細(xì)信息請(qǐng)參閱數(shù)據(jù)資料的寄存器說(shuō)明部分。

            */void MAX44000InterruptHandler() {uint8 i2cData[3];i2cRead1Byte(MAX44000_ADDR,INT_STATUS_REG,i2cData);if (i2cData0x01 != 0)return;	// check to make sure interrupt really fired// this simultaneously clears the interrupt flagif (screenStatus) {i2cData[0] = ON_DELAY;	i2cData[1] = ON_THRESHOLD >> 8  0xBF; // set ABOVE = 0i2cData[2] = ON_THRESHOLD  0xFF;} else {i2cData[0] = OFF_DELAY;	 i2cData[1] = OFF_THRESHOLD >> 8 | 0x40; // set ABOVE = 1i2cData[2] = OFF_THRESHOLD  0xFF;} // set the new threshold depending on what the screen status was// set the delay and threshold after each interrupti2cWriteBytes(MAX44000_ADDR,0x0A,i2cData,3);return;} // MAX44000InterruptHandler


            關(guān)鍵詞: 代碼 程序 設(shè)置

            評(píng)論


            相關(guān)推薦

            技術(shù)專區(qū)

            關(guān)閉