RP2040 support added.
- Refactored IRTimer.hpp. - Refactored IR_SEND_PIN and IrSender.sendPin handling. - Renamed IR_SEND_DUTY_CYCLE to IR_SEND_DUTY_CYCLE_PERCENT. - Fixed bugs for SEND_PWM_BY_TIMER active.
This commit is contained in:
parent
2077fd1f50
commit
1ce638b7f6
|
@ -54,7 +54,7 @@ jobs:
|
|||
- arduino:samd:arduino_zero_native
|
||||
- arduino:mbed:nano33ble
|
||||
- arduino:mbed_rp2040:pico
|
||||
- rp2040:rp2040:rpipico:flash=2097152_0,freq=125,opt=Small,rtti=Disabled,dbgport=Disabled,dbglvl=None,usbstack=picosdk
|
||||
- rp2040:rp2040:arduino_nano_connect
|
||||
- digistump:avr:digispark-tiny:clock=clock16
|
||||
- ATTinyCore:avr:attinyx5micr:LTO=enable,sketchclock=16pll
|
||||
- ATTinyCore:avr:attinyx7micr:LTO=enable,sketchclock=16external,pinmapping=new,millis=enabled
|
||||
|
@ -125,7 +125,7 @@ jobs:
|
|||
build-properties: # the flags were put in compiler.cpp.extra_flags
|
||||
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100
|
||||
|
||||
- arduino-boards-fqbn: rp2040:rp2040:rpipico:flash=2097152_0,freq=125,opt=Small,rtti=Disabled,dbgport=Disabled,dbglvl=None,usbstack=picosdk
|
||||
- arduino-boards-fqbn: rp2040:rp2040:arduino_nano_connect
|
||||
platform-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
build-properties: # the flags were put in compiler.cpp.extra_flags
|
||||
IRremoteExtensionTest: -DRAW_BUFFER_LENGTH=100 -DSEND_PWM_BY_TIMER
|
||||
|
|
14
README.md
14
README.md
|
@ -41,7 +41,6 @@ This library enables you to send and receive using infra-red signals on an Ardui
|
|||
+ [Incompatibilities to other libraries and Arduino commands like tone() and analogWrite()](https://github.com/Arduino-IRremote/Arduino-IRremote#incompatibilities-to-other-libraries-and-arduino-commands-like-tone-and-analogwrite)
|
||||
+ [Hardware-PWM signal generation for sending](https://github.com/Arduino-IRremote/Arduino-IRremote#hardware-pwm-signal-generation-for-sending)
|
||||
+ [Why do we use 33% duty cycle for sending](https://github.com/Arduino-IRremote/Arduino-IRremote#why-do-we-use-33-duty-cycle-for-sending)
|
||||
|
||||
- [How we decode signals](https://github.com/Arduino-IRremote/Arduino-IRremote#how-we-decode-signals)
|
||||
- [NEC encoding diagrams](https://github.com/Arduino-IRremote/Arduino-IRremote#nec-encoding-diagrams)
|
||||
- [Quick comparison of 4 Arduino IR receiving libraries](https://github.com/Arduino-IRremote/Arduino-IRremote#quick-comparison-of-4-arduino-ir-receiving-libraries)
|
||||
|
@ -330,8 +329,8 @@ Modify them by enabling / disabling them, or change the values if applicable.
|
|||
| Name | File | Default value | Description |
|
||||
|-|-|-|-|
|
||||
| `RAW_BUFFER_LENGTH` | Before `#include <IRremote.hpp>` | 100 | Buffer size of raw input buffer. Must be even! 100 is sufficient for *regular* protocols of up to 48 bits, but for most air conditioner protocols a value of up to 750 is required. Use the ReceiveDump example to find smallest value for your requirements. |
|
||||
| `IR_SEND_PIN` | Before `#include <IRremote.hpp>` | disabled | If specified (as constant), reduces program size and improves send timing for AVR. |
|
||||
| `SEND_PWM_BY_TIMER` | Before `#include <IRremote.hpp>` | disabled | Disable carrier PWM generation in software and use (restricted) hardware PWM except for ESP32 where both modes are using the flexible `hw_timer_t`. |
|
||||
| `IR_SEND_PIN` | Before `#include <IRremote.hpp>` | disabled | If specified (as constant), reduces program size and improves send timing for AVR. If you want to use a runtime valiable send pin e.g. with `setSendPin(uint8_t aSendPinNumber)` , you must disable this macro. |
|
||||
| `SEND_PWM_BY_TIMER` | Before `#include <IRremote.hpp>` | disabled | Disable carrier PWM generation in software and use (restricted) hardware PWM. Enabled for ESP32 and RP2040 in all examples. |
|
||||
| `USE_NO_SEND_PWM` | Before `#include <IRremote.hpp>` | disabled | Use no carrier PWM, just simulate an **active low** receiver signal. Overrides `SEND_PWM_BY_TIMER` definition. |
|
||||
| `USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN` | Before `#include <IRremote.hpp>` | disabled | Use or simulate open drain output mode at send pin. **Attention, active state of open drain is LOW**, so connect the send LED between positive supply and send pin! |
|
||||
| `EXCLUDE_EXOTIC_PROTOCOLS` | Before `#include <IRremote.hpp>` | disabled | If activated, BOSEWAVE, WHYNTER and LEGO_PF are excluded in `decode()` and in sending with `IrSender.write()`. Saves up to 650 bytes program space. |
|
||||
|
@ -342,7 +341,7 @@ Modify them by enabling / disabling them, or change the values if applicable.
|
|||
| `NO_LED_FEEDBACK_CODE` | Before `#include <IRremote.hpp>` | disabled | This completely disables the LED feedback code for send and receive, thus saving around 100 bytes program space for receiving, around 500 bytes for sending and halving the receiver ISR processing time. |
|
||||
| `IR_INPUT_IS_ACTIVE_HIGH` | Before `#include <IRremote.hpp>` | disabled | Enable it if you use a RF receiver, which has an active HIGH output signal. |
|
||||
| `DEBUG` | IRremoteInt.h | disabled | Enables lots of lovely debug output. |
|
||||
| `IR_SEND_DUTY_CYCLE` | IRremoteInt.h | 30 | Duty cycle of IR send signal. |
|
||||
| `IR_SEND_DUTY_CYCLE_PERCENT` | IRremote.h | 30 | Duty cycle of IR send signal. |
|
||||
| `MICROS_PER_TICK` | IRremoteInt.h | 50 | Resolution of the raw input buffer data. Corresponds to 2 pulses of each 26.3 µs at 38 kHz. |
|
||||
| `IR_USE_AVR_TIMER*` | private/IRTimer.hpp | | Selection of timer to be used for generating IR receiving sample interval. |
|
||||
|-|-|-|-|
|
||||
|
@ -377,12 +376,12 @@ ATtiny and Digispark boards are only tested with the recommended [ATTinyCore](ht
|
|||
- ATmega4809 (Nano every)
|
||||
- ATtiny84, 85, 167 (Digispark + Digispark Pro)
|
||||
- SAMD (Zero, MKR*, **but not DUE, which is SAM architecture**)
|
||||
- ESP32
|
||||
- ESP32 (ESP32 C3 since board package 2.0.2 from Espressif)
|
||||
- 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
|
||||
- RP2040 based boards (Raspberry Pi Pico, etc.)
|
||||
- RP2040 based boards (Raspberry Pi Pico, Nano RP2040 Connect etc.)
|
||||
|
||||
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.<br/>
|
||||
If you can provide **examples of using a periodic timer for interrupts** for the new board, and the board name for selection in the Arduino IDE, then you have way better chances to get your board supported by IRremote.
|
||||
|
@ -457,9 +456,10 @@ The timer and the pin usage can be adjusted in [private/IRTimer.hpp](https://git
|
|||
| [Teensy-LC](https://www.pjrc.com/teensy/pinout.html) | **TPM1** | **16** | 17 |
|
||||
| [Teensy 3.0 - 3.6](https://www.pjrc.com/teensy/pinout.html) | **CMT** | **5** |
|
||||
| [Teensy 4.0 - 4.1](https://www.pjrc.com/teensy/pinout.html) | **FlexPWM1.3** | **8** | 7, 25 |
|
||||
| [BluePill / STM32F103C8T6](https://github.com/rogerclarkmelbourne/Arduino_STM32) | **3** | % | **PA6 & PA7 & PB0 & PB1** |
|
||||
| [BluePill / STM32F103C8T6](https://github.com/stm32duino/Arduino_Core_STM32) | **3** | % | **PA6 & PA7 & PB0 & PB1** |
|
||||
| [BluePill / STM32F103C8T6](https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill) | **TIM4** | % | **PB6 & PB7 & PB8 & PB9** |
|
||||
| [RP2040 / Pi Pico](https://github.com/earlephilhower/arduino-pico) | [default alarm pool](https://raspberrypi.github.io/pico-sdk-doxygen/group__repeating__timer.html) | % | |
|
||||
| [RP2040 / Mbed based](https://github.com/arduino/ArduinoCore-mbed) | [default alarm pool](https://raspberrypi.github.io/pico-sdk-doxygen/group__repeating__timer.html) | % | |
|
||||
|
||||
### Why do we use 33% duty cycle for sending
|
||||
We do it according to the statement in the [Vishay datasheet](https://www.vishay.com/docs/80069/circuit.pdf):
|
||||
|
|
|
@ -3,6 +3,11 @@ The latest version may not be released!
|
|||
See also the commit log at github: https://github.com/Arduino-IRremote/Arduino-IRremote/commits/master
|
||||
|
||||
## 3.5.3
|
||||
- RP2040 support added.
|
||||
- Refactored IRTimer.hpp.
|
||||
- Refactored IR_SEND_PIN and IrSender.sendPin handling.
|
||||
- Renamed IR_SEND_DUTY_CYCLE to IR_SEND_DUTY_CYCLE_PERCENT.
|
||||
- Fixed bugs for SEND_PWM_BY_TIMER active.
|
||||
|
||||
## 3.5.2
|
||||
- Improved support for Teensy boards by Paul Stoffregen.
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
#define IR_COMMAND_FLAG_BLOCKING 0x00 // default - blocking command, repeat not accepted, only one command at a time. Stops an already running command.
|
||||
#define IR_COMMAND_FLAG_REPEATABLE 0x01 // repeat accepted
|
||||
#define IR_COMMAND_FLAG_NON_BLOCKING 0x02 // (Non blocking / non regular) Command that can be processed any time and may interrupt other IR commands - used for stop etc.
|
||||
#define IR_COMMAND_FLAG_NON_BLOCKING 0x02 // (Non blocking / non regular) (short) command that can be processed any time and may interrupt other IR commands - used for stop, set direction etc.
|
||||
#define IR_COMMAND_FLAG_REPEATABLE_NON_BLOCKING (IR_COMMAND_FLAG_REPEATABLE | IR_COMMAND_FLAG_NON_BLOCKING)
|
||||
/*
|
||||
* if this command is received, requestToStopReceived is set until call of next loop.
|
||||
|
@ -67,6 +67,7 @@ struct IRDataForCommandDispatcherStruct {
|
|||
#define COMMAND_INVALID 0xFF // code for command received, but not in mapping
|
||||
|
||||
#define RETURN_IF_STOP if (IRDispatcher.requestToStopReceived) return
|
||||
#define DELAY_AND_RETURN_IF_STOP(aDurationMillis) if (IRDispatcher.delayAndCheckForStop(aDurationMillis)) return
|
||||
|
||||
class IRCommandDispatcher {
|
||||
public:
|
||||
|
|
|
@ -50,6 +50,14 @@ IRCommandDispatcher IRDispatcher;
|
|||
#if defined(USE_TINY_IR_RECEIVER)
|
||||
#include "TinyIRReceiver.hpp" // included in "IRremote" library
|
||||
|
||||
#if defined(INFO)
|
||||
#define CD_INFO_PRINT(...) Serial.print(__VA_ARGS__);
|
||||
#define CD_INFO_PRINTLN(...) Serial.println(__VA_ARGS__);
|
||||
#else
|
||||
#define CD_INFO_PRINT(...) void();
|
||||
#define CD_INFO_PRINTLN(...) void();
|
||||
#endif
|
||||
|
||||
void IRCommandDispatcher::init() {
|
||||
initPCIInterruptForTinyReceiver();
|
||||
}
|
||||
|
@ -70,26 +78,25 @@ void handleReceivedTinyIRData(uint16_t aAddress, uint8_t aCommand, bool isRepeat
|
|||
IRDispatcher.IRReceivedData.command = aCommand;
|
||||
IRDispatcher.IRReceivedData.isRepeat = isRepeat;
|
||||
IRDispatcher.IRReceivedData.MillisOfLastCode = millis();
|
||||
# ifdef INFO
|
||||
Serial.print(F("A=0x"));
|
||||
Serial.print(aAddress, HEX);
|
||||
Serial.print(F(" C=0x"));
|
||||
Serial.print(aCommand, HEX);
|
||||
|
||||
CD_INFO_PRINT(F("A=0x"));
|
||||
CD_INFO_PRINT(aAddress, HEX);
|
||||
CD_INFO_PRINT(F(" C=0x"));
|
||||
CD_INFO_PRINT(aCommand, HEX);
|
||||
if (isRepeat) {
|
||||
Serial.print(F("R"));
|
||||
CD_INFO_PRINT(F("R"));
|
||||
}
|
||||
Serial.println();
|
||||
# endif
|
||||
CD_INFO_PRINTLN();
|
||||
|
||||
if (aAddress == IR_ADDRESS) { // IR_ADDRESS is defined in IRCommandMapping.h
|
||||
IRDispatcher.IRReceivedData.isAvailable = true;
|
||||
if(!IRDispatcher.doNotUseDispatcher) {
|
||||
IRDispatcher.checkAndCallCommand(false); // only short commands are executed directly
|
||||
}
|
||||
# ifdef INFO
|
||||
} else {
|
||||
Serial.print(F("Wrong address. Expected 0x"));
|
||||
Serial.println(IR_ADDRESS, HEX);
|
||||
# endif
|
||||
|
||||
} else {
|
||||
CD_INFO_PRINT(F("Wrong address. Expected 0x"));
|
||||
CD_INFO_PRINTLN(IR_ADDRESS, HEX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,16 +126,16 @@ void handleReceivedIRData()
|
|||
IRDispatcher.IRReceivedData.command = tTeporaryData.command;
|
||||
IRDispatcher.IRReceivedData.isRepeat = tTeporaryData.flags & IRMP_FLAG_REPETITION;
|
||||
IRDispatcher.IRReceivedData.MillisOfLastCode = millis();
|
||||
#ifdef INFO
|
||||
Serial.print(F("A=0x"));
|
||||
Serial.print(IRDispatcher.IRReceivedData.address, HEX);
|
||||
Serial.print(F(" C=0x"));
|
||||
Serial.print(IRDispatcher.IRReceivedData.command, HEX);
|
||||
|
||||
CD_INFO_PRINT(F("A=0x"));
|
||||
CD_INFO_PRINT(IRDispatcher.IRReceivedData.address, HEX);
|
||||
CD_INFO_PRINT(F(" C=0x"));
|
||||
CD_INFO_PRINT(IRDispatcher.IRReceivedData.command, HEX);
|
||||
if (IRDispatcher.IRReceivedData.isRepeat) {
|
||||
Serial.print(F("R"));
|
||||
CD_INFO_PRINT(F("R"));
|
||||
}
|
||||
Serial.println();
|
||||
#endif
|
||||
CD_INFO_PRINTLN();
|
||||
|
||||
// To enable delay() for commands
|
||||
#if !defined(ARDUINO_ARCH_MBED)
|
||||
interrupts(); // be careful with always executable commands which lasts longer than the IR repeat duration.
|
||||
|
@ -138,8 +145,8 @@ void handleReceivedIRData()
|
|||
IRDispatcher.checkAndCallCommand(true);
|
||||
#ifdef INFO
|
||||
} else {
|
||||
Serial.print(F("Wrong address. Expected 0x"));
|
||||
Serial.println(IR_ADDRESS, HEX);
|
||||
CD_INFO_PRINT(F("Wrong address. Expected 0x"));
|
||||
CD_INFO_PRINTLN(IR_ADDRESS, HEX);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -194,9 +201,7 @@ void IRCommandDispatcher::checkAndCallCommand(bool aCallAlsoBlockingCommands) {
|
|||
*/
|
||||
if (IRMapping[i].Flags & IR_COMMAND_FLAG_IS_STOP_COMMAND) {
|
||||
requestToStopReceived = true;
|
||||
#ifdef INFO
|
||||
Serial.println(F("Stop command received"));
|
||||
#endif
|
||||
CD_INFO_PRINTLN(F("Stop command received"));
|
||||
} else {
|
||||
// lets start a new turn
|
||||
requestToStopReceived = false;
|
||||
|
@ -205,10 +210,8 @@ void IRCommandDispatcher::checkAndCallCommand(bool aCallAlsoBlockingCommands) {
|
|||
bool tIsNonBlockingCommand = (IRMapping[i].Flags & IR_COMMAND_FLAG_NON_BLOCKING);
|
||||
if (tIsNonBlockingCommand) {
|
||||
// short command here, just call
|
||||
#ifdef INFO
|
||||
Serial.print(F("Run non blocking command: "));
|
||||
Serial.println(tCommandName);
|
||||
#endif
|
||||
CD_INFO_PRINT(F("Run non blocking command: "));
|
||||
CD_INFO_PRINTLN (tCommandName);
|
||||
IRMapping[i].CommandToCall();
|
||||
} else {
|
||||
if (!aCallAlsoBlockingCommands) {
|
||||
|
@ -217,18 +220,14 @@ void IRCommandDispatcher::checkAndCallCommand(bool aCallAlsoBlockingCommands) {
|
|||
*/
|
||||
BlockingCommandToRunNext = IRReceivedData.command;
|
||||
requestToStopReceived = true; // to stop running command
|
||||
#ifdef INFO
|
||||
Serial.print(F("Blocking command "));
|
||||
Serial.print(tCommandName);
|
||||
Serial.println(F(" stored as next command and requested stop"));
|
||||
#endif
|
||||
CD_INFO_PRINT(F("Blocking command "));
|
||||
CD_INFO_PRINT (tCommandName);
|
||||
CD_INFO_PRINTLN(F(" stored as next command and requested stop"));
|
||||
} else {
|
||||
if (executingBlockingCommand) {
|
||||
// Logical error has happened
|
||||
#ifdef INFO
|
||||
Serial.println(
|
||||
CD_INFO_PRINTLN(
|
||||
F("Request to execute blocking command while another command is running. This should not happen!"));
|
||||
#endif
|
||||
/*
|
||||
* A blocking command may not be called as long as another blocking command is running.
|
||||
* Try to stop again
|
||||
|
@ -247,10 +246,9 @@ void IRCommandDispatcher::checkAndCallCommand(bool aCallAlsoBlockingCommands) {
|
|||
/*
|
||||
* This call is blocking!!!
|
||||
*/
|
||||
#ifdef INFO
|
||||
Serial.print(F("Run blocking command: "));
|
||||
Serial.println(tCommandName);
|
||||
#endif
|
||||
CD_INFO_PRINT(F("Run blocking command: "));
|
||||
CD_INFO_PRINTLN (tCommandName);
|
||||
|
||||
IRMapping[i].CommandToCall();
|
||||
#ifdef TRACE
|
||||
Serial.println(F("End of blocking command"));
|
||||
|
@ -289,10 +287,10 @@ void IRCommandDispatcher::checkAndRunSuspendedBlockingCommands() {
|
|||
* search IR code or take last rejected command and call associated function
|
||||
*/
|
||||
if (BlockingCommandToRunNext != COMMAND_INVALID) {
|
||||
#ifdef INFO
|
||||
Serial.print(F("Take stored command = 0x"));
|
||||
Serial.println(BlockingCommandToRunNext, HEX);
|
||||
#endif
|
||||
|
||||
CD_INFO_PRINT(F("Take stored command = 0x"));
|
||||
CD_INFO_PRINTLN(BlockingCommandToRunNext, HEX);
|
||||
|
||||
IRReceivedData.command = BlockingCommandToRunNext;
|
||||
BlockingCommandToRunNext = COMMAND_INVALID;
|
||||
IRReceivedData.isRepeat = false;
|
||||
|
@ -301,8 +299,7 @@ void IRCommandDispatcher::checkAndRunSuspendedBlockingCommands() {
|
|||
}
|
||||
|
||||
void IRCommandDispatcher::printIRCommandString(Print *aSerial) {
|
||||
#ifdef INFO
|
||||
Serial.print(F("IRCommand="));
|
||||
aSerial->print(F("IRCommand="));
|
||||
for (uint_fast8_t i = 0; i < sizeof(IRMapping) / sizeof(struct IRToCommandMappingStruct); ++i) {
|
||||
if (IRReceivedData.command == IRMapping[i].IRCode) {
|
||||
aSerial->println(reinterpret_cast<const __FlashStringHelper*>(IRMapping[i].CommandString));
|
||||
|
@ -310,7 +307,6 @@ void IRCommandDispatcher::printIRCommandString(Print *aSerial) {
|
|||
}
|
||||
}
|
||||
aSerial->println(reinterpret_cast<const __FlashStringHelper*>(unknown));
|
||||
#endif
|
||||
}
|
||||
|
||||
void IRCommandDispatcher::setRequestToStopReceived() {
|
||||
|
|
|
@ -167,11 +167,9 @@ void loop() {
|
|||
|
||||
if (doBlink) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
IRDispatcher.delayAndCheckForStop(sBlinkDelay);
|
||||
RETURN_IF_STOP; // = if (IRDispatcher.requestToStopReceived) return;
|
||||
DELAY_AND_RETURN_IF_STOP(sBlinkDelay);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
IRDispatcher.delayAndCheckForStop(sBlinkDelay);
|
||||
RETURN_IF_STOP;
|
||||
DELAY_AND_RETURN_IF_STOP(sBlinkDelay);
|
||||
}
|
||||
|
||||
if (millis() - IRDispatcher.IRReceivedData.MillisOfLastCode > 120000)
|
||||
|
@ -236,11 +234,9 @@ void doLedBlinkStart() {
|
|||
void doLedBlink20times() {
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
digitalWrite(LED_BUILTIN, HIGH);
|
||||
IRDispatcher.delayAndCheckForStop(200);
|
||||
RETURN_IF_STOP; // if (IRDispatcher.requestToStopReceived) return;
|
||||
DELAY_AND_RETURN_IF_STOP(200);
|
||||
digitalWrite(LED_BUILTIN, LOW);
|
||||
IRDispatcher.delayAndCheckForStop(200);
|
||||
RETURN_IF_STOP;
|
||||
DELAY_AND_RETURN_IF_STOP(200);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* Version 1.0 November 2015
|
||||
* Original Author: AnalysIR - IR software & modules for Makers & Pros, visit http://www.AnalysIR.com
|
||||
*/
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <IRremote.hpp>
|
||||
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -101,11 +101,11 @@ void setup() {
|
|||
#endif
|
||||
|
||||
Serial.print(F("Ready to send IR signals at pin "));
|
||||
#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)
|
||||
Serial.println(IR_SEND_PIN_STRING);
|
||||
#else
|
||||
# if defined(IR_SEND_PIN_STRING)
|
||||
Serial.print(IR_SEND_PIN_STRING);
|
||||
# else
|
||||
Serial.print(IR_SEND_PIN);
|
||||
#endif
|
||||
# endif
|
||||
Serial.print(F(" on press of button at pin "));
|
||||
Serial.println(SEND_BUTTON_PIN);
|
||||
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -90,7 +90,7 @@ void setup() {
|
|||
#endif
|
||||
|
||||
Serial.begin(115200);
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) || defined(ARDUINO_attiny3217)
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) || defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
|
||||
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
|
||||
#endif
|
||||
// Just to know which program is running on my Arduino
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -49,26 +49,31 @@
|
|||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
|
||||
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) || defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
|
||||
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
|
||||
#endif
|
||||
// Just to know which program is running on my Arduino
|
||||
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
|
||||
|
||||
#if defined(IR_SEND_PIN) || defined(NO_LED_FEEDBACK_CODE)
|
||||
IrSender.begin(); // Start with IR_SEND_PIN as send pin and if NO_LED_FEEDBACK_CODE is NOT defined, enable feedback LED at default feedback LED pin
|
||||
#if defined(IR_SEND_PIN)
|
||||
IrSender.begin(); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
|
||||
#else
|
||||
IrSender.begin(IR_SEND_PIN, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
|
||||
IrSender.begin(3, ENABLE_LED_FEEDBACK); // Specify send pin and enable feedback LED at default feedback LED pin
|
||||
#endif
|
||||
|
||||
Serial.print(F("Ready to send IR signals at pin "));
|
||||
#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)
|
||||
#if defined(IR_SEND_PIN)
|
||||
# if defined(IR_SEND_PIN_STRING)
|
||||
Serial.println(IR_SEND_PIN_STRING);
|
||||
#else
|
||||
# else
|
||||
Serial.println(IR_SEND_PIN);
|
||||
# endif
|
||||
#else
|
||||
Serial.println('3');
|
||||
#endif
|
||||
|
||||
#if !defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM) && !defined(ESP32) // for esp32 we use PWM generation by ledcWrite() for each pin
|
||||
#if !defined(SEND_PWM_BY_TIMER)
|
||||
/*
|
||||
* Print internal signal generation info
|
||||
*/
|
||||
|
@ -250,6 +255,7 @@ void loop() {
|
|||
IRSendData.protocol = SAMSUNG;
|
||||
Serial.print(F("Send "));
|
||||
Serial.println(getProtocolString(IRSendData.protocol));
|
||||
Serial.flush();
|
||||
IrSender.write(&IRSendData, sRepeats);
|
||||
delay(DELAY_AFTER_SEND);
|
||||
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -34,15 +34,23 @@
|
|||
* ATtiny167 9 8 5 // Digispark pro number schema
|
||||
* ATtiny167 3 2 7
|
||||
* ATtiny3217 10 11 3 // TinyCore schema
|
||||
* ATtiny1604 2 PA5/3 %
|
||||
* ATtiny1604 2 PA5|3 %
|
||||
* SAMD21 3 4 5
|
||||
* ESP8266 14 // D5 12 // D6 %
|
||||
* ESP8266 14|D5 12|D6 %
|
||||
* ESP32 15 4 27
|
||||
* BluePill PA6 PA7 PA3
|
||||
* APOLLO3 11 12 5
|
||||
* RP2040 3|GPIO15 4|GPIO16 5|GPIO17
|
||||
*/
|
||||
//#define _IR_MEASURE_TIMING // For debugging purposes.
|
||||
//
|
||||
|
||||
/*
|
||||
* We do not have pin restrictions for this CPU's, so lets use the hardware PWM for send carrier signal generation
|
||||
*/
|
||||
#if defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)
|
||||
#define SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
#if defined(ESP8266)
|
||||
#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board (D4) is active LOW
|
||||
#define IR_RECEIVE_PIN 14 // D5
|
||||
|
@ -58,6 +66,7 @@
|
|||
|
||||
#elif defined(ESP32)
|
||||
#include <Arduino.h>
|
||||
|
||||
#define TONE_LEDC_CHANNEL 1 // Using channel 1 makes tone() independent of receiving timer -> No need to stop receiving timer.
|
||||
void tone(uint8_t _pin, unsigned int frequency){
|
||||
ledcAttachPin(_pin, TONE_LEDC_CHANNEL);
|
||||
|
@ -154,14 +163,34 @@ void noTone(uint8_t _pin){
|
|||
#define IR_SEND_PIN 12
|
||||
#define TONE_PIN 5
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
#elif defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARCH_MBED_NANO)
|
||||
#define IR_RECEIVE_PIN 3 // GPIO15 Start with pin 3 since pin 2|GPIO25 is connected to LED on Pi pico
|
||||
#define IR_SEND_PIN 4 // GPIO16
|
||||
#define TONE_PIN 5
|
||||
#define APPLICATION_PIN 6
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 7 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 8
|
||||
|
||||
#elif defined(ARDUINO_ARCH_RP2040) // Pi Pico with arduino-pico core https://github.com/earlephilhower/arduino-pico
|
||||
#define IR_RECEIVE_PIN 15 // to be compatible with the Arduino Nano RP2040 Connect (pin3)
|
||||
#define IR_SEND_PIN 16
|
||||
#define TONE_PIN 17
|
||||
#define APPLICATION_PIN 18
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 19 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 20
|
||||
|
||||
// If you program the Nano RP2040 Connect with this core, then you must redefine LED_BUILTIN
|
||||
// and use the external reset with 1 kOhm to ground to enter UF2 mode
|
||||
#undef LED_BUILTIN
|
||||
#define LED_BUILTIN 6
|
||||
|
||||
#elif defined(PARTICLE) // !!!UNTESTED!!!
|
||||
#define IR_RECEIVE_PIN A4
|
||||
#define IR_SEND_PIN A5 // Particle supports multiple pins
|
||||
|
||||
/*
|
||||
* 4 times the same (default) layout for easy adaption in the future
|
||||
*/
|
||||
#elif defined(TEENSYDUINO)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
@ -178,6 +207,14 @@ void noTone(uint8_t _pin){
|
|||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
#define TONE_PIN 4
|
||||
#define APPLICATION_PIN 5
|
||||
#define ALTERNATIVE_IR_FEEDBACK_LED_PIN 6 // E.g. used for examples which use LED_BUILDIN for example output.
|
||||
#define _IR_TIMING_TEST_PIN 7
|
||||
|
||||
#elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_SAM)
|
||||
#define IR_RECEIVE_PIN 2
|
||||
#define IR_SEND_PIN 3
|
||||
|
|
|
@ -95,7 +95,7 @@ void setup() {
|
|||
#endif
|
||||
|
||||
Serial.begin(115200);
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL) || defined(ARDUINO_attiny3217)
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) || defined(SERIALUSB_PID) || defined(ARDUINO_attiny3217)
|
||||
delay(4000); // To be able to connect Serial monitor after reset or power up and before first print out. Do not wait for an attached Serial Monitor!
|
||||
#endif
|
||||
// Just to know which program is running on my Arduino
|
||||
|
@ -110,21 +110,15 @@ void setup() {
|
|||
Serial.print(F("Ready to receive IR signals of protocols: "));
|
||||
printActiveIRProtocols(&Serial);
|
||||
Serial.print(F("at pin "));
|
||||
#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)
|
||||
Serial.println(IR_RECEIVE_PIN_STRING);
|
||||
#else
|
||||
Serial.println(IR_RECEIVE_PIN);
|
||||
#endif
|
||||
Serial.print(F("Ready to send IR signals at pin "));
|
||||
#if defined(ARDUINO_ARCH_STM32) || defined(ESP8266)
|
||||
# if defined(IR_SEND_PIN_STRING)
|
||||
Serial.println(IR_SEND_PIN_STRING);
|
||||
#else
|
||||
# else
|
||||
Serial.println(IR_SEND_PIN);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if FLASHEND >= 0x3FFF // For 16k flash or more, like ATtiny1604
|
||||
// For esp32 we use PWM generation by ledcWrite() for each pin.
|
||||
# if !defined(SEND_PWM_BY_TIMER) && !defined(USE_NO_SEND_PWM) && !defined(ESP32)
|
||||
# if !defined(SEND_PWM_BY_TIMER)
|
||||
/*
|
||||
* Print internal software PWM generation info
|
||||
*/
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
*/
|
||||
#ifndef IR_FEEDBACK_LED_HPP
|
||||
#define IR_FEEDBACK_LED_HPP
|
||||
|
||||
#include "private/IRFeedbackLEDDefs.h"
|
||||
|
||||
/** \addtogroup FeedbackLEDFunctions Feedback LED functions
|
||||
|
|
|
@ -151,19 +151,17 @@ void IRrecv::end() {
|
|||
*/
|
||||
void IRrecv::enableIRIn() {
|
||||
|
||||
noInterrupts();
|
||||
// Set pin mode
|
||||
pinMode(irparams.IRReceivePin, INPUT);
|
||||
|
||||
// Setup pulse clock TickCounterForISR interrupt
|
||||
timerConfigForReceive();
|
||||
TIMER_ENABLE_RECEIVE_INTR; // Timer interrupt enable
|
||||
TIMER_RESET_INTR_PENDING; // NOP for most platforms
|
||||
// Setup for cyclic 50 us interrupt
|
||||
timerConfigForReceive(); // no interrupts enabled here!
|
||||
|
||||
// Initialize state machine state
|
||||
resume();
|
||||
interrupts(); // after resume to avoid running through STOP state 1 time before switching to IDLE
|
||||
|
||||
// Set pin modes
|
||||
pinMode(irparams.IRReceivePin, INPUT);
|
||||
// Timer interrupt is enabled after state machine reset
|
||||
TIMER_ENABLE_RECEIVE_INTR;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -914,7 +912,7 @@ void printActiveIRProtocols(Print *aSerial) {
|
|||
(void)aSerial; // to avoid compiler warnings
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Internal function to print decoded result and flags in one line.
|
||||
* Ends with println().
|
||||
|
@ -931,7 +929,7 @@ void printIRResultShort(Print *aSerial, IRData *aIRDataPtr, uint16_t aLeadingSpa
|
|||
#endif
|
||||
aSerial->print(' ');
|
||||
aSerial->print((aIRDataPtr->rawDataPtr->rawlen + 1) / 2, DEC);
|
||||
aSerial->println(F(" bits received"));
|
||||
aSerial->println(F(" bits (incl. gap and start) received"));
|
||||
} else {
|
||||
/*
|
||||
* New decoders have address and command
|
||||
|
|
145
src/IRSend.hpp
145
src/IRSend.hpp
|
@ -8,7 +8,7 @@
|
|||
************************************************************************************
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2009-2021 Ken Shirriff, Rafi Khan, Armin Joachimsmeyer
|
||||
* Copyright (c) 2009-2022 Ken Shirriff, Rafi Khan, Armin Joachimsmeyer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -32,15 +32,15 @@
|
|||
#ifndef IR_SEND_HPP
|
||||
#define IR_SEND_HPP
|
||||
|
||||
#include "IRremoteInt.h"
|
||||
/*
|
||||
* This improves readability of code by avoiding a lot of #if defined clauses
|
||||
*/
|
||||
#if defined(IR_SEND_PIN)
|
||||
#define sendPin IR_SEND_PIN
|
||||
#include "digitalWriteFast.h"
|
||||
#else
|
||||
#define digitalWriteFast digitalWrite
|
||||
#define pinModeFast pinMode
|
||||
#endif
|
||||
|
||||
#include "digitalWriteFast.h"
|
||||
|
||||
/** \addtogroup Sending Sending IR data for multiple protocols
|
||||
* @{
|
||||
*/
|
||||
|
@ -48,38 +48,16 @@
|
|||
// The sender instance
|
||||
IRsend IrSender;
|
||||
|
||||
IRsend::IRsend() {
|
||||
IRsend::IRsend() { // @suppress("Class members should be properly initialized")
|
||||
#if !defined(IR_SEND_PIN)
|
||||
sendPin = 0;
|
||||
#endif
|
||||
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(0, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(IR_SEND_PIN) && !defined(SEND_PWM_BY_TIMER)
|
||||
// there is no sendPin variable if IR_SEND_PIN or SEND_PWM_BY_TIMER is defined
|
||||
IRsend::IRsend(uint8_t aSendPin) {
|
||||
sendPin = aSendPin;
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(0, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
void IRsend::setSendPin(uint8_t aSendPin) {
|
||||
sendPin = aSendPin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the send pin and enable LED feedback with board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
* @param aSendPin The Arduino pin number, where a IR sender diode is connected.
|
||||
*/
|
||||
void IRsend::begin(uint8_t aSendPin) {
|
||||
sendPin = aSendPin;
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(USE_DEFAULT_FEEDBACK_LED_PIN, true);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(IR_SEND_PIN)
|
||||
/**
|
||||
* Simple start with defaults for constant send pin
|
||||
|
@ -89,19 +67,11 @@ void IRsend::begin(){
|
|||
setLEDFeedback(USE_DEFAULT_FEEDBACK_LED_PIN, true);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes the send and feedback pin
|
||||
* @param aSendPin The Arduino pin number, where a IR sender diode is connected.
|
||||
* @param aFeedbackLEDPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
*/
|
||||
void IRsend::begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
||||
#if !defined(IR_SEND_PIN) && !defined(SEND_PWM_BY_TIMER)
|
||||
sendPin = aSendPin;
|
||||
#else
|
||||
(void) aSendPin; // there is no sendPin variable if IR_SEND_PIN or SEND_PWM_BY_TIMER is defined
|
||||
#endif
|
||||
void IRsend::begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(aFeedbackLEDPin, aEnableLEDFeedback);
|
||||
#else
|
||||
|
@ -110,31 +80,42 @@ void IRsend::begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aFeedbackL
|
|||
#endif
|
||||
}
|
||||
|
||||
__attribute((error("Error: You must use begin(<sendPin>, <EnableLEDFeedback>, <aFeedbackLEDPin>) if IR_SEND_PIN and SEND_PWM_BY_TIMER are not defined or USE_NO_SEND_PWM is defined. To suppress this error, enable lto or activate the line #define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN in IRremote.hpp."))) void beginUsageError();
|
||||
#else // defined(IR_SEND_PIN)
|
||||
IRsend::IRsend(uint8_t aSendPin) { // @suppress("Class members should be properly initialized")
|
||||
sendPin = aSendPin;
|
||||
# if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(0, false);
|
||||
# endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the send pin and enable LED feedback with board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
* @param aSendPin The Arduino pin number, where a IR sender diode is connected.
|
||||
*/
|
||||
void IRsend::begin(uint8_t aSendPin) {
|
||||
sendPin = aSendPin;
|
||||
# if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(USE_DEFAULT_FEEDBACK_LED_PIN, true);
|
||||
# endif
|
||||
}
|
||||
|
||||
void IRsend::setSendPin(uint8_t aSendPin) {
|
||||
sendPin = aSendPin;
|
||||
}
|
||||
#endif // defined(IR_SEND_PIN)
|
||||
|
||||
/**
|
||||
* Initializes the send and feedback pin
|
||||
* @param aSendPin The Arduino pin number, where a IR sender diode is connected.
|
||||
* @param aFeedbackLEDPin if 0, then take board specific FEEDBACK_LED_ON() and FEEDBACK_LED_OFF() functions
|
||||
*/
|
||||
void IRsend::begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
||||
#if !defined(IR_SEND_PIN)
|
||||
|
||||
// must exclude cores by MCUdude, MEGATINYCORE, NRF5, SAMD and ESP32 because they do not use the -flto flag for compile
|
||||
# if (!defined(SEND_PWM_BY_TIMER) || defined(USE_NO_SEND_PWM)) \
|
||||
&& !defined(SUPPRESS_ERROR_MESSAGE_FOR_BEGIN) \
|
||||
&& !(defined(NRF5) || defined(ARDUINO_ARCH_NRF52840)) \
|
||||
&& !defined(ARDUINO_ARCH_SAMD) && !defined(ARDUINO_ARCH_RP2040) \
|
||||
&& !defined(ESP32) && !defined(ESP8266) && !defined(MEGATINYCORE) \
|
||||
&& !defined(MINICORE) && !defined(MIGHTYCORE) && !defined(MEGACORE) && !defined(MAJORCORE) \
|
||||
&& !(defined(__STM32F1__) || defined(ARDUINO_ARCH_STM32F1)) && !(defined(STM32F1xx) || defined(ARDUINO_ARCH_STM32))
|
||||
/*
|
||||
* This error shows up, if this function is really used/called by the user program.
|
||||
* This check works only if lto is enabled, otherwise it always pops up :-(.
|
||||
* In this case activate the line #define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN in IRremote.h to suppress this message.
|
||||
* I know now way to check for lto flag here.
|
||||
*/
|
||||
beginUsageError();
|
||||
# endif
|
||||
void IRsend::begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin) {
|
||||
#if defined(IR_SEND_PIN)
|
||||
(void) aSendPin; // for backwards compatibility
|
||||
#else
|
||||
sendPin = aSendPin;
|
||||
#endif
|
||||
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setLEDFeedback(aFeedbackLEDPin, aEnableLEDFeedback);
|
||||
#else
|
||||
|
@ -476,20 +457,18 @@ void IRsend::mark(unsigned int aMarkMicros) {
|
|||
pinModeFast(sendPin, OUTPUT); // active state for mimicking open drain
|
||||
# endif
|
||||
# else
|
||||
# if defined(IR_SEND_PIN)
|
||||
digitalWriteFast(IR_SEND_PIN, HIGH); // 3.5 us from FeedbackLed on to pin setting. 5.7 us from call of mark() to pin setting incl. setting of feedback pin.
|
||||
# else
|
||||
digitalWrite(sendPin, HIGH); // 4.3 us from do{ to pin setting
|
||||
# endif
|
||||
// 3.5 us from FeedbackLed on to pin setting. 5.7 us from call of mark() to pin setting incl. setting of feedback pin.
|
||||
// 4.3 us from do{ to pin setting if sendPin is no constant
|
||||
digitalWriteFast(sendPin, HIGH);
|
||||
# endif
|
||||
delayMicroseconds(periodOnTimeMicros); // this is normally implemented by a blocking wait
|
||||
delayMicroseconds (periodOnTimeMicros); // this is normally implemented by a blocking wait
|
||||
|
||||
// Output the PWM pause
|
||||
# if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && !defined(OUTPUT_OPEN_DRAIN)
|
||||
# if defined(OUTPUT_OPEN_DRAIN)
|
||||
digitalWriteFast(sendPin, HIGH); // Set output to inactive high.
|
||||
digitalWriteFast(sendPin, HIGH); // Set output with pin mode OUTPUT_OPEN_DRAIN to inactive high.
|
||||
# else
|
||||
pinModeFast(sendPin, INPUT); // inactive state to mimic open drain
|
||||
pinModeFast(sendPin, INPUT); // to mimic the open drain inactive state
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
@ -525,6 +504,9 @@ void IRsend::mark(unsigned int aMarkMicros) {
|
|||
if (tDeltaMicros >= aMarkMicros - (112 / CLOCKS_PER_MICRO)) { // To compensate for call duration - 112 is an empirical value
|
||||
#else
|
||||
if (tDeltaMicros >= aMarkMicros) {
|
||||
# if !defined(NO_LED_FEEDBACK_CODE)
|
||||
setFeedbackLED(false);
|
||||
# endif
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -602,8 +584,7 @@ void IRsend::customDelayMicroseconds(unsigned long aMicroseconds) {
|
|||
*/
|
||||
void IRsend::enableIROut(uint8_t aFrequencyKHz) {
|
||||
#if defined(SEND_PWM_BY_TIMER)
|
||||
TIMER_DISABLE_RECEIVE_INTR; // Just in case receiving was active
|
||||
timerConfigForSend(aFrequencyKHz);
|
||||
timerConfigForSend(aFrequencyKHz); // must set output pin mode and disable receive interrupt if required, e.g. uses the same resource
|
||||
|
||||
#elif defined(USE_NO_SEND_PWM)
|
||||
(void) aFrequencyKHz;
|
||||
|
@ -611,21 +592,19 @@ void IRsend::enableIROut(uint8_t aFrequencyKHz) {
|
|||
#else
|
||||
periodTimeMicros = (1000U + (aFrequencyKHz / 2)) / aFrequencyKHz; // rounded value -> 26 for 38.46 kHz, 27 for 37.04 kHz, 25 for 40 kHz.
|
||||
# if defined(IR_SEND_PIN)
|
||||
periodOnTimeMicros = (((periodTimeMicros * IR_SEND_DUTY_CYCLE) + 50) / 100U); // +50 for rounding -> 830/100 for 30% and 16 MHz
|
||||
periodOnTimeMicros = (((periodTimeMicros * IR_SEND_DUTY_CYCLE_PERCENT) + 50) / 100U); // +50 for rounding -> 830/100 for 30% and 16 MHz
|
||||
# else
|
||||
periodOnTimeMicros = (((periodTimeMicros * IR_SEND_DUTY_CYCLE) + 50 - (PULSE_CORRECTION_NANOS / 10)) / 100U); // +50 for rounding -> 530/100 for 30% and 16 MHz
|
||||
// Heuristics! We require a nanosecond correction for "slow" digitalWrite() functions
|
||||
periodOnTimeMicros = (((periodTimeMicros * IR_SEND_DUTY_CYCLE_PERCENT) + 50 - (PULSE_CORRECTION_NANOS / 10)) / 100U); // +50 for rounding -> 530/100 for 30% and 16 MHz
|
||||
# endif
|
||||
#endif
|
||||
#endif // defined(SEND_PWM_BY_TIMER)
|
||||
|
||||
#if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN)
|
||||
# if defined(OUTPUT_OPEN_DRAIN)
|
||||
pinMode(sendPin, OUTPUT_OPEN_DRAIN); // the only place where this mode is set for sendPin
|
||||
# endif // the mode INPUT for mimicking open drain is set at IRLedOff()
|
||||
|
||||
#else
|
||||
#if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && defined(OUTPUT_OPEN_DRAIN)
|
||||
pinMode(sendPin, OUTPUT_OPEN_DRAIN); // the mode INPUT for mimicking open drain is set at IRLedOff()
|
||||
#elif !defined(SEND_PWM_BY_TIMER)
|
||||
// For SEND_PWM_BY_TIMER this is handled by the timerConfigForSend() function
|
||||
pinModeFast(sendPin, OUTPUT);
|
||||
#endif
|
||||
IRLedOff(); // When not sending, we want it low/inactive
|
||||
#endif // defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN)
|
||||
}
|
||||
|
||||
unsigned int IRsend::getPulseCorrectionNanos() {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
************************************************************************************
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2015-2021 Ken Shirriff http://www.righto.com, Rafi Khan, Armin Joachimsmeyer
|
||||
* Copyright (c) 2015-2022 Ken Shirriff http://www.righto.com, Rafi Khan, Armin Joachimsmeyer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -43,9 +43,9 @@
|
|||
#ifndef IRremote_hpp
|
||||
#define IRremote_hpp
|
||||
|
||||
#define VERSION_IRREMOTE "3.5.0"
|
||||
#define VERSION_IRREMOTE "3.6.0"
|
||||
#define VERSION_IRREMOTE_MAJOR 3
|
||||
#define VERSION_IRREMOTE_MINOR 5
|
||||
#define VERSION_IRREMOTE_MINOR 6
|
||||
|
||||
// activate it for all cores that does not use the -flto flag, if you get false error messages regarding begin() during compilation.
|
||||
//#define SUPPRESS_ERROR_MESSAGE_FOR_BEGIN
|
||||
|
@ -178,10 +178,11 @@
|
|||
/**
|
||||
* Define to disable carrier PWM generation in software and use (restricted) hardware PWM.
|
||||
*/
|
||||
#if defined(ESP32)
|
||||
#if !defined(SEND_PWM_BY_TIMER) && (defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE))
|
||||
#define SEND_PWM_BY_TIMER // the best and default method for ESP32
|
||||
#warning For ESP32, RP2040 and particle boards SEND_PWM_BY_TIMER is enabled by default. If this is not intended, deactivate the line over this error message in file IRremote.hpp.
|
||||
#else
|
||||
//#define SEND_PWM_BY_TIMER
|
||||
//#define SEND_PWM_BY_TIMER // restricts send pin on many platforms to fixed pin numbers
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -189,8 +190,8 @@
|
|||
*/
|
||||
//#define USE_NO_SEND_PWM
|
||||
#if defined(SEND_PWM_BY_TIMER) && defined(USE_NO_SEND_PWM)
|
||||
#undef SEND_PWM_BY_TIMER // USE_NO_SEND_PWM overrides SEND_PWM_BY_TIMER
|
||||
#warning "SEND_PWM_BY_TIMER and USE_NO_SEND_PWM are both defined -> undefine SEND_PWM_BY_TIMER now!"
|
||||
#undef SEND_PWM_BY_TIMER // USE_NO_SEND_PWM overrides SEND_PWM_BY_TIMER
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -198,6 +199,9 @@
|
|||
* Attention, active state of open drain is LOW, so connect the send LED between positive supply and send pin!
|
||||
*/
|
||||
//#define USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN
|
||||
#if defined(USE_OPEN_DRAIN_OUTPUT_FOR_SEND_PIN) && !defined(OUTPUT_OPEN_DRAIN)
|
||||
#warning Pin mode OUTPUT_OPEN_DRAIN is not supported on this platform -> fall back to mode OUTPUT.
|
||||
#endif
|
||||
/**
|
||||
* This amount is subtracted from the on-time of the pulses generated for software PWM generation.
|
||||
* It should be the time used for digitalWrite(sendPin, LOW) and the call to delayMicros()
|
||||
|
@ -212,8 +216,26 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Duty cycle in percent for sent signals.
|
||||
*/
|
||||
#if ! defined(IR_SEND_DUTY_CYCLE_PERCENT)
|
||||
#define IR_SEND_DUTY_CYCLE_PERCENT 30 // 30 saves power and is compatible to the old existing code
|
||||
#endif
|
||||
|
||||
/**
|
||||
* microseconds per clock interrupt tick
|
||||
*/
|
||||
#if ! defined(MICROS_PER_TICK)
|
||||
#define MICROS_PER_TICK 50
|
||||
#endif
|
||||
|
||||
#define MILLIS_IN_ONE_SECOND 1000L
|
||||
#define MICROS_IN_ONE_SECOND 1000000L
|
||||
#define MICROS_IN_ONE_MILLI 1000L
|
||||
|
||||
#include "IRremoteInt.h"
|
||||
#include "private/IRTimer.hpp"
|
||||
#include "private/IRTimer.hpp" // defines IR_SEND_PIN for AVR and SEND_PWM_BY_TIMER
|
||||
#if !defined(NO_LED_FEEDBACK_CODE)
|
||||
#include "IRFeedbackLED.hpp"
|
||||
#endif
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
************************************************************************************
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2015-2021 Ken Shirriff http://www.righto.com, Rafi Khan, Armin Joachimsmeyer
|
||||
* Copyright (c) 2015-2022 Ken Shirriff http://www.righto.com, Rafi Khan, Armin Joachimsmeyer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -46,21 +46,11 @@
|
|||
#define MARK 1
|
||||
#define SPACE 0
|
||||
|
||||
#define MILLIS_IN_ONE_SECOND 1000L
|
||||
#define MICROS_IN_ONE_SECOND 1000000L
|
||||
#define MICROS_IN_ONE_MILLI 1000L
|
||||
|
||||
#if defined(PARTICLE)
|
||||
#define F_CPU 16000000 // definition for a board for which F_CPU is not defined
|
||||
#elif defined(ARDUINO_ARCH_MBED_RP2040)
|
||||
#define F_CPU 133000000
|
||||
#elif defined(ARDUINO_ARDUINO_NANO33BLE)
|
||||
#define F_CPU 64000000
|
||||
#endif
|
||||
#if defined(F_CPU)
|
||||
#if defined(F_CPU) // F_CPU is used to generate the receive send timings in some CPU's
|
||||
#define CLOCKS_PER_MICRO (F_CPU / MICROS_IN_ONE_SECOND)
|
||||
#else
|
||||
#error F_CPU not defined, please define it for your board in IRremoteInt.h
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -365,13 +355,6 @@ void disableLEDFeedback();
|
|||
|
||||
void setBlinkPin(uint8_t aFeedbackLEDPin) __attribute__ ((deprecated ("Please use setLEDFeedback()."))); // deprecated
|
||||
|
||||
/**
|
||||
* microseconds per clock interrupt tick
|
||||
*/
|
||||
#if ! defined(MICROS_PER_TICK)
|
||||
#define MICROS_PER_TICK 50
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pulse parms are ((X*50)-MARK_EXCESS_MICROS) for the Mark and ((X*50)+MARK_EXCESS_MICROS) for the Space.
|
||||
* First MARK is the one after the long gap
|
||||
|
@ -413,13 +396,6 @@ extern IRrecv IrReceiver;
|
|||
#define SEND_STOP_BIT true
|
||||
#define SEND_REPEAT_COMMAND true ///< used for e.g. NEC, where a repeat is different from just repeating the data.
|
||||
|
||||
/**
|
||||
* Duty cycle in percent for sent signals.
|
||||
*/
|
||||
#if ! defined(IR_SEND_DUTY_CYCLE)
|
||||
#define IR_SEND_DUTY_CYCLE 30 // 30 saves power and is compatible to the old existing code
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Main class for sending IR signals
|
||||
*/
|
||||
|
@ -427,16 +403,17 @@ class IRsend {
|
|||
public:
|
||||
IRsend();
|
||||
|
||||
#if defined(IR_SEND_PIN) || defined(SEND_PWM_BY_TIMER)
|
||||
/*
|
||||
* IR_SEND_PIN is defined
|
||||
*/
|
||||
#if defined(IR_SEND_PIN) || (defined(SEND_PWM_BY_TIMER) && !(defined(ESP32) || defined(ARDUINO_ARCH_RP2040) || defined(PARTICLE)))
|
||||
void begin();
|
||||
#endif
|
||||
#if !defined(IR_SEND_PIN) && !defined(SEND_PWM_BY_TIMER)
|
||||
IRsend(uint8_t aSendPin);
|
||||
void setSendPin(uint8_t aSendPinNumber);
|
||||
#endif
|
||||
|
||||
void begin(bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
#else
|
||||
IRsend(uint8_t aSendPin);
|
||||
void begin(uint8_t aSendPin);
|
||||
void setSendPin(uint8_t aSendPinNumber); // required if we use IRsend() as constructor
|
||||
#endif
|
||||
|
||||
// Not guarded for backward compatibility
|
||||
void begin(uint8_t aSendPin, bool aEnableLEDFeedback, uint8_t aFeedbackLEDPin = USE_DEFAULT_FEEDBACK_LED_PIN);
|
||||
|
@ -552,7 +529,7 @@ public:
|
|||
;
|
||||
void sendWhynter(unsigned long data, int nbits);
|
||||
|
||||
#if !defined(IR_SEND_PIN) && !defined(SEND_PWM_BY_TIMER)
|
||||
#if !defined(IR_SEND_PIN)
|
||||
uint8_t sendPin;
|
||||
#endif
|
||||
unsigned int periodTimeMicros;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue