Documentation
This commit is contained in:
parent
fdca153900
commit
58a2725663
21
README.md
21
README.md
|
@ -231,17 +231,20 @@ Digispark boards are tested with the recommended [ATTinyCore](https://github.com
|
|||
- ATtiny84, 85, 167 (Digispark + Digispark Pro)
|
||||
- SAMD (Zero, MKR*, **but not DUE, which is SAM architecture**)
|
||||
- ESP32
|
||||
- ESP8266. [This fork](https://github.com/crankyoldgit/IRremoteESP8266) supports an [impressive set of protocols and a lot of air conditioners](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/SupportedProtocols.md).
|
||||
- ESP8266 [This fork](https://github.com/crankyoldgit/IRremoteESP8266) supports an [impressive set of protocols and a lot of air conditioners](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/SupportedProtocols.md)
|
||||
- Sparkfun Pro Micro
|
||||
- Nano Every, Uno WiFi Rev2, nRF5 BBC MicroBit, Nano33_BLE
|
||||
- BluePill with STM32
|
||||
|
||||
We are open to suggestions for adding support to new boards, however we highly recommend you contact your supplier first and ask them to provide support from their side.
|
||||
|
||||
# Timer and pin usage
|
||||
The **receiver sample interval is generated by a timer**. On many boards this must be a hardware timer, on some, where a software timer is available, it is used. The code for the timer and the **timer selection** is located in [private/IRTimer.cpp.h](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/private/IRTimer.cpp.h).<br/>
|
||||
**Be aware that the hardware timer used for receiving is also used for analogWrite()!** E.g. <br/>
|
||||
The MinimalReceiver example uses the **TinyReceiver** library which can **only receive NEC codes, but does not require any timer**.<br/>
|
||||
The **receiver sample interval is generated by a timer**. On many boards this must be a hardware timer, on some, where a software timer is available, the software timer is used.<br/>
|
||||
Every pin can be used for receiving.<br/>
|
||||
The code for the timer and the **timer selection** is located in [private/IRTimer.cpp.h](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/private/IRTimer.cpp.h).<br/>
|
||||
**Be aware that the hardware timer used for receiving should not be used for analogWrite()!** See table below.
|
||||
|
||||
The MinimalReceiver example uses the **TinyReceiver** library, which can **only receive NEC codes, but does not require any timer**.
|
||||
|
||||
The **send PWM signal** is by default generated by software. **Therefore every pin can be used for sending**. The PWM pulse length is guaranteed to be constant by using `delayMicroseconds()`. Take care not to generate interrupts during sending with software generated PWM, otherwise you will get jitter in the generated PWM. E.g. wait for a former `Serial.print()` statement to be finished by `Serial.flush()`. Since the Arduino `micros()` function has a resolution of 4 us at 16 MHz, we always see a small jitter in the signal, which seems to be OK for the receivers.
|
||||
|
||||
|
@ -249,12 +252,12 @@ The **send PWM signal** is by default generated by software. **Therefore every p
|
|||
|-|-|
|
||||
| ![Software PWM](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/pictures/IR_PWM_by_software_jitter.png) | ![Software PWM detail](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/pictures/IR_PWM_by_software_detail.png) |
|
||||
|
||||
## Hardware-PWM signal generation for sending
|
||||
### Hardware-PWM signal generation for sending
|
||||
If you define `SEND_PWM_BY_TIMER`, the send PWM signal is generated by a hardware timer. The same timer as for the receiver is used.
|
||||
Since each hardware timer has its dedicated output pins, you must change timer to change PWN output.<br/>
|
||||
Since each hardware timer has its dedicated output pins, you must change timer to change PWM output.<br/>
|
||||
The timer and the pin usage can be adjusted in [private/IRTimer.cpp.h](https://github.com/Arduino-IRremote/Arduino-IRremote/blob/master/src/private/IRTimer.cpp.h)
|
||||
|
||||
| Board/CPU | Hardware-PWM Pin | Receive<br/>& PWM Timers | analogWrite()<br/>pins disabled |
|
||||
| Board/CPU | Hardware-PWM Pin | Receive<br/>& PWM Timers | analogWrite()<br/>pins occupied by timer |
|
||||
|--------------------------------------------------------------------------|---------------------|-------------------|-----------------------|
|
||||
| [ATtiny84](https://github.com/SpenceKonde/ATTinyCore) | **6** | **1** |
|
||||
| [ATtiny85 > 4 MHz](https://github.com/SpenceKonde/ATTinyCore) | **0**, 4 | **0**, 1 | **0**, 1 & 4 |
|
||||
|
@ -262,7 +265,7 @@ The timer and the pin usage can be adjusted in [private/IRTimer.cpp.h](https://g
|
|||
| [ATtiny167 > 4 MHz](https://github.com/SpenceKonde/ATTinyCore) | **9** | **1** | **8 - 15** |
|
||||
| [ATtiny1604](https://github.com/SpenceKonde/megaTinyCore) | **PA05** | **TCB0** |
|
||||
| [ATmega8](https://github.com/MCUdude/MiniCore) | **9** | **1** |
|
||||
| [ATmega168, **ATmega328**] | 9, **3** | 1, **2** | 9 & 10, **3 & 11** |
|
||||
| ATmega168, **ATmega328** | 9, **3** | 1, **2** | 9 & 10, **3 & 11** |
|
||||
| [ATmega1284](https://github.com/MCUdude/MightyCore) | 13, 14, 6 | 1, **2**, 3 |
|
||||
| [ATmega164, ATmega324, ATmega644](https://github.com/MCUdude/MightyCore) | 13, **14** | 1, **2** |
|
||||
| [ATmega8535 ATmega16, ATmega32](https://github.com/MCUdude/MightyCore) | **13** | **1** |
|
||||
|
@ -279,6 +282,8 @@ The timer and the pin usage can be adjusted in [private/IRTimer.cpp.h](https://g
|
|||
| [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/pinout.html) | **1**, 16, 25 | 1, **2**, 3 |
|
||||
| [Teensy 3.0 / 3.1](https://www.pjrc.com/teensy/pinout.html) | **5** | **CMT** |
|
||||
| [Teensy-LC](https://www.pjrc.com/teensy/pinout.html) | **16** | **TPM1** |
|
||||
| [BluePill / STM32F103C8T6](https://github.com/rogerclarkmelbourne/Arduino_STM32) | % | **3** | **PA6 & PA7 & PB0 & PB1** |
|
||||
| [BluePill / STM32F103C8T6](https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill) | % | **TIM4** | **PB6 & PB7 & PB8 & PB9** |
|
||||
|
||||
# Adding new protocols
|
||||
To add a new protocol is quite straightforward. Best is too look at the existing protocols to find a similar one and modify it.<br/>
|
||||
|
|
91
keywords.txt
91
keywords.txt
|
@ -9,52 +9,89 @@
|
|||
decode_results KEYWORD1
|
||||
IRrecv KEYWORD1
|
||||
IRsend KEYWORD1
|
||||
IrReceiver KEYWORD1
|
||||
IrSender KEYWORD1
|
||||
decodedIRData KEYWORD1
|
||||
|
||||
#######################################
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
|
||||
blink13 KEYWORD2
|
||||
setFeedbackLED KEYWORD2
|
||||
enableLEDFeedback KEYWORD2
|
||||
disableLEDFeedback KEYWORD2
|
||||
printIRResultShort KEYWORD2
|
||||
begin KEYWORD2
|
||||
start KEYWORD2
|
||||
available KEYWORD2
|
||||
read KEYWORD2
|
||||
stop KEYWORD2
|
||||
end KEYWORD2
|
||||
enableLEDFeedback KEYWORD2
|
||||
decode KEYWORD2
|
||||
enableIRIn KEYWORD2
|
||||
resume KEYWORD2
|
||||
enableIROut KEYWORD2
|
||||
enableIRIn KEYWORD2
|
||||
disableIRIn KEYWORD2
|
||||
sendNEC KEYWORD2
|
||||
sendSony KEYWORD2
|
||||
sendSanyo KEYWORD2
|
||||
sendMitsubishi KEYWORD2
|
||||
setSendPin KEYWORD2
|
||||
write KEYWORD2
|
||||
enableIROut KEYWORD2
|
||||
IRLedOff KEYWORD2
|
||||
sendRaw KEYWORD2
|
||||
sendRC5 KEYWORD2
|
||||
sendRC6 KEYWORD2
|
||||
sendDISH KEYWORD2
|
||||
sendSAMSUNG KEYWORD2
|
||||
sendSharp KEYWORD2
|
||||
sendSharpRaw KEYWORD2
|
||||
sendSharpAlt KEYWORD2
|
||||
sendSharpAltRaw KEYWORD2
|
||||
sendPanasonic KEYWORD2
|
||||
sendJVC KEYWORD2
|
||||
sendLG KEYWORD2
|
||||
sendLGRepeat KEYWORD2
|
||||
sendLGRaw KEYWORD2
|
||||
sendNEC KEYWORD2
|
||||
sendNECRepeat KEYWORD2
|
||||
sendNECRaw KEYWORD2
|
||||
sendOnkyo KEYWORD2
|
||||
sendApple KEYWORD2
|
||||
sendPanasonic KEYWORD2
|
||||
sendKaseikyo KEYWORD2
|
||||
sendRC5 KEYWORD2
|
||||
sendRC6 KEYWORD2
|
||||
sendSamsungRepeat KEYWORD2
|
||||
sendSamsung KEYWORD2
|
||||
sendSharp KEYWORD2
|
||||
sendSony KEYWORD2
|
||||
sendSharpRaw KEYWORD2
|
||||
sendLegoPowerFunctions KEYWORD2
|
||||
sendMagiQuest KEYWORD2
|
||||
sendPronto KEYWORD2
|
||||
sendMagiQuest KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
#######################################
|
||||
|
||||
NEC LITERAL1
|
||||
SONY LITERAL1
|
||||
SANYO LITERAL1
|
||||
MITSUBISHI LITERAL1
|
||||
RC5 LITERAL1
|
||||
RC6 LITERAL1
|
||||
PULSE_DISTANCE LITERAL1
|
||||
PULSE_WIDTH LITERAL1
|
||||
DENON LITERAL1
|
||||
DISH LITERAL1
|
||||
SAMSUNGL ITERAL1
|
||||
SHARP LITERAL1
|
||||
SHARP_ALT LITERAL1
|
||||
PANASONIC LITERAL1
|
||||
JVC LITERAL1
|
||||
LG LITERAL1
|
||||
AIWA_RC_T501 LITERAL1
|
||||
LG2 LITERAL1
|
||||
NEC LITERAL1
|
||||
PANASONIC LITERAL1
|
||||
KASEIKYO LITERAL1
|
||||
KASEIKYO_JVC LITERAL1
|
||||
KASEIKYO_DENON LITERAL1
|
||||
KASEIKYO_SHARP LITERAL1
|
||||
KASEIKYO_MITSUBISHI LITERAL1
|
||||
RC5 LITERAL1
|
||||
RC6 LITERAL1
|
||||
SAMSUNG LITERAL1
|
||||
SHARP LITERAL1
|
||||
SONY LITERAL1
|
||||
ONKYO LITERAL1
|
||||
APPLE LITERAL1
|
||||
BOSEWAVE LITERAL1
|
||||
LEGO_PF LITERAL1
|
||||
MAGIQUEST LITERAL1
|
||||
WHYNTER LITERAL1
|
||||
UNKNOWN LITERAL1
|
||||
REPEAT LITERAL1
|
||||
IR_RECEIVE_PIN LITERAL1
|
||||
IR_SEND_PIN LITERAL1
|
||||
FEEDBACK_LED_IS_ACTIVE_LOW LITERAL1
|
||||
ALTERNATIVE_IR_FEEDBACK_LED_PIN LITERAL1
|
||||
|
|
|
@ -121,7 +121,7 @@ bool IRrecv::decodeDistance() {
|
|||
|
||||
uint8_t tMaxDurationIndex = 0;
|
||||
// Count space durations. Skip leading start and trailing stop bit.
|
||||
for (i = 4; i < decodedIRData.rawDataPtr->rawlen - 2; i += 2) {
|
||||
for (i = 4; i < (uint_fast8_t) decodedIRData.rawDataPtr->rawlen - 2; i += 2) {
|
||||
uint8_t tDurationTicks = decodedIRData.rawDataPtr->rawbuf[i];
|
||||
if (tDurationTicks < sizeof(tDurationArray)) {
|
||||
tDurationArray[tDurationTicks]++;
|
||||
|
@ -150,7 +150,7 @@ bool IRrecv::decodeDistance() {
|
|||
|
||||
tMaxDurationIndex = 0;
|
||||
// Count mark durations. Skip leading start and trailing stop bit.
|
||||
for (i = 3; i < decodedIRData.rawDataPtr->rawlen - 2; i += 2) {
|
||||
for (i = 3; i < (uint_fast8_t) decodedIRData.rawDataPtr->rawlen - 2; i += 2) {
|
||||
uint8_t tDurationTicks = decodedIRData.rawDataPtr->rawbuf[i];
|
||||
if (tDurationTicks < sizeof(tDurationArray)) {
|
||||
tDurationArray[tDurationTicks]++;
|
||||
|
|
|
@ -122,9 +122,9 @@
|
|||
|
||||
#elif defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
|
||||
# if !defined(IR_USE_AVR_TIMER1)
|
||||
#define IR_USE_AVR_TIMER1
|
||||
#define IR_USE_AVR_TIMER1 // send pin = pin PB1 / 8
|
||||
# endif
|
||||
#define USE_TIMER_CHANNEL_B // send pin = pin PB1
|
||||
#define USE_TIMER_CHANNEL_B
|
||||
|
||||
//ATtiny85
|
||||
#elif defined(__AVR_ATtiny85__)
|
||||
|
@ -258,7 +258,7 @@
|
|||
#define IR_SEND_PIN 8
|
||||
|
||||
# elif defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
|
||||
#define IR_SEND_PIN PIN_PB1 // OC1BU at ATTinyCore (BU/PB1, BV/PB3, BW/PB5 and BX/PB7 are available) see ENABLE_SEND_PWM_BY_TIMER
|
||||
#define IR_SEND_PIN PIN_PB1 // OC1BU / PB1 / Pin8 at ATTinyCore (BU/PB1, BV/PB3, BW/PB5 and BX/PB7 are available) see ENABLE_SEND_PWM_BY_TIMER
|
||||
|
||||
# else
|
||||
#define IR_SEND_PIN 9 // OC1A Arduino Duemilanove, Diecimila, LilyPad, Sparkfun Pro Micro, Leonardo, MH-ET Tiny88 etc.
|
||||
|
|
Loading…
Reference in New Issue