<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 簡(jiǎn)單手勢喚醒便攜設備的設計思路及其代碼

簡(jiǎn)單手勢喚醒便攜設備的設計思路及其代碼

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

* Implements an FIR filter in the form

* y = w[0]*x[0] + w[1]*x[1] + ...+ w[QUEUE_SIZE]*x[QUEUE_SIZE]

*

* Arguments:

* uint8 input - newest datapoint taken (that is, x[0])

* uint8 *weights - w[0]...w[QUEUE_SIZE]

* uint8 *queue - the discrete sequence x[0]...x[QUEUE_SIZE]

*

* Returns:

* The FIR-filtered output, y

*/

uint8 fir_filter(uint8 input, uint8 *weights, uint8 *queue)

{


uint8 i;

int sum = 0;


// pop first entry in the queue, then

// push new data into the last position

push_into_queue(queue,input);


// input is now x[0]

for (i=0; i {

sum += weights[i]*queue[i];

}


return (sum/QUEUE_SIZE);

}示例代碼3


// 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;

}


上一頁(yè) 1 2 3 下一頁(yè)

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>