mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-10 08:26:17 +00:00
Updated irRecv.h to include Nerf LOP
This commit is contained in:
39
irRecv.cpp
39
irRecv.cpp
@@ -1,10 +1,10 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
#ifdef IR_TIMER_USE_ESP32
|
||||
hw_timer_t *timer;
|
||||
void IRTimer(); // defined in IRremote.cpp
|
||||
#endif
|
||||
|
||||
#ifdef IR_TIMER_USE_ESP32
|
||||
hw_timer_t *timer;
|
||||
void IRTimer(); // defined in IRremote.cpp
|
||||
#endif
|
||||
|
||||
//+=============================================================================
|
||||
// Decodes the received IR message
|
||||
@@ -89,6 +89,11 @@ int IRrecv::decode (decode_results *results)
|
||||
DBG_PRINTLN("Attempting Lego Power Functions");
|
||||
if (decodeLegoPowerFunctions(results)) return true ;
|
||||
#endif
|
||||
|
||||
#if DECODE_NERF_LOP
|
||||
DBG_PRINTLN("Attempting Nerf Laser Ops Pro Functions");
|
||||
if (decodeNerfLOP(results)) return true ;
|
||||
#endif
|
||||
|
||||
// decodeHash returns a hash on any input.
|
||||
// Thus, it needs to be last in the list.
|
||||
@@ -122,17 +127,17 @@ IRrecv::IRrecv (int recvpin, int blinkpin)
|
||||
//
|
||||
void IRrecv::enableIRIn ( )
|
||||
{
|
||||
// Interrupt Service Routine - Fires every 50uS
|
||||
#ifdef ESP32
|
||||
// ESP32 has a proper API to setup timers, no weird chip macros needed
|
||||
// simply call the readable API versions :)
|
||||
// 3 timers, choose #1, 80 divider nanosecond precision, 1 to count up
|
||||
timer = timerBegin(1, 80, 1);
|
||||
timerAttachInterrupt(timer, &IRTimer, 1);
|
||||
// every 50ns, autoreload = true
|
||||
timerAlarmWrite(timer, 50, true);
|
||||
timerAlarmEnable(timer);
|
||||
#else
|
||||
// Interrupt Service Routine - Fires every 50uS
|
||||
#ifdef ESP32
|
||||
// ESP32 has a proper API to setup timers, no weird chip macros needed
|
||||
// simply call the readable API versions :)
|
||||
// 3 timers, choose #1, 80 divider nanosecond precision, 1 to count up
|
||||
timer = timerBegin(1, 80, 1);
|
||||
timerAttachInterrupt(timer, &IRTimer, 1);
|
||||
// every 50ns, autoreload = true
|
||||
timerAlarmWrite(timer, 50, true);
|
||||
timerAlarmEnable(timer);
|
||||
#else
|
||||
cli();
|
||||
// Setup pulse clock timer interrupt
|
||||
// Prescale /8 (16M/8 = 0.5 microseconds per tick)
|
||||
@@ -146,7 +151,7 @@ void IRrecv::enableIRIn ( )
|
||||
TIMER_RESET;
|
||||
|
||||
sei(); // enable interrupts
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Initialize state machine variables
|
||||
irparams.rcvstate = STATE_IDLE;
|
||||
|
||||
Reference in New Issue
Block a user