Skip to content

Commit 248012e

Browse files
committed
ESP8266 support
1 parent cf374e6 commit 248012e

File tree

24 files changed

+374
-227
lines changed

24 files changed

+374
-227
lines changed

.github/workflows/LibraryBuild.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
- TinyCore:avr:tiny32
5757
- arduino:samd:arduino_zero_native
5858
- MegaCore:avr:128:bootloader=no_bootloader,eeprom=keep,BOD=2v7,LTO=Os_flto,clock=8MHz_internal # ATmega128
59+
- esp8266:esp8266:d1_mini:eesz=4M3M,xtal=80
5960
- esp32:esp32:featheresp32:FlashFreq=80
6061
- STM32:stm32:GenF1:pnum=BLUEPILL_F103C8
6162
- STM32:stm32:GenL0:pnum=THUNDERPACK_L072
@@ -96,68 +97,71 @@ jobs:
9697
All: -DSEND_PWM_BY_TIMER
9798

9899
- arduino-boards-fqbn: arduino:megaavr:nona4809:mode=off
99-
sketches-exclude: IR2Keyboard,MinimalReceiver,IRDispatcherDemo
100+
sketches-exclude: MinimalReceiver,IRDispatcherDemo
100101

101102
- arduino-boards-fqbn: arduino:samd:arduino_zero_native
102103
sketches-exclude: MinimalReceiver,IRDispatcherDemo
103104

104105
- arduino-boards-fqbn: megaTinyCore:megaavr:atxy4:chip=1604,clock=16internal
105106
platform-url: http://drazzy.com/package_drazzy.com_index.json
106-
sketches-exclude: MinimalReceiver,IRDispatcherDemo // digitalWriteFast.h not available for this board
107+
sketches-exclude: MinimalReceiver,IRDispatcherDemo # digitalWriteFast.h not available for this board
107108

108109
- arduino-boards-fqbn: digistump:avr:digispark-tiny:clock=clock1
109110
platform-url: https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
110111
required-libraries: ATtinySerialOut
111-
sketches-exclude: IR2Keyboard,UnitTest,ControlRelay,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
112+
sketches-exclude: UnitTest,ControlRelay,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
112113
build-properties: # the flags were put in compiler.cpp.extra_flags
113114
All: -DEXCLUDE_EXOTIC_PROTOCOLS
114115

115116
- arduino-boards-fqbn: digistump:avr:MHETtiny88 # ATtiny88 China clone board @16 MHz
116117
platform-url: https://raw.githubusercontent.com/ArminJo/DigistumpArduino/master/package_digistump_index.json
117118
required-libraries: ATtinySerialOut
118-
sketches-exclude: IR2Keyboard,UnitTest,ControlRelay,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
119+
sketches-exclude: UnitTest,ControlRelay,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM, missing digitalPinToInterrupt
119120
build-properties: # the flags were put in compiler.cpp.extra_flags
120121
All: -DEXCLUDE_EXOTIC_PROTOCOLS
121122

122123
- arduino-boards-fqbn: ATTinyCore:avr:attinyx5:chip=85,clock=1internal
123124
platform-url: http://drazzy.com/package_drazzy.com_index.json
124125
required-libraries: ATtinySerialOut
125-
sketches-exclude: IR2Keyboard,UnitTest,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM
126+
sketches-exclude: UnitTest,ReceiveAndSend,ReceiveDump,SendProntoDemo,SendBoseWaveDemo,MicroGirs,IRDispatcherDemo,SendLGAirConditionerDemo,ReceiverTimingAnalysis # Does not fit in FLASH or RAM
126127
build-properties: # the flags were put in compiler.cpp.extra_flags
127128
All: -DEXCLUDE_EXOTIC_PROTOCOLS
128129

129130
- arduino-boards-fqbn: TinyCore:avr:tiny32
130131
platform-url: https://raw.githubusercontent.com/xukangmin/TinyCore/master/avr/package/package_tinycore_index.json
131-
sketches-exclude: IR2Keyboard
132132

133133
- arduino-boards-fqbn: MegaCore:avr:128:bootloader=no_bootloader,eeprom=keep,BOD=2v7,LTO=Os_flto,clock=8MHz_internal
134134
platform-url: https://mcudude.github.io/MegaCore/package_MCUdude_MegaCore_index.json
135135
arduino-platform: arduino:avr,MegaCore:avr # gcc is taken from arduino:avr
136-
sketches-exclude: IR2Keyboard,MinimalReceiver,IRDispatcherDemo # no HID.h
136+
sketches-exclude: MinimalReceiver,IRDispatcherDemo # digitalWriteFast.h not available for this board?
137+
138+
- arduino-boards-fqbn: esp8266:esp8266:d1_mini:eesz=4M3M,xtal=80
139+
platform-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json
140+
sketches-exclude: MinimalReceiver
137141

