удалила лишнее, протестировала
This commit is contained in:
1 parent
d9946ff386
commit
3b26203ebb
10 files changed
+87
-277
No files matched your search
@@ -50,10 +50,9 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include "PinDefinitionsAndMore.h" // Set IR_RECEIVE_PIN for different CPU's
|
||||
//#include "PinDefinitionsAndMore.h" // Set IR_RECEIVE_PIN for different CPU's
|
||||
#define IR_RECEIVE_PIN 2
|
||||
|
||||
//#define DEBUG // to see if attachInterrupt is used
|
||||
//#define TRACE // to see the state of the ISR state machine
|
||||
|
||||
/*
|
||||
* Protocol selection
|
||||
@@ -70,7 +69,6 @@
|
||||
//#define USE_CALLBACK_FOR_TINY_RECEIVER // Call the fixed function "void handleReceivedTinyIRData()" each time a frame or repeat is received.
|
||||
|
||||
#include "TinyIRReceiver.hpp" // include the code
|
||||
|
||||
/*
|
||||
* Helper macro for getting a macro definition as string
|
||||
*/
|
||||
@@ -80,18 +78,11 @@
|
||||
#endif
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.begin(9600);
|
||||
while (!Serial)
|
||||
; // Wait for Serial to become available. Is optimized away for some cores.
|
||||
|
||||
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) /*stm32duino*/|| defined(USBCON) /*STM32_stm32*/ \
|
||||
|| defined(SERIALUSB_PID) || defined(ARDUINO_ARCH_RP2040) || 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
|
||||
#if defined(ESP8266) || defined(ESP32)
|
||||
Serial.println();
|
||||
#endif
|
||||
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_TINYIR));
|
||||
|
||||
// Enables the interrupt generation on change of IR input signal
|
||||
@@ -147,23 +138,10 @@ void loop() {
|
||||
* This is the function, which is called if a complete frame was received
|
||||
* It runs in an ISR context with interrupts enabled, so functions like delay() etc. should work here
|
||||
*/
|
||||
# if defined(ESP8266) || defined(ESP32)
|
||||
IRAM_ATTR
|
||||
# endif
|
||||
|
||||
void handleReceivedTinyIRData() {
|
||||
# if defined(ARDUINO_ARCH_MBED) || defined(ESP32)
|
||||
/*
|
||||
* Printing is not allowed in ISR context for any kind of RTOS, so we use the slihjtly more complex,
|
||||
* but recommended way for handling a callback :-). Copy data for main loop.
|
||||
* For Mbed we get a kernel panic and "Error Message: Semaphore: 0x0, Not allowed in ISR context" for Serial.print()
|
||||
* for ESP32 we get a "Guru Meditation Error: Core 1 panic'ed" (we also have an RTOS running!)
|
||||
*/
|
||||
// Do something useful here...
|
||||
# else
|
||||
// As an example, print very short output, since we are in an interrupt context and do not want to miss the next interrupts of the repeats coming soon
|
||||
printTinyReceiverResultMinimal(&Serial);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user