Skip to content

Commit 39da1b6

Browse files
committed
enabled megaAVR 0-series devices, added getPulseCorrectionNanos()
1 parent 5dd8883 commit 39da1b6

File tree

7 files changed

+15
-7
lines changed

7 files changed

+15
-7
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ The latest version may not be released!
44
- Fix errors if LED_BUILTIN is not defined.
55
- Fixed error for AVR timer1. Thanks to alexbarcelo.
66
- New example IRremoteExtensionTest.
7+
- Enabled megaAVR 0-series devices.
78

89
## 3.2.0
910
- Fix for ESP32 send Error, removed `USE_SOFT_SEND_PWM` macro.

examples/SendAndReceive/SendAndReceive.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void setup() {
8686
Serial.print(F("Send signal mark duration is "));
8787
Serial.print(IrSender.periodOnTimeMicros);
8888
Serial.print(F(" us, pulse correction is "));
89-
Serial.print((uint16_t) PULSE_CORRECTION_NANOS);
89+
Serial.print(IrSender.getPulseCorrectionNanos());
9090
Serial.print(F(" ns, total period is "));
9191
Serial.print(IrSender.periodTimeMicros);
9292
Serial.println(F(" us"));

examples/SendDemo/SendDemo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void setup() {
7272
Serial.print(F("Send signal mark duration is "));
7373
Serial.print(IrSender.periodOnTimeMicros);
7474
Serial.print(F(" us, pulse correction is "));
75-
Serial.print((uint16_t) PULSE_CORRECTION_NANOS);
75+
Serial.print(IrSender.getPulseCorrectionNanos());
7676
Serial.print(F(" ns, total period is "));
7777
Serial.print(IrSender.periodTimeMicros);
7878
Serial.println(F(" us"));

examples/UnitTest/UnitTest.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void setup() {
124124
Serial.print(F("Send signal mark duration is "));
125125
Serial.print(IrSender.periodOnTimeMicros);
126126
Serial.print(F(" us, pulse correction is "));
127-
Serial.print((uint16_t) PULSE_CORRECTION_NANOS);
127+
Serial.print(IrSender.getPulseCorrectionNanos());
128128
Serial.print(F(" ns, total period is "));
129129
Serial.print(IrSender.periodTimeMicros);
130130
Serial.println(F(" us"));

src/IRSend.cpp.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ void IRsend::begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aLEDFeedba
7171
* @param aLEDFeedbackPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
7272
*/
7373
void IRsend::begin(bool aEnableLEDFeedback, uint8_t aLEDFeedbackPin) {
74-
// must exclude MEGATINYCORE, NRF5, SAMD and ESP32 because they do not use the -flto flag for compile
74+
// must exclude cores by MCUdude, MEGATINYCORE, NRF5, SAMD and ESP32 because they do not use the -flto flag for compile
7575
#if (!defined(SEND_PWM_BY_TIMER) || defined(USE_NO_SEND_PWM)) \
7676
&& !defined(SUPPRESS_ERROR_MESSAGE_FOR_BEGIN) \
7777
&& !(defined(NRF5) || defined(ARDUINO_ARCH_NRF52840)) && !defined(ARDUINO_ARCH_SAMD) \
78-
&& !defined(ESP32) && !defined(ESP8266) && !defined(MEGATINYCORE) && !defined(MINICORE) \
78+
&& !defined(ESP32) && !defined(ESP8266) && !defined(MEGATINYCORE) \
79+
&& !defined(MINICORE) && !defined(MIGHTYCORE) && !defined(MEGACORE) && !defined(MAJORCORE) \
7980
&& !(defined(__STM32F1__) || defined(ARDUINO_ARCH_STM32F1)) && !(defined(STM32F1xx) || defined(ARDUINO_ARCH_STM32))
8081
/*
8182
* This error shows up, if this function is really used/called by the user program.
@@ -468,4 +469,8 @@ void IRsend::enableIROut(uint8_t aFrequencyKHz) {
468469
IRLedOff(); // When not sending, we want it low/inactive
469470
}
470471

472+
unsigned int IRsend::getPulseCorrectionNanos() {
473+
return PULSE_CORRECTION_NANOS;
474+
}
475+
471476
/** @}*/

src/IRremoteInt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ class IRsend {
506506

507507
unsigned int periodTimeMicros;
508508
unsigned int periodOnTimeMicros; // compensated with PULSE_CORRECTION_NANOS for duration of digitalWrite.
509+
unsigned int getPulseCorrectionNanos();
509510

510511
void customDelayMicroseconds(unsigned long aMicroseconds);
511512
};

src/private/IRTimer.cpp.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@
9595
//#define IR_USE_AVR_TIMER4_HS // send pin = pin 13
9696
# endif
9797

98-
// Nano Every, Uno WiFi Rev2
99-
#elif defined(__AVR_ATmega4809__) || defined(__AVR_ATtiny1604__)
98+
// Nano Every, Uno WiFi Rev2 and similar
99+
#elif defined(__AVR_ATmega808__) || defined(__AVR_ATmega809__) || defined(__AVR_ATmega3208__) || defined(__AVR_ATmega3209__) \
100+
|| defined(__AVR_ATmega1608__) || defined(__AVR_ATmega1609__) || defined(__AVR_ATmega4808__) || defined(__AVR_ATmega4809__) || defined(__AVR_ATtiny1604__)
100101
# if !defined(IR_USE_AVR_TIMER_B)
101102
#define IR_USE_AVR_TIMER_B // send pin = pin 6
102103
# endif

0 commit comments

Comments
 (0)