|
| 1 | +/* |
| 2 | + * PinDefinitionsAndMore.h |
| 3 | + * |
| 4 | + * Contains pin definitions for IRremote examples for various platforms |
| 5 | + * as well as definitions for feedback LED and tone() and includes |
| 6 | + * |
| 7 | + * Copyright (C) 2021 Armin Joachimsmeyer |
| 8 | + |
| 9 | + * |
| 10 | + * This file is part of IRMP https://github.com/Arduino-IRremote/Arduino-IRremote. |
| 11 | + * |
| 12 | + * IRMP is free software: you can redistribute it and/or modify |
| 13 | + * it under the terms of the GNU General Public License as published by |
| 14 | + * the Free Software Foundation, either version 3 of the License, or |
| 15 | + * (at your option) any later version. |
| 16 | + * |
| 17 | + * This program is distributed in the hope that it will be useful, |
| 18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | + * GNU General Public License for more details. |
| 21 | + * |
| 22 | + * You should have received a copy of the GNU General Public License |
| 23 | + * along with this program. If not, see <http://www.gnu.org/licenses/gpl.html>. |
| 24 | + * |
| 25 | + */ |
| 26 | + |
| 27 | +/* |
| 28 | + * Pin mapping table for different platforms |
| 29 | + * |
| 30 | + * Platform IR input IR output Tone |
| 31 | + * ----------------------------------------- |
| 32 | + * DEFAULT/AVR 2 3 4 |
| 33 | + * ATtinyX5 0 4 3 |
| 34 | + * ATtin167 9 8 5 // Digispark pro number schema |
| 35 | + * ATtin167 3 2 7 |
| 36 | + * ATtin3217 10 11 3 // TinyCore schema |
| 37 | + * SAMD21 3 4 5 |
| 38 | + * ESP8266 14 // D5 12 // D6 % |
| 39 | + * ESP32 15 4 % |
| 40 | + * BluePill PA6 PA7 PA3 |
| 41 | + * APOLLO3 11 12 5 |
| 42 | + */ |
| 43 | +//#define IRMP_MEASURE_TIMING // For debugging purposes. |
| 44 | +// |
| 45 | +#if defined(ESP8266) |
| 46 | +#define FEEDBACK_LED_IS_ACTIVE_LOW // The LED on my board is active LOW |
| 47 | +#define IR_RECEIVE_PIN 14 // D5 |
| 48 | +#define IR_SEND_PIN 12 // D6 - D4/2 is internal LED |
| 49 | +#define tone(a,b) void() // tone() inhibits receive timer |
| 50 | +#define noTone(a) void() |
| 51 | +#define TONE_PIN 42 // Dummy for examples using it |
| 52 | +#define IR_TIMING_TEST_PIN 13 // D7 |
| 53 | + |
| 54 | +#elif defined(ESP32) |
| 55 | +#define IR_RECEIVE_PIN 15 // D15 |
| 56 | +#define IR_SEND_PIN 4 // D4 |
| 57 | +#define tone(a,b) void() // no tone() available on ESP32 |
| 58 | +#define noTone(a) void() |
| 59 | +#define TONE_PIN 42 // Dummy for examples using it |
| 60 | + |
| 61 | +#elif defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_ARCH_STM32F1) |
| 62 | +// BluePill in 2 flavors |
| 63 | +// Timer 3 of IRMP blocks PA6, PA7, PB0, PB1 for use by Servo or tone() |
| 64 | +#define IR_RECEIVE_PIN PA6 |
| 65 | +#define IR_RECEIVE_PIN_STRING "PA6" |
| 66 | +#define IR_SEND_PIN PA7 |
| 67 | +#define IR_SEND_PIN_STRING "PA7" |
| 68 | +#define TONE_PIN PA3 |
| 69 | +#define IR_TIMING_TEST_PIN PA5 |
| 70 | + |
| 71 | +#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__) |
| 72 | +//#include "ATtinySerialOut.h" |
| 73 | +# if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) |
| 74 | +# if defined(ARDUINO_AVR_DIGISPARK) |
| 75 | +#define LED_BUILTIN PB1 |
| 76 | +# endif |
| 77 | +#define IR_RECEIVE_PIN 0 |
| 78 | +#define IR_SEND_PIN 4 // Pin 2 is serial output with ATtinySerialOut. Pin 1 is internal LED and Pin3 is USB+ with pullup on Digispark board. |
| 79 | +#define TONE_PIN 3 |
| 80 | +//#define IR_TIMING_TEST_PIN 3 |
| 81 | + |
| 82 | +# else |
| 83 | +// ATtiny87 + ATtiny167 here. For ATtiny167 Pins PB6 and PA3 are usable as interrupt source. |
| 84 | +# if defined(ARDUINO_AVR_DIGISPARKPRO) |
| 85 | +#define LED_BUILTIN 1 // PB1 - on Digispark board labeled as pin 1 / for ATtinyCore lib use D9 |
| 86 | +#define IR_RECEIVE_PIN 9 // PA3 - on Digispark board labeled as pin 9 |
| 87 | +//#define IR_RECEIVE_PIN 14 // PB6 / INT0 is connected to USB+ on DigisparkPro boards |
| 88 | +#define IR_SEND_PIN 8 // PA2 - on Digispark board labeled as pin 8 |
| 89 | +#define TONE_PIN 5 // PA7 |
| 90 | +#define IR_TIMING_TEST_PIN 10 // PA4 |
| 91 | + |
| 92 | +# else |
| 93 | +#define IR_RECEIVE_PIN 3 |
| 94 | +#define IR_SEND_PIN 2 |
| 95 | +#define TONE_PIN 7 |
| 96 | +# endif |
| 97 | +# endif |
| 98 | + |
| 99 | +#elif defined(__AVR_ATtiny3217__) |
| 100 | +#define IR_RECEIVE_PIN 10 |
| 101 | +#define IR_SEND_PIN 11 |
| 102 | +#define TONE_PIN 3 |
| 103 | + |
| 104 | +#elif defined(ARDUINO_ARCH_APOLLO3) |
| 105 | +#define IR_RECEIVE_PIN 11 |
| 106 | +#define IR_SEND_PIN 12 |
| 107 | +#define TONE_PIN 5 |
| 108 | + |
| 109 | +#elif defined(ARDUINO_ARCH_MBED) // Arduino Nano 33 BLE |
| 110 | +#define IR_RECEIVE_PIN 3 |
| 111 | +#define IR_SEND_PIN 4 |
| 112 | +#define TONE_PIN 5 |
| 113 | +#define IR_TIMING_TEST_PIN 6 |
| 114 | + |
| 115 | +#elif defined(TEENSYDUINO) |
| 116 | +#define IR_RECEIVE_PIN 3 |
| 117 | +#define IR_SEND_PIN 4 |
| 118 | +#define TONE_PIN 5 |
| 119 | +#define IR_TIMING_TEST_PIN 6 |
| 120 | + |
| 121 | +#elif defined(__AVR__) |
| 122 | +#define IR_RECEIVE_PIN 2 // To be compatible with interrupt example, pin 2 is chosen here. |
| 123 | +#define IR_SEND_PIN 3 |
| 124 | +#define TONE_PIN 4 |
| 125 | +#define IR_TIMING_TEST_PIN 6 |
| 126 | + |
| 127 | +#elif defined(ARDUINO_ARCH_SAMD) |
| 128 | +#define IR_RECEIVE_PIN 2 // To be compatible with interrupt example, pin 2 is chosen here. |
| 129 | +#define IR_SEND_PIN 3 |
| 130 | +#define TONE_PIN 4 |
| 131 | +#define IR_TIMING_TEST_PIN 6 |
| 132 | + |
| 133 | +// On the Zero and others we switch explicitly to SerialUSB |
| 134 | +#define Serial SerialUSB |
| 135 | + |
| 136 | +// Definitions for the Chinese SAMD21 M0-Mini clone, which has no led connected to D13/PA17. |
| 137 | +// Attention!!! D2 and D4 are switched on these boards!!! |
| 138 | +// If you connect the LED, it is on pin 24/PB11. In this case activate the next two lines. |
| 139 | +//#undef LED_BUILTIN |
| 140 | +//#define LED_BUILTIN 24 // PB11 |
| 141 | +// As an alternative you can choose pin 25, it is the RX-LED pin (PB03), but active low.In this case activate the next 3 lines. |
| 142 | +//#undef LED_BUILTIN |
| 143 | +//#define LED_BUILTIN 25 // PB03 |
| 144 | +//#define FEEDBACK_LED_IS_ACTIVE_LOW // The RX LED on the M0-Mini is active LOW |
| 145 | + |
| 146 | +#else |
| 147 | +#warning Board / CPU is not detected using pre-processor symbols -> using default values, which may not fit. Please extend PinDefinitionsAndMore.h. |
| 148 | +// Default valued for unidentified boards |
| 149 | +#define IR_RECEIVE_PIN 2 |
| 150 | +#define IR_SEND_PIN 3 |
| 151 | +#define TONE_PIN 4 |
| 152 | +#define IR_TIMING_TEST_PIN 6 |
| 153 | +#endif // defined(ESP8266) |
| 154 | + |
| 155 | +/* |
| 156 | + * Helper macro for getting a macro definition as string |
| 157 | + */ |
| 158 | +#define STR_HELPER(x) #x |
| 159 | +#define STR(x) STR_HELPER(x) |
0 commit comments