if ((TIM1->IER & TIM1_IER_CC1IE) && (TIM1->SR1 & TIM1_SR1_CC1IF)) { TIM1->SR1 &= (u8) (~TIM1_SR1_CC1IF); TIM1->CCER1 ^= TIM1_CCER1_CC1P; //reverse the capture edge last = cur; cur = TIM1_GetCapture1();//得到time1现在的时钟时间, ir_eng.g_overflow_cnt = 0; if (ir_eng.g_ir_state == IR_START) { /* start to receive wave */ ir_eng.g_ir_state = IR_ING; return; } else if (ir_eng.g_ir_state == IR_ING) { width = cur - last; //得到每一段时间的长度 100 - 65000 = 635 所以说循环是没有任何问题的 ret = push_wave(&_irwave, width); if (ret == 0) { /* type ahead upper limit */ ir_eng.g_ir_state = IR_SUCC; notify(EV_IR_FINISH); stop_capture(); } return; } }
红外接收代码解析
最新推荐文章于 2024-05-15 05:37:24 发布