void IrReceiverSampler::enable() { reset(); noInterrupts(); IR_RECV_CONFIG_TICKS(); IR_RECV_ENABLE_INTR; interrupts(); }
void IRrecv::enableIRIn(void) { IRrecvBase::enableIRIn(); // setup pulse clock timer interrupt cli(); IR_RECV_CONFIG_TICKS(); IR_RECV_ENABLE_INTR; sei(); }
/* Initializes receiving and starts up the 50us interrupt timer. Call this to initialize * and call it again to resume receiving after completing the decoding. Previous versions of * IRLib had a "resume" method but you should use this in either initializing or resuming. */ void IRrecv::enableIRIn(void) { //If newDataAvailable means that we did an auto resume and while the decoder //was processing the first frame, the second frame completed. We came here //essentially saying "get me another frame" but the another frame was already here. //Therefore we get out, the decoder will call getResults which will be true and //everything proceeds as normal. if(recvGlobal.newDataAvailable) return; recvGlobal.decoderWantsData=true;//otherwise he wouldn't have called //We cannot simply restart the receiver because if it did an auto resume then it is //already running. If state is STATE_FINISHED it means the ISR finished and did not auto //resume. If IRLib_didIROut is true then the send object shut us down due to the hardware //conflict between PWM output and the timer interrupt. It means we need to reinitialize //everything. if( (recvGlobal.currentState==STATE_FINISHED) || IRLib_didIROut ) { IRrecvBase::enableIRIn(); recvGlobal.timer = 0; // setup pulse clock timer interrupt noInterrupts(); IR_RECV_CONFIG_TICKS(); IR_RECV_ENABLE_INTR; interrupts(); } }