138142
- arduino-boards-fqbn: esp32:esp32:featheresp32:FlashFreq=80
139143
platform-url: https://dl.espressif.com/dl/package_esp32_index.json
140-
sketches-exclude: IR2Keyboard,MinimalReceiver # undefined reference to `TwoWire::onReceive(void (*)(int))'
144+
sketches-exclude: MinimalReceiver # undefined reference to `TwoWire::onReceive(void (*)(int))'
141145

142146
- arduino-boards-fqbn: STM32:stm32:GenF1:pnum=BLUEPILL_F103C8 # ST version
143147
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
144-
sketches-exclude: IR2Keyboard,MinimalReceiver
148+
sketches-exclude: MinimalReceiver
145149

146150
- arduino-boards-fqbn: STM32:stm32:GenL0:pnum=THUNDERPACK_L072 # ST version
147151
platform-url: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
148-
sketches-exclude: IR2Keyboard,MinimalReceiver,IRDispatcherDemo
152+
sketches-exclude: MinimalReceiver,IRDispatcherDemo
149153

150154
- arduino-boards-fqbn: stm32duino:STM32F1:genericSTM32F103C # Roger Clark version
151155
platform-url: http://dan.drown.org/stm32duino/package_STM32duino_index.json
152-
sketches-exclude: IR2Keyboard,MinimalReceiver
156+
sketches-exclude: MinimalReceiver
153157

154158
- arduino-boards-fqbn: SparkFun:avr:promicro
155159
arduino-platform: arduino:avr,SparkFun:avr
156160
platform-url: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json # Arduino URL is not required here
157161

158162
- arduino-boards-fqbn: sandeepmistry:nRF5:BBCmicrobit
159163
platform-url: https://sandeepmistry.github.io/arduino-nRF5/package_nRF5_boards_index.json
160-
sketches-exclude: IR2Keyboard,IRDispatcherDemo,MicroGirs,MinimalReceiver # no tone()
164+
sketches-exclude: IRDispatcherDemo,MicroGirs,MinimalReceiver # no tone()
161165

162166
# Do not cancel all jobs / architectures if one job fails
163167
fail-fast: false

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# IRremote Arduino Library
22
Available as Arduino library "IRremote"
33

4-
### [Version 3.1.2](https://github.com/Arduino-IRremote/Arduino-IRremote/archive/master.zip) - work in progress
4+
### [Version 3.1.1](https://github.com/Arduino-IRremote/Arduino-IRremote/archive/master.zip) - work in progress
55

