| 1 | /* IRLibHardware.cpp |
|---|
| 2 | * Part of IRLib Library for Arduino receiving, decoding, and sending |
|---|
| 3 | * infrared signals. See COPYRIGHT.txt and LICENSE.txt for more information. |
|---|
| 4 | * |
|---|
| 5 | * We need a way for the sending object to communicate with the receiving object. |
|---|
| 6 | * Sending an IR signal can disable further receiving because the timer needed for the 50us |
|---|
| 7 | * interrupts is used to modulate the frequency of the PWM output signal. We need a flag |
|---|
| 8 | * for the send object to inform you receive object that this occurred. |
|---|
| 9 | * |
|---|
| 10 | * Some applications do sending only and would only require you to include IRLibSendBase.h |
|---|
| 11 | * while others only do receiving/decoding and would include IRLibRecvBase.h but not |
|---|
| 12 | * IRLibSendBase.h. The only include file that is used by both sending and receiving is |
|---|
| 13 | * the IRLibHardware.h which was formerly called IRLibTimer.h. Therefore we put the flag |
|---|
| 14 | * in this newly created IRLibHardware.cpp module. That way a send only can put the flag |
|---|
| 15 | * here whether or not there is a receiver. Similarly the receiver can check the flag |
|---|
| 16 | * whether or not there is a sender. |
|---|
| 17 | * |
|---|
| 18 | * The below is a global flag IRLib_didIROut that gets set true with every call to enableIROut. |
|---|
| 19 | * Then any call to IRrecv::enableIRIn checks this to see if it needs to restart the ISR. |
|---|
| 20 | * Regardless IRrecv::enableIRIn will always reset it it false for the next time. |
|---|
| 21 | * Note as always if you try to send while in the middle of receiving, the partially received |
|---|
| 22 | * data is lost. If the application wishes to create a system where the sending waits until |
|---|
| 23 | * the receiver is idle, the programmer can implement such a system themselves and deal with |
|---|
| 24 | * the consequences. |
|---|
| 25 | * |
|---|
| 26 | * The bottom line is the application no longer needs to figure out if it needs to |
|---|
| 27 | * call enableIRIn or the "resume" method. There is no more "resume". You always do |
|---|
| 28 | * enableIRIn after every decode and the system handles it. |
|---|
| 29 | */ |
|---|
| 30 | #include "IRLibHardware.h" |
|---|
| 31 | uint8_t IRLib_didIROut=false; |
|---|