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