|
39 | 39 | # define BLINKLED_ON() (PORTD |= B00000001) |
40 | 40 | # define BLINKLED_OFF() (PORTD &= B11111110) |
41 | 41 |
|
| 42 | +// No system LED on ESP32, disable blinking |
| 43 | +#elif defined(ESP32) |
| 44 | +# define BLINKLED 255 |
| 45 | +# define BLINKLED_ON() 1 |
| 46 | +# define BLINKLED_OFF() 1 |
42 | 47 | #else |
43 | 48 | # define BLINKLED 13 |
44 | | - #define BLINKLED_ON() (PORTB |= B00100000) |
| 49 | +# define BLINKLED_ON() (PORTB |= B00100000) |
45 | 50 | # define BLINKLED_OFF() (PORTB &= B11011111) |
46 | 51 | #endif |
47 | 52 |
|
|
125 | 130 |
|
126 | 131 | // ATtiny84 |
127 | 132 | #elif defined(__AVR_ATtiny84__) |
128 | | - #define IR_USE_TIMER1 // tx = pin 6 |
| 133 | + #define IR_USE_TIMER1 // tx = pin 6 |
129 | 134 |
|
130 | 135 | //ATtiny85 |
131 | 136 | #elif defined(__AVR_ATtiny85__) |
132 | | - #define IR_USE_TIMER_TINY0 // tx = pin 1 |
| 137 | + #define IR_USE_TIMER_TINY0 // tx = pin 1 |
133 | 138 |
|
| 139 | +#elif defined(ESP32) |
| 140 | + #define IR_TIMER_USE_ESP32 |
| 141 | +#else |
134 | 142 | // Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc |
135 | 143 | // ATmega48, ATmega88, ATmega168, ATmega328 |
136 | | -#else |
137 | 144 | //#define IR_USE_TIMER1 // tx = pin 9 |
138 | 145 | #define IR_USE_TIMER2 // tx = pin 3 |
139 | 146 |
|
|
538 | 545 |
|
539 | 546 | #define TIMER_PWM_PIN 1 /* ATtiny85 */ |
540 | 547 |
|
| 548 | +//--------------------------------------------------------- |
| 549 | +// ESP32 (ESP8266 should likely be added here too) |
| 550 | +// |
| 551 | + |
| 552 | +// ESP32 has it own timer API and does not use these macros, but to avoid ifdef'ing |
| 553 | +// them out in the common code, they are defined to no-op. This allows the code to compile |
| 554 | +// (which it wouldn't otherwise) but irsend will not work until ESP32 specific code is written |
| 555 | +// for that -- merlin |
| 556 | +// As a warning, sending timing specific code from an ESP32 can be challenging if you need 100% |
| 557 | +// reliability because the arduino code may be interrupted and cause your sent waveform to be the |
| 558 | +// wrong length. This is specifically an issue for neopixels which require 800Khz resolution. |
| 559 | +// IR may just work as is with the common code since it's lower frequency, but if not, the other |
| 560 | +// way to do this on ESP32 is using the RMT built in driver like in this incomplete library below |
| 561 | +// https://github.com/ExploreEmbedded/ESP32_RMT |
| 562 | +#elif defined(IR_TIMER_USE_ESP32) |
| 563 | +#define TIMER_RESET |
| 564 | +#define TIMER_ENABLE_PWM |
| 565 | +#define TIMER_DISABLE_PWM Serial.println("IRsend not implemented for ESP32 yet"); |
| 566 | +#define TIMER_ENABLE_INTR |
| 567 | +#define TIMER_DISABLE_INTR |
| 568 | +#define TIMER_INTR_NAME |
| 569 | + |
541 | 570 | //--------------------------------------------------------- |
542 | 571 | // Unknown Timer |
543 | 572 | // |
|
0 commit comments