• <li id="00i08"><input id="00i08"></input></li>
  • <sup id="00i08"><tbody id="00i08"></tbody></sup>
    <abbr id="00i08"></abbr>
  • 關(guān) 閉

    新聞中心

    EEPW首頁 > 工控自動(dòng)化 > 設(shè)計(jì)應(yīng)用 > 觸控設(shè)備手勢(shì)喚醒的設(shè)計(jì)思路及其實(shí)現(xiàn)

    觸控設(shè)備手勢(shì)喚醒的設(shè)計(jì)思路及其實(shí)現(xiàn)

    作者: 時(shí)間:2012-07-14 來源:網(wǎng)絡(luò) 收藏
    示例代碼3

    本文引用地址:http://www.czjhyjcfj.com/article/160306.htm

      // this handles hardware-level interrupts on the micro

      __interrupt void irq_handler( void )

      {

      ...

      // if the hardware interrupt came from the MAX44000 sensor

      // pulling its INT pin low

      if ( irq_source == MAX44000 )

      {

      // if the device is in sleep mode

      if (device_status == SLEEP_MODE)

      {

      device_status = WAKE_MODE; // wake up the device

      ...

      // reconfigure whatever else you need here as the system wakes up

      }

      // otherwise, handle it however it is you wish

      else

      {

      ...

      }

      }

      ...

      }

      /**

      * configure_max44000_for_sleep_mode()

      *

      * Sets up the MAX44000 to trigger a hardware interrupt when the proximity

      * counts go above some set threshold.

      *

      * Arguments:

      * uint8 upper_threshold - the set threshold (8-bit mode)

      *

      * Returns:

      * n/a

      */

      void configure_max44000_for_sleep_mode(uint8 upper_threshold)

      {

      uint8 max44000_thresh_registers[] = {0x0B,0x0C};

      uint8 max44000_upper_thresh[] = {0x40,0};

      max44000_upper_thresh[1] = upper_threshold;

      // do a consecutive write of 0 followed by upper_threshold to

      // registers 0xB and 0xC, respectively

      // MAX44000_ADDR is usually 0x94

      // interrupt will trigger only if proximity value is above the threshold

      write_i2c_register(MAX44000_ADDR,max44000_thresh_registers,

      max44000_upper_thresh,2);

      // write to bits 2 and 3 of register 0x0A here if you wish to set the

      // persist time to anything other than one sample

      // writes to register 0x01 to enable interrupts on the MAX44000

      max44000_enable_interrupt();

      return;

      }


    上一頁 1 2 3 4 下一頁

    評(píng)論


    相關(guān)推薦

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

    關(guān)閉
    主站蜘蛛池模板: 宜城市| 昔阳县| 和平区| 赤城县| 施甸县| 长春市| 长垣县| 高阳县| 辽源市| 清新县| 偏关县| 咸丰县| 伊春市| 塔河县| 富裕县| 达拉特旗| 准格尔旗| 湖南省| 乌海市| 高州市| 乌海市| 军事| 武隆县| 农安县| 枞阳县| 井陉县| 双鸭山市| 滨海县| 卓资县| 桑日县| 从化市| 密云县| 灌阳县| 公主岭市| 宁都县| 芒康县| 克东县| 白山市| 饶阳县| 江华| 邓州市|