66
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
77
[![Commits since latest](https://img.shields.io/github/commits-since/Arduino-IRremote/Arduino-IRremote/latest)](https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master)
@@ -201,7 +201,7 @@ If you are using Sloeber as your IDE, you can easily define global symbols with
201201
- ATtiny84, 85
202202
- SAMD21 (DUE, Zero)
203203
- ESP32
204-
- [ESP8266 is supported in a fork](https://github.com/crankyoldgit/IRremoteESP8266) based on an old codebase. It works well given that perfectly timed sub millisecond interrupts are different on that chip.
204+
- ESP8266. [This fork](https://github.com/crankyoldgit/IRremoteESP8266) supports an [impressive set of protocols](https://github.com/crankyoldgit/IRremoteESP8266/blob/master/SupportedProtocols.md).
205205
- Sparkfun Pro Micro
206206
- Nano Every, Uno WiFi Rev2, nRF5 BBC MicroBit, Nano33_BLE
207207

@@ -225,7 +225,7 @@ The timer and the pin usage can be adjusted in [private/IRTimer.cpp.h](https://g
225225
|--------------------------------------------------------------------------|---------------------|-------------------|
226226
| [ATtiny84](https://github.com/SpenceKonde/ATTinyCore) | **6** | **1** |
227227
| [ATtiny85 > 1 MHz](https://github.com/SpenceKonde/ATTinyCore) | **1**, 4 | **0**, 1 |
228-
| [ATtiny1604](https://github.com/SpenceKonde/megaTinyCore) | % | **TCB0** |
228+
| [ATtiny1604](https://github.com/SpenceKonde/megaTinyCore) | **PA05** | **TCB0** |
229229
| [ATmega8](https://github.com/MCUdude/MiniCore) | **9** | **1** |
230230
| [ATmega48, ATmega88, ATmega168, **ATmega328**](https://github.com/MCUdude/MiniCore) | **3**, 9 | 1, **2** |
231231
| [ATmega1284](https://github.com/MCUdude/MightyCore) | 13, 14, 6 | 1, **2**, 3 |
@@ -234,7 +234,7 @@ The timer and the pin usage can be adjusted in [private/IRTimer.cpp.h](https://g
234234
| [ATmega64, ATmega128, ATmega1281, ATmega2561](https://github.com/MCUdude/MegaCore) | **13** | **1** |
235235
| [ATmega8515, ATmega162](https://github.com/MCUdude/MajorCore) | **13** | **1** |
236236
| ATmega1280, ATmega2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 |
237-
| ATmega4809 | 5, 6, **9**, 11, 46 | **TCB0** |
237+
| ATmega4809 | **A4** | **TCB0** |
238238
| Leonardo (Atmega32u4) | 5, **9**, 13 | 1, 3, **4_HS** |
239239
| Zero (SAMD) | \*, **9** | **TC3** |
240240
| [ESP32](http://esp32.net/) | **4**, all pins | **1** |

examples/ControlRelay/PinDefinitionsAndMore.h

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
* -----------------------------------------
3232
* DEFAULT/AVR 2 3 4
3333
* ATtinyX5 0 4 3
34-
* ATtin167 9 8 5 // Digispark pro number schema
35-
* ATtin167 3 2 7
36-
* ATtin3217 10 11 3 // TinyCore schema
37-
* ATtin1604 10 11 % // MegaTinyCore schema
34+
* ATtiny167 9 8 5 // Digispark pro number schema
35+
* ATtiny167 3 2 7
36+
* ATtiny3217 10 11 3 // TinyCore schema
37+
* ATtiny1604 2 PA5/3 %
3838
* SAMD21 3 4 5
3939
* ESP8266 14 // D5 12 // D6 %
4040
* ESP32 15 4 %
@@ -45,20 +45,23 @@
4545
//
4646
#if defined(ESP8266)
4747
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
48-
#define IR_RECEIVE_PIN 14 // D5
49-
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
50-
#define tone(a,b,c) void() // tone() inhibits receive timer
48+
#define IR_RECEIVE_PIN 14 // D5
49+
#define IR_RECEIVE_PIN_STRING "D5"
50+
#define IR_SEND_PIN 12 // D6 - D4/pin 2 is internal LED
51+
#define IR_SEND_PIN_STRING "D6"
52+
#define tone(a,b,c) void() // tone() inhibits receive timer
5153
#define noTone(a) void()
52-
#define TONE_PIN 42 // Dummy for examples using it
53-
#define IR_TIMING_TEST_PIN 13 // D7
54+
#define TONE_PIN 42 // Dummy for examples using it
55+
#define IR_TIMING_TEST_PIN 13 // D7
56+
#define APPLICATION_PIN 0 // D3
5457

5558
#elif defined(ESP32)
56-
#define IR_RECEIVE_PIN 15 // D15
57-
#define IR_SEND_PIN 4 // D4
59+
#define IR_RECEIVE_PIN 15 // D15
60+
#define IR_SEND_PIN 4 // D4
5861
#define tone(a,b,c) void() // no tone() available on ESP32
5962
#define noTone(a) void()
60-
#define TONE_PIN 42 // Dummy for examples using it
61-
#define APPLICATION_PIN 16 // RX2 pin
63+
#define TONE_PIN 42 // Dummy for examples using it
64+
#define APPLICATION_PIN 16 // RX2 pin
6265

6366
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
6467
// BluePill in 2 flavors
@@ -69,6 +72,7 @@
6972
#define IR_SEND_PIN_STRING "PA7"
7073
#define TONE_PIN PA3
7174
#define IR_TIMING_TEST_PIN PA5
75+
#define APPLICATION_PIN PA2
7276

7377
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
7478
#include "ATtinySerialOut.h" // Available as Arduino library. saves 370 bytes program space and 38 bytes RAM for digistump core
@@ -86,7 +90,6 @@
8690
#define IR_SEND_PIN 8 // PA2 - on Digispark board labeled as pin 8
8791
#define TONE_PIN 5 // PA7
8892
#define IR_TIMING_TEST_PIN 10 // PA4
89-
9093
# else
9194
#define IR_RECEIVE_PIN 3
9295
#define IR_SEND_PIN 2
@@ -105,6 +108,7 @@
105108
#define IR_RECEIVE_PIN 10
106109
#define IR_SEND_PIN 11
107110
#define TONE_PIN 3
111+
#define APPLICATION_PIN 5
108112

109113
#elif defined(__AVR_ATtiny1604__)
110114
#define IR_RECEIVE_PIN 2 // To be compatible with interrupt example, pin 2 is chosen here.
@@ -191,6 +195,9 @@
191195
#define IR_TIMING_TEST_PIN 7
192196
#endif // defined(ESP8266)
193197

198+
#if !defined (FLASHEND)
199+
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
200+
#endif
194201
/*
195202
* Helper macro for getting a macro definition as string
196203
*/

examples/ReceiveAndSend/PinDefinitionsAndMore.h

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
* -----------------------------------------
3232
* DEFAULT/AVR 2 3 4
3333
* ATtinyX5 0 4 3
34-
* ATtin167 9 8 5 // Digispark pro number schema
35-
* ATtin167 3 2 7
36-
* ATtin3217 10 11 3 // TinyCore schema
37-
* ATtin1604 10 11 % // MegaTinyCore schema
34+
* ATtiny167 9 8 5 // Digispark pro number schema
35+
* ATtiny167 3 2 7
36+
* ATtiny3217 10 11 3 // TinyCore schema
37+
* ATtiny1604 2 PA5/3 %
3838
* SAMD21 3 4 5
3939
* ESP8266 14 // D5 12 // D6 %
4040
* ESP32 15 4 %
@@ -45,20 +45,23 @@
4545
//
4646
#if defined(ESP8266)
4747
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW
48-
#define IR_RECEIVE_PIN 14 // D5
49-
#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED
50-
#define tone(a,b,c) void() // tone() inhibits receive timer
48+
#define IR_RECEIVE_PIN 14 // D5
49+
#define IR_RECEIVE_PIN_STRING "D5"
50+
#define IR_SEND_PIN 12 // D6 - D4/pin 2 is internal LED
51+
#define IR_SEND_PIN_STRING "D6"
52+
#define tone(a,b,c) void() // tone() inhibits receive timer
5153
#define noTone(a) void()
52-
#define TONE_PIN 42 // Dummy for examples using it
53-
#define IR_TIMING_TEST_PIN 13 // D7
54+
#define TONE_PIN 42 // Dummy for examples using it
55+
#define IR_TIMING_TEST_PIN 13 // D7
56+
#define APPLICATION_PIN 0 // D3
5457

5558
#elif defined(ESP32)
56-
#define IR_RECEIVE_PIN 15 // D15
57-
#define IR_SEND_PIN 4 // D4
59+
#define IR_RECEIVE_PIN 15 // D15
60+
#define IR_SEND_PIN 4 // D4
5861
#define tone(a,b,c) void() // no tone() available on ESP32
5962
#define noTone(a) void()
60-
#define TONE_PIN 42 // Dummy for examples using it
61-
#define APPLICATION_PIN 16 // RX2 pin
63+
#define TONE_PIN 42 // Dummy for examples using it
64+
#define APPLICATION_PIN 16 // RX2 pin
6265

6366
#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1)
6467
// BluePill in 2 flavors
@@ -69,6 +72,7 @@
6972
#define IR_SEND_PIN_STRING "PA7"
7073
#define TONE_PIN PA3
7174
#define IR_TIMING_TEST_PIN PA5
75+
#define APPLICATION_PIN PA2
7276

7377
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
7478
#include "ATtinySerialOut.h" // Available as Arduino library. saves 370 bytes program space and 38 bytes RAM for digistump core
@@ -86,7 +90,6 @@
8690
#define IR_SEND_PIN 8 // PA2 - on Digispark board labeled as pin 8
8791
#define TONE_PIN 5 // PA7
8892
#define IR_TIMING_TEST_PIN 10 // PA4
89-
9093
# else
9194
#define IR_RECEIVE_PIN 3
9295
#define IR_SEND_PIN 2
@@ -105,6 +108,7 @@
105108
#define IR_RECEIVE_PIN 10
106109
#define IR_SEND_PIN 11
107110
#define TONE_PIN 3
111+
#define APPLICATION_PIN 5
108112

109113
#elif defined(__AVR_ATtiny1604__)
110114
#define IR_RECEIVE_PIN 2 // To be compatible with interrupt example, pin 2 is chosen here.
@@ -191,6 +195,9 @@
191195
#define IR_TIMING_TEST_PIN 7
192196
#endif // defined(ESP8266)
193197

198+
#if !defined (FLASHEND)
199+
#define FLASHEND 0xFFFF // Dummy value for platforms where FLASHEND is not defined
200+
#endif
194201
/*
195202
* Helper macro for getting a macro definition as string
196203
*/

examples/ReceiveAndSend/ReceiveAndSend.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,18 @@ void setup() {
9191
pinMode(STATUS_PIN, OUTPUT);
9292

9393
Serial.print(F("Ready to receive IR signals at pin "));
94+
#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)
95+
Serial.println(IR_RECEIVE_PIN_STRING);
96+
#else
9497
Serial.println(IR_RECEIVE_PIN);
98+
#endif
9599

96100
Serial.print(F("Ready to send IR signals at pin "));
101+
#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)
102+
Serial.println(IR_SEND_PIN_STRING);
103+
#else
97104
Serial.print(IR_SEND_PIN);
105+
#endif
98106
Serial.print(F(" on press of button at pin "));
99107
Serial.println(SEND_BUTTON_PIN);
100108

0 commit comments

Comments
 (0)