mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-29 17:52:49 +00:00
Compare commits
317 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d9075e76e | |||
| 793ea06011 | |||
| c1993b9c10 | |||
| ae5cd09352 | |||
|
|
48339f7f60 | ||
|
|
c6788e54db | ||
|
|
06d54ce5b2 | ||
|
|
8ba71c6489 | ||
|
|
72cd8c835f | ||
|
|
73b2c6e5a4 | ||
|
|
3aaa564482 | ||
|
|
b1eb407e54 | ||
|
|
9bce17ffab | ||
|
|
10b5077f56 | ||
|
|
0d0834a7de | ||
|
|
a0a0c7eb78 | ||
|
|
0cddce6dae | ||
|
|
9c6395fb32 | ||
|
|
f33c845751 | ||
|
|
3172f38352 | ||
|
|
8cb40b77f8 | ||
|
|
b838f3e7f7 | ||
|
|
469edd4ff1 | ||
|
|
a7d8452266 | ||
|
|
32b9523fa7 | ||
|
|
64d071cd67 | ||
|
|
0774bbb27a | ||
|
|
c292b40ea2 | ||
|
|
53ebde2c3c | ||
|
|
44d63e7696 | ||
|
|
f7253ef4f3 | ||
|
|
9105de0936 | ||
|
|
e3ed422272 | ||
|
|
da8ffb78d5 | ||
|
|
d28eebcd69 | ||
|
|
896d917ce2 | ||
|
|
58bab3d05a | ||
|
|
8cb322d159 | ||
|
|
bbb7c82f24 | ||
|
|
b01619d457 | ||
|
|
70e60a3437 | ||
|
|
2969f52237 | ||
|
|
cf96d94995 | ||
|
|
305bcde50f | ||
|
|
4cd5a9147a | ||
|
|
99c461235e | ||
|
|
ebe6c6d08b | ||
|
|
4dad022276 | ||
|
|
7e47a1ef5b | ||
|
|
1d66d463a8 | ||
|
|
16caf2a987 | ||
|
|
fdc51978c9 | ||
|
|
f2f315dc28 | ||
|
|
65313e1dc3 | ||
|
|
a31fcd0cc4 | ||
|
|
074b3cc6fc | ||
|
|
749125db09 | ||
|
|
9095dddbfe | ||
|
|
741a3382f3 | ||
|
|
656781c81b | ||
|
|
25f7cd0f86 | ||
|
|
424631ef18 | ||
|
|
6e00f0b855 | ||
|
|
b5ac2bac78 | ||
|
|
f81a2ab4bd | ||
|
|
ada8fb6e9f | ||
|
|
6463cdbe82 | ||
|
|
e8173dec7d | ||
|
|
aabbcd9c07 | ||
|
|
59cf4a8d6c | ||
|
|
594c626556 | ||
|
|
ac6a37779b | ||
|
|
d70289787a | ||
|
|
1e2c546064 | ||
|
|
d5a46041be | ||
|
|
13498eb7c9 | ||
|
|
b097ec8fe3 | ||
|
|
5624b40a49 | ||
|
|
cb513739ef | ||
|
|
00368d5dc7 | ||
|
|
a2331b607d | ||
|
|
c8a8948dc7 | ||
|
|
e66b3076dd | ||
|
|
2683d04b06 | ||
|
|
e1ade65de0 | ||
|
|
bc568b58d4 | ||
|
|
558626196b | ||
|
|
71e17dd1b1 | ||
|
|
aaf6a54ae7 | ||
|
|
eaf4e41f10 | ||
|
|
619425353f | ||
|
|
776df1ccf3 | ||
|
|
f2b52ba857 | ||
|
|
ae33a85531 | ||
|
|
3848c62de8 | ||
|
|
3a8cc878ca | ||
|
|
ead74f6dbd | ||
|
|
ca44211164 | ||
|
|
e076964dcc | ||
|
|
b8cb878aa4 | ||
|
|
f23e1bebec | ||
|
|
a78d800b09 | ||
|
|
e718638518 | ||
|
|
ac109b1634 | ||
|
|
8168214647 | ||
|
|
dbb49b738c | ||
|
|
20f0368ca2 | ||
|
|
6e51379fe5 | ||
|
|
0d17ef59d8 | ||
|
|
bbc36977d8 | ||
|
|
a4b6db26f4 | ||
|
|
b226283882 | ||
|
|
3e66d76511 | ||
|
|
27dff2ae60 | ||
|
|
1a3fd3e310 | ||
|
|
47569a245e | ||
|
|
31cfbc9dbd | ||
|
|
6ed1d49b19 | ||
|
|
35071167c0 | ||
|
|
e85aefd4cd | ||
|
|
b9e4c4ef7a | ||
|
|
2c1ea568e4 | ||
|
|
e07c845676 | ||
|
|
e3a5f01b04 | ||
|
|
ea8112124f | ||
|
|
fbf76c18ee | ||
|
|
2c890bb103 | ||
|
|
4d44cd18f2 | ||
|
|
aeb49b5a55 | ||
|
|
dcea4b32ce | ||
|
|
481972658d | ||
|
|
a07587f252 | ||
|
|
e73eae5e02 | ||
|
|
c326a4e073 | ||
|
|
79d9cc78c5 | ||
|
|
67f0bf2f9a | ||
|
|
ac1b2d28dd | ||
|
|
72d3d4dc26 | ||
|
|
0f03eeeaf2 | ||
|
|
969b34fcc4 | ||
|
|
ee067b1cb3 | ||
|
|
594722ad4d | ||
|
|
bba4ed8065 | ||
|
|
934ad53aad | ||
|
|
a5c2833e11 | ||
|
|
5060ce594e | ||
|
|
54e22eba82 | ||
|
|
646a93a9cd | ||
|
|
668f290759 | ||
|
|
03c8fedd02 | ||
|
|
c9ffe47ae1 | ||
|
|
c09ade268a | ||
|
|
b84825f261 | ||
|
|
ca52f05a50 | ||
|
|
50fa64bfad | ||
|
|
97078a581a | ||
|
|
2678449f99 | ||
|
|
3d3c2b9b28 | ||
|
|
ef4ba97522 | ||
|
|
4a8faa70c8 | ||
|
|
b00f6ad5e1 | ||
|
|
23ac8dc109 | ||
|
|
7925fcd36b | ||
|
|
d7a4fba705 | ||
|
|
ee655f09ea | ||
|
|
5ee3905157 | ||
|
|
25424cb5d8 | ||
|
|
f3ddc8543e | ||
|
|
79af2d3cca | ||
|
|
32beed8100 | ||
|
|
b765bf1052 | ||
|
|
6ce4df9134 | ||
|
|
b4c0143dca | ||
|
|
e582bd1442 | ||
|
|
8516174dad | ||
|
|
a3d8d5898d | ||
|
|
2dcc37ab0a | ||
|
|
927ddf229e | ||
|
|
68fc8dd7c3 | ||
|
|
74cd48baa8 | ||
|
|
5ff5cd753a | ||
|
|
0d973bb7b8 | ||
|
|
5b9d8f16f2 | ||
|
|
9eb9e60db5 | ||
|
|
945472807f | ||
|
|
99769349a3 | ||
|
|
8d0a044981 | ||
|
|
ca7f7cd654 | ||
|
|
07236dd6d5 | ||
|
|
67330bb22c | ||
|
|
3b99380e3b | ||
|
|
1072a9048f | ||
|
|
393407ebfd | ||
|
|
a23d4ea4f6 | ||
|
|
56999760c5 | ||
|
|
0b0719045e | ||
|
|
85679b491f | ||
|
|
ee13760c60 | ||
|
|
b2b278f8f7 | ||
|
|
ec40cdfea2 | ||
|
|
2619ed667e | ||
|
|
7eeff377f4 | ||
|
|
7ddf860bb2 | ||
|
|
02d6ec8ff9 | ||
|
|
48b77fe90a | ||
|
|
ee907442b1 | ||
|
|
f4e33ca456 | ||
|
|
0ca6c4ed1b | ||
|
|
17801ef132 | ||
|
|
87639f8b45 | ||
|
|
89d82ad930 | ||
|
|
e213019fca | ||
|
|
4811a3d86a | ||
|
|
b9694f2442 | ||
|
|
70d50b700f | ||
|
|
c58507655c | ||
|
|
6087fabfe1 | ||
|
|
5c217f0ee9 | ||
|
|
41e822997b | ||
|
|
7f639d18d8 | ||
|
|
e1dda22c6d | ||
|
|
0f11e2feef | ||
|
|
835b9d19be | ||
|
|
f46e30720c | ||
|
|
315aecdada | ||
|
|
0da14cd36b | ||
|
|
62696e0f4d | ||
|
|
f5e85e9432 | ||
|
|
e6ae660100 | ||
|
|
43cbf2d002 | ||
|
|
4938c307e0 | ||
|
|
4324bb9e99 | ||
|
|
d6ef2f99fa | ||
|
|
99d04629bc | ||
|
|
b9e5b969f7 | ||
|
|
3a21c0e413 | ||
|
|
ad42149c56 | ||
|
|
e9e4410a05 | ||
|
|
97909f86f0 | ||
|
|
e0a1312606 | ||
|
|
a0a67f4d37 | ||
|
|
0ec2bf5696 | ||
|
|
d7f2b1b08f | ||
|
|
e3567c7945 | ||
|
|
05db6714af | ||
|
|
0e82cf540c | ||
|
|
f08064bb96 | ||
|
|
111c96ab58 | ||
|
|
4e6fb9ecf4 | ||
|
|
a8b4269ca7 | ||
|
|
e2a7f22c1f | ||
|
|
f6066c3e65 | ||
|
|
cb6b1b622d | ||
|
|
b8043a7415 | ||
|
|
beef4710a3 | ||
|
|
7bf1e8d92d | ||
|
|
0dfa1925a8 | ||
|
|
1e1ec53911 | ||
|
|
4efc4d6bc8 | ||
|
|
4a7e85b65c | ||
|
|
97e7423260 | ||
|
|
8a40178ad2 | ||
|
|
3327011ec8 | ||
|
|
c448327a92 | ||
|
|
f5d5b58a3d | ||
|
|
155fcce927 | ||
|
|
d18b36fdeb | ||
|
|
c7ef1a226d | ||
|
|
05919f370a | ||
|
|
17091aa096 | ||
|
|
51534b383f | ||
|
|
77938e93c4 | ||
|
|
723ceccd05 | ||
|
|
bb0bb24021 | ||
|
|
935ba3f51d | ||
|
|
7398213165 | ||
|
|
b54ed9bbd2 | ||
|
|
04d397a51d | ||
|
|
c6342d2932 | ||
|
|
d9d2b74a30 | ||
|
|
9e079396d0 | ||
|
|
3e2d5434bd | ||
|
|
453939814a | ||
|
|
e899b1ff12 | ||
|
|
10f2b889c0 | ||
|
|
2bf17395a9 | ||
|
|
6e55c8595f | ||
|
|
b65240669d | ||
|
|
890ca057f6 | ||
|
|
f396a790f7 | ||
|
|
239964fabf | ||
|
|
4d7c915772 | ||
|
|
5898d346ad | ||
|
|
91dad6238a | ||
|
|
9d8865eda4 | ||
|
|
4a55923e49 | ||
|
|
da8b8e1c2d | ||
|
|
2b14770264 | ||
|
|
5896bf76b8 | ||
|
|
422ce8c793 | ||
|
|
f7a2263cdb | ||
|
|
5fadf82dd4 | ||
|
|
0def061d83 | ||
|
|
c05929c40e | ||
|
|
4b2dbddd06 | ||
|
|
d0ca6c155d | ||
|
|
1bc442fdf8 | ||
|
|
29a056daf2 | ||
|
|
e9158a57eb | ||
|
|
dbea1de1a8 | ||
|
|
baede92da0 | ||
|
|
3fe2e5b99d | ||
|
|
02e12ed80c | ||
|
|
3cc3c306c6 | ||
|
|
b4847a2685 | ||
|
|
acca27b698 | ||
|
|
19320b2144 |
@@ -18,7 +18,5 @@ These are the active contributors of this project that you may contact if there
|
|||||||
- [philipphenkel](https://github.com/philipphenkel): Active Contributor
|
- [philipphenkel](https://github.com/philipphenkel): Active Contributor
|
||||||
- [MCUdude](https://github.com/MCUdude): Contributor
|
- [MCUdude](https://github.com/MCUdude): Contributor
|
||||||
- [marcmerlin](https://github.com/marcmerlin): Contributor (ESP32 port)
|
- [marcmerlin](https://github.com/marcmerlin): Contributor (ESP32 port)
|
||||||
- [bengtmartensson](https://github.com/bengtmartensson): Active Contributor
|
|
||||||
- [MrBryonMiller](https://github.com/MrBryonMiller): Contributor
|
|
||||||
|
|
||||||
Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed.
|
Note: This list is being updated constantly so please let [z3t0](https://github.com/z3t0) know if you have been missed.
|
||||||
|
|||||||
@@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
// Defining IR_GLOBAL here allows us to declare the instantiation of global variables
|
// Defining IR_GLOBAL here allows us to declare the instantiation of global variables
|
||||||
#define IR_GLOBAL
|
#define IR_GLOBAL
|
||||||
#include "IRremote.h"
|
# include "IRremote.h"
|
||||||
|
# include "IRremoteInt.h"
|
||||||
#undef IR_GLOBAL
|
#undef IR_GLOBAL
|
||||||
|
|
||||||
#ifdef HAS_AVR_INTERRUPT_H
|
#ifndef IR_TIMER_USE_ESP32
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -51,12 +52,11 @@ int MATCH (int measured, int desired)
|
|||||||
DBG_PRINT(TICKS_HIGH(desired), DEC);
|
DBG_PRINT(TICKS_HIGH(desired), DEC);
|
||||||
|
|
||||||
bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
|
bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
|
||||||
if (passed) {
|
if (passed)
|
||||||
DBG_PRINTLN(F("?; passed"));
|
DBG_PRINTLN(F("?; passed"));
|
||||||
} else {
|
else
|
||||||
DBG_PRINTLN(F("?; FAILED"));
|
DBG_PRINTLN(F("?; FAILED"));
|
||||||
}
|
return passed;
|
||||||
return passed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//+========================================================
|
//+========================================================
|
||||||
@@ -78,12 +78,11 @@ int MATCH_MARK (int measured_ticks, int desired_us)
|
|||||||
|
|
||||||
bool passed = ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS))
|
bool passed = ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS))
|
||||||
&& (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS)));
|
&& (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS)));
|
||||||
if (passed) {
|
if (passed)
|
||||||
DBG_PRINTLN(F("?; passed"));
|
DBG_PRINTLN(F("?; passed"));
|
||||||
} else {
|
else
|
||||||
DBG_PRINTLN(F("?; FAILED"));
|
DBG_PRINTLN(F("?; FAILED"));
|
||||||
}
|
return passed;
|
||||||
return passed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//+========================================================
|
//+========================================================
|
||||||
@@ -105,12 +104,11 @@ int MATCH_SPACE (int measured_ticks, int desired_us)
|
|||||||
|
|
||||||
bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
|
bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
|
||||||
&& (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
|
&& (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
|
||||||
if (passed) {
|
if (passed)
|
||||||
DBG_PRINTLN(F("?; passed"));
|
DBG_PRINTLN(F("?; passed"));
|
||||||
} else {
|
else
|
||||||
DBG_PRINTLN(F("?; FAILED"));
|
DBG_PRINTLN(F("?; FAILED"));
|
||||||
}
|
return passed;
|
||||||
return passed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
@@ -125,7 +123,11 @@ int MATCH_SPACE (int measured_ticks, int desired_us)
|
|||||||
// As soon as first MARK arrives:
|
// As soon as first MARK arrives:
|
||||||
// Gap width is recorded; Ready is cleared; New logging starts
|
// Gap width is recorded; Ready is cleared; New logging starts
|
||||||
//
|
//
|
||||||
|
#ifdef IR_TIMER_USE_ESP32
|
||||||
|
void IRTimer()
|
||||||
|
#else
|
||||||
ISR (TIMER_INTR_NAME)
|
ISR (TIMER_INTR_NAME)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
TIMER_RESET;
|
TIMER_RESET;
|
||||||
|
|
||||||
@@ -187,7 +189,6 @@ ISR (TIMER_INTR_NAME)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BLINKLED
|
|
||||||
// If requested, flash LED while receiving IR data
|
// If requested, flash LED while receiving IR data
|
||||||
if (irparams.blinkflag) {
|
if (irparams.blinkflag) {
|
||||||
if (irdata == MARK)
|
if (irdata == MARK)
|
||||||
@@ -196,5 +197,4 @@ ISR (TIMER_INTR_NAME)
|
|||||||
else if (irparams.blinkpin) digitalWrite(irparams.blinkpin, LOW); // Turn user defined pin LED on
|
else if (irparams.blinkpin) digitalWrite(irparams.blinkpin, LOW); // Turn user defined pin LED on
|
||||||
else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on
|
else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on
|
||||||
}
|
}
|
||||||
#endif // BLINKLED
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
/**
|
|
||||||
* @file IRremote.h
|
|
||||||
* @brief Public API to the library.
|
|
||||||
*/
|
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// IRremote
|
// IRremote
|
||||||
@@ -25,7 +21,7 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// The ISR header contains several useful macros the user may wish to use
|
// The ISR header contains several useful macros the user may wish to use
|
||||||
//
|
//
|
||||||
#include "private/IRremoteInt.h"
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Supported IR protocols
|
// Supported IR protocols
|
||||||
@@ -83,6 +79,9 @@
|
|||||||
#define DECODE_LEGO_PF 0 // NOT WRITTEN
|
#define DECODE_LEGO_PF 0 // NOT WRITTEN
|
||||||
#define SEND_LEGO_PF 1
|
#define SEND_LEGO_PF 1
|
||||||
|
|
||||||
|
#define DECODE_NERF_LOP 0 // NOT WRITTEN
|
||||||
|
#define SEND_NERF_LOP 1
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// When sending a Pronto code we request to send either the "once" code
|
// When sending a Pronto code we request to send either the "once" code
|
||||||
// or the "repeat" code
|
// or the "repeat" code
|
||||||
@@ -98,10 +97,10 @@
|
|||||||
#define PRONTO_FALLBACK true
|
#define PRONTO_FALLBACK true
|
||||||
#define PRONTO_NOFALLBACK false
|
#define PRONTO_NOFALLBACK false
|
||||||
|
|
||||||
/**
|
//------------------------------------------------------------------------------
|
||||||
* An enum consisting of all supported formats.
|
// An enumerated list of all supported formats
|
||||||
* You do NOT need to remove entries from this list when disabling protocols!
|
// You do NOT need to remove entries from this list when disabling protocols!
|
||||||
*/
|
//
|
||||||
typedef
|
typedef
|
||||||
enum {
|
enum {
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
@@ -123,12 +122,13 @@ typedef
|
|||||||
DENON,
|
DENON,
|
||||||
PRONTO,
|
PRONTO,
|
||||||
LEGO_PF,
|
LEGO_PF,
|
||||||
|
NERF_LOP,
|
||||||
}
|
}
|
||||||
decode_type_t;
|
decode_type_t;
|
||||||
|
|
||||||
/**
|
//------------------------------------------------------------------------------
|
||||||
* Set DEBUG to 1 for lots of lovely debug output.
|
// Set DEBUG to 1 for lots of lovely debug output
|
||||||
*/
|
//
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -138,13 +138,7 @@ decode_type_t;
|
|||||||
# define DBG_PRINT(...) Serial.print(__VA_ARGS__)
|
# define DBG_PRINT(...) Serial.print(__VA_ARGS__)
|
||||||
# define DBG_PRINTLN(...) Serial.println(__VA_ARGS__)
|
# define DBG_PRINTLN(...) Serial.println(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
/**
|
|
||||||
* If DEBUG, print the arguments, otherwise do nothing.
|
|
||||||
*/
|
|
||||||
# define DBG_PRINT(...)
|
# define DBG_PRINT(...)
|
||||||
/**
|
|
||||||
* If DEBUG, print the arguments as a line, otherwise do nothing.
|
|
||||||
*/
|
|
||||||
# define DBG_PRINTLN(...)
|
# define DBG_PRINTLN(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -155,71 +149,39 @@ int MATCH (int measured, int desired) ;
|
|||||||
int MATCH_MARK (int measured_ticks, int desired_us) ;
|
int MATCH_MARK (int measured_ticks, int desired_us) ;
|
||||||
int MATCH_SPACE (int measured_ticks, int desired_us) ;
|
int MATCH_SPACE (int measured_ticks, int desired_us) ;
|
||||||
|
|
||||||
/**
|
//------------------------------------------------------------------------------
|
||||||
* Results returned from the decoder
|
// Results returned from the decoder
|
||||||
*/
|
//
|
||||||
class decode_results
|
class decode_results
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
decode_type_t decode_type; ///< UNKNOWN, NEC, SONY, RC5, ...
|
decode_type_t decode_type; // UNKNOWN, NEC, SONY, RC5, ...
|
||||||
unsigned int address; ///< Used by Panasonic & Sharp [16-bits]
|
unsigned int address; // Used by Panasonic & Sharp [16-bits]
|
||||||
unsigned long value; ///< Decoded value [max 32-bits]
|
unsigned long value; // Decoded value [max 32-bits]
|
||||||
int bits; ///< Number of bits in decoded value
|
int bits; // Number of bits in decoded value
|
||||||
volatile unsigned int *rawbuf; ///< Raw intervals in 50uS ticks
|
volatile unsigned int *rawbuf; // Raw intervals in 50uS ticks
|
||||||
int rawlen; ///< Number of records in rawbuf
|
int rawlen; // Number of records in rawbuf
|
||||||
int overflow; ///< true iff IR raw code too long
|
int overflow; // true iff IR raw code too long
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
//------------------------------------------------------------------------------
|
||||||
* Decoded value for NEC when a repeat code is received
|
// Decoded value for NEC when a repeat code is received
|
||||||
*/
|
//
|
||||||
#define REPEAT 0xFFFFFFFF
|
#define REPEAT 0xFFFFFFFF
|
||||||
|
|
||||||
/**
|
//------------------------------------------------------------------------------
|
||||||
* Main class for receiving IR
|
// Main class for receiving IR
|
||||||
*/
|
//
|
||||||
class IRrecv
|
class IRrecv
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Instantiate the IRrecv class. Multiple instantiation is not supported.
|
|
||||||
* @param recvpin Arduino pin to use. No sanity check is made.
|
|
||||||
*/
|
|
||||||
IRrecv (int recvpin) ;
|
IRrecv (int recvpin) ;
|
||||||
/**
|
|
||||||
* Instantiate the IRrecv class. Multiple instantiation is not supported.
|
|
||||||
* @param recvpin Arduino pin to use, where a demodulating IR receiver is connected.
|
|
||||||
* @param blinkpin pin to blink when receiving IR. Not supported by all hardware. No sanity check is made.
|
|
||||||
*/
|
|
||||||
IRrecv (int recvpin, int blinkpin);
|
IRrecv (int recvpin, int blinkpin);
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: Why is this public???
|
|
||||||
* @param blinkflag
|
|
||||||
*/
|
|
||||||
void blink13 (int blinkflag) ;
|
void blink13 (int blinkflag) ;
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempt to decode the recently receive IR signal
|
|
||||||
* @param results decode_results instance returning the decode, if any.
|
|
||||||
* @return success of operation. TODO: convert to bool
|
|
||||||
*/
|
|
||||||
int decode (decode_results *results) ;
|
int decode (decode_results *results) ;
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable IR reception.
|
|
||||||
*/
|
|
||||||
void enableIRIn ( ) ;
|
void enableIRIn ( ) ;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns status of reception
|
|
||||||
* @return true if no reception is on-going.
|
|
||||||
*/
|
|
||||||
bool isIdle ( ) ;
|
bool isIdle ( ) ;
|
||||||
|
|
||||||
/**
|
|
||||||
* Called to re-enable IR reception.
|
|
||||||
*/
|
|
||||||
void resume ( ) ;
|
void resume ( ) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -228,17 +190,10 @@ class IRrecv
|
|||||||
|
|
||||||
//......................................................................
|
//......................................................................
|
||||||
# if (DECODE_RC5 || DECODE_RC6)
|
# if (DECODE_RC5 || DECODE_RC6)
|
||||||
/**
|
// This helper function is shared by RC5 and RC6
|
||||||
* This helper function is shared by RC5 and RC6
|
|
||||||
*/
|
|
||||||
int getRClevel (decode_results *results, int *offset, int *used, int t1) ;
|
int getRClevel (decode_results *results, int *offset, int *used, int t1) ;
|
||||||
# endif
|
# endif
|
||||||
# if DECODE_RC5
|
# if DECODE_RC5
|
||||||
/**
|
|
||||||
* Try to decode the recently received IR signal as an RC5 signal-
|
|
||||||
* @param results decode_results instance returning the decode, if any.
|
|
||||||
* @return Success of the operation.
|
|
||||||
*/
|
|
||||||
bool decodeRC5 (decode_results *results) ;
|
bool decodeRC5 (decode_results *results) ;
|
||||||
# endif
|
# endif
|
||||||
# if DECODE_RC6
|
# if DECODE_RC6
|
||||||
@@ -300,26 +255,19 @@ class IRrecv
|
|||||||
# if DECODE_LEGO_PF
|
# if DECODE_LEGO_PF
|
||||||
bool decodeLegoPowerFunctions (decode_results *results) ;
|
bool decodeLegoPowerFunctions (decode_results *results) ;
|
||||||
# endif
|
# endif
|
||||||
|
//......................................................................
|
||||||
|
# if DECODE_NERF_LOP
|
||||||
|
bool decodeNerfLOP (decode_results *results) ;
|
||||||
|
# endif
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
/**
|
//------------------------------------------------------------------------------
|
||||||
* Main class for sending IR
|
// Main class for sending IR
|
||||||
*/
|
//
|
||||||
class IRsend
|
class IRsend
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#ifdef USE_SOFT_CARRIER
|
IRsend () { }
|
||||||
|
|
||||||
IRsend(int pin = SEND_PIN)
|
|
||||||
{
|
|
||||||
sendPin = pin;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
IRsend()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void custom_delay_usec (unsigned long uSecs);
|
void custom_delay_usec (unsigned long uSecs);
|
||||||
void enableIROut (int khz) ;
|
void enableIROut (int khz) ;
|
||||||
@@ -330,7 +278,6 @@ class IRsend
|
|||||||
//......................................................................
|
//......................................................................
|
||||||
# if SEND_RC5
|
# if SEND_RC5
|
||||||
void sendRC5 (unsigned long data, int nbits) ;
|
void sendRC5 (unsigned long data, int nbits) ;
|
||||||
void sendRC5ext (unsigned long addr, unsigned long cmd, boolean toggle);
|
|
||||||
# endif
|
# endif
|
||||||
# if SEND_RC6
|
# if SEND_RC6
|
||||||
void sendRC6 (unsigned long data, int nbits) ;
|
void sendRC6 (unsigned long data, int nbits) ;
|
||||||
@@ -400,20 +347,10 @@ class IRsend
|
|||||||
# if SEND_LEGO_PF
|
# if SEND_LEGO_PF
|
||||||
void sendLegoPowerFunctions (uint16_t data, bool repeat = true) ;
|
void sendLegoPowerFunctions (uint16_t data, bool repeat = true) ;
|
||||||
# endif
|
# endif
|
||||||
|
//......................................................................
|
||||||
#ifdef USE_SOFT_CARRIER
|
# if SEND_NERF_LOP
|
||||||
private:
|
void sendNerfLOP (uint16_t data, bool repeat = true) ;
|
||||||
int sendPin;
|
# endif
|
||||||
|
|
||||||
unsigned int periodTime;
|
|
||||||
unsigned int periodOnTime;
|
|
||||||
|
|
||||||
void sleepMicros(unsigned long us);
|
|
||||||
void sleepUntilMicros(unsigned long targetTime);
|
|
||||||
|
|
||||||
#else
|
|
||||||
const int sendPin = SEND_PIN;
|
|
||||||
#endif
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -18,9 +18,15 @@
|
|||||||
#define IRremoteint_h
|
#define IRremoteint_h
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Include the Arduino header
|
// Include the right Arduino header
|
||||||
//
|
//
|
||||||
#include <Arduino.h>
|
#if defined(ARDUINO) && (ARDUINO >= 100)
|
||||||
|
# include <Arduino.h>
|
||||||
|
#else
|
||||||
|
# if !defined(IRPRONTO)
|
||||||
|
# include <WProgram.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// This handles definition and access to global variables
|
// This handles definition and access to global variables
|
||||||
@@ -34,22 +40,19 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Information for the Interrupt Service Routine
|
// Information for the Interrupt Service Routine
|
||||||
//
|
//
|
||||||
#define RAWBUF 101 ///< Maximum length of raw duration buffer. Must be odd.
|
#define RAWBUF 101 // Maximum length of raw duration buffer
|
||||||
|
|
||||||
/**
|
|
||||||
* This struct is used to communicate with the ISR (interrupt service routine).
|
|
||||||
*/
|
|
||||||
typedef
|
typedef
|
||||||
struct {
|
struct {
|
||||||
// The fields are ordered to reduce memory over caused by struct-padding
|
// The fields are ordered to reduce memory over caused by struct-padding
|
||||||
uint8_t rcvstate; ///< State Machine state
|
uint8_t rcvstate; // State Machine state
|
||||||
uint8_t recvpin; ///< Pin connected to IR data from detector
|
uint8_t recvpin; // Pin connected to IR data from detector
|
||||||
uint8_t blinkpin;
|
uint8_t blinkpin;
|
||||||
uint8_t blinkflag; ///< true -> enable blinking of pin on IR processing
|
uint8_t blinkflag; // true -> enable blinking of pin on IR processing
|
||||||
uint8_t rawlen; ///< counter of entries in rawbuf
|
uint8_t rawlen; // counter of entries in rawbuf
|
||||||
unsigned int timer; ///< State timer, counts 50uS ticks.
|
unsigned int timer; // State timer, counts 50uS ticks.
|
||||||
unsigned int rawbuf[RAWBUF]; ///< raw data
|
unsigned int rawbuf[RAWBUF]; // raw data
|
||||||
uint8_t overflow; ///< Raw buffer overflow occurred
|
uint8_t overflow; // Raw buffer overflow occurred
|
||||||
}
|
}
|
||||||
irparams_t;
|
irparams_t;
|
||||||
|
|
||||||
@@ -60,11 +63,9 @@ irparams_t;
|
|||||||
#define STATE_STOP 5
|
#define STATE_STOP 5
|
||||||
#define STATE_OVERFLOW 6
|
#define STATE_OVERFLOW 6
|
||||||
|
|
||||||
/**
|
// Allow all parts of the code access to the ISR data
|
||||||
* Allow all parts of the code access to the ISR data
|
// NB. The data can be changed by the ISR at any time, even mid-function
|
||||||
* NB. The data can be changed by the ISR at any time, even mid-function
|
// Therefore we declare it as "volatile" to stop the compiler/CPU caching it
|
||||||
* Therefore we declare it as "volatile" to stop the compiler/CPU caching it
|
|
||||||
*/
|
|
||||||
EXTERN volatile irparams_t irparams;
|
EXTERN volatile irparams_t irparams;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -84,12 +85,8 @@ EXTERN volatile irparams_t irparams;
|
|||||||
// Pulse parameters in uSec
|
// Pulse parameters in uSec
|
||||||
//
|
//
|
||||||
|
|
||||||
/**
|
// Due to sensor lag, when received, Marks tend to be 100us too long and
|
||||||
* When received, marks tend to be too long and
|
// Spaces tend to be 100us too short
|
||||||
* spaces tend to be too short.
|
|
||||||
* To compensate for this, MARK_EXCESS is subtracted from all marks,
|
|
||||||
* and added to all spaces.
|
|
||||||
*/
|
|
||||||
#define MARK_EXCESS 100
|
#define MARK_EXCESS 100
|
||||||
|
|
||||||
// Upper and Lower percentage tolerances in measurements
|
// Upper and Lower percentage tolerances in measurements
|
||||||
20
README.md
20
README.md
@@ -8,7 +8,7 @@ This library enables you to send and receive using infra-red signals on an Ardui
|
|||||||
|
|
||||||
Tutorials and more information will be made available on [the official homepage](http://z3t0.github.io/Arduino-IRremote/).
|
Tutorials and more information will be made available on [the official homepage](http://z3t0.github.io/Arduino-IRremote/).
|
||||||
|
|
||||||
## Version - 2.5.0b
|
## Version - 2.2.3
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page.
|
1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page.
|
||||||
@@ -33,6 +33,7 @@ Whether you use the Adafruit Neopixel lib, or FastLED, interrupts get disabled o
|
|||||||
- ATtiny 84 / 85
|
- ATtiny 84 / 85
|
||||||
- ESP32 (receive only)
|
- ESP32 (receive only)
|
||||||
- ESP8266 is supported in a fork based on an old codebase that isn't as recent, but it works reasonably well given that perfectly timed sub millisecond interrupts are different on that chip. See https://github.com/markszabo/IRremoteESP8266
|
- ESP8266 is supported in a fork based on an old codebase that isn't as recent, but it works reasonably well given that perfectly timed sub millisecond interrupts are different on that chip. See https://github.com/markszabo/IRremoteESP8266
|
||||||
|
- Sparkfun Pro Micro
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ We are open to suggestions for adding support to new boards, however we highly r
|
|||||||
| [ATtiny84](https://github.com/SpenceKonde/ATTinyCore) | **6** | **1** |
|
| [ATtiny84](https://github.com/SpenceKonde/ATTinyCore) | **6** | **1** |
|
||||||
| [ATtiny85](https://github.com/SpenceKonde/ATTinyCore) | **1** | **TINY0** |
|
| [ATtiny85](https://github.com/SpenceKonde/ATTinyCore) | **1** | **TINY0** |
|
||||||
| [ATmega8](https://github.com/MCUdude/MiniCore) | **9** | **1** |
|
| [ATmega8](https://github.com/MCUdude/MiniCore) | **9** | **1** |
|
||||||
| Atmega32u4 | 5, **9**, 13 | 1, 3, **4** |
|
| Atmega32u4 | 5, 9, **13** | 1, 3, **4** |
|
||||||
| [ATmega48, ATmega88, ATmega168, ATmega328](https://github.com/MCUdude/MiniCore) | **3**, 9 | 1, **2** |
|
| [ATmega48, ATmega88, ATmega168, ATmega328](https://github.com/MCUdude/MiniCore) | **3**, 9 | 1, **2** |
|
||||||
| [ATmega1284](https://github.com/MCUdude/MightyCore) | 13, 14, 6 | 1, **2**, 3 |
|
| [ATmega1284](https://github.com/MCUdude/MightyCore) | 13, 14, 6 | 1, **2**, 3 |
|
||||||
| [ATmega164, ATmega324, ATmega644](https://github.com/MCUdude/MightyCore) | 13, **14** | 1, **2** |
|
| [ATmega164, ATmega324, ATmega644](https://github.com/MCUdude/MightyCore) | 13, **14** | 1, **2** |
|
||||||
@@ -51,6 +52,7 @@ We are open to suggestions for adding support to new boards, however we highly r
|
|||||||
| [ATmega64, ATmega128](https://github.com/MCUdude/MegaCore) | **13** | **1** |
|
| [ATmega64, ATmega128](https://github.com/MCUdude/MegaCore) | **13** | **1** |
|
||||||
| ATmega1280, ATmega2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 |
|
| ATmega1280, ATmega2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 |
|
||||||
| [ESP32](http://esp32.net/) | N/A (not supported) | **1** |
|
| [ESP32](http://esp32.net/) | N/A (not supported) | **1** |
|
||||||
|
| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4_HS |
|
||||||
| [Teensy 1.0](https://www.pjrc.com/teensy/) | **17** | **1** |
|
| [Teensy 1.0](https://www.pjrc.com/teensy/) | **17** | **1** |
|
||||||
| [Teensy 2.0](https://www.pjrc.com/teensy/) | 9, **10**, 14 | 1, 3, **4_HS** |
|
| [Teensy 2.0](https://www.pjrc.com/teensy/) | 9, **10**, 14 | 1, 3, **4_HS** |
|
||||||
| [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 |
|
| [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 |
|
||||||
@@ -68,20 +70,6 @@ The table above lists the currently supported timers and corresponding send pins
|
|||||||
## Usage
|
## Usage
|
||||||
- TODO (Check examples for now)
|
- TODO (Check examples for now)
|
||||||
|
|
||||||
## API documentation
|
|
||||||
This project documents the library API using [Doxygen](http://www.doxygen.org).
|
|
||||||
It is planned to make generated and up-to-date API documentation available online.
|
|
||||||
|
|
||||||
To generate the API documentation,
|
|
||||||
Doxygen, as well as [Graphviz](http://www.graphviz.org/) should be installed.
|
|
||||||
(Note that on Windows, it may be necessary to add the Graphviz binary directory
|
|
||||||
(something like `C:\Program Files\Graphviz2.38\bin`)
|
|
||||||
to the `PATH` variable manually.)
|
|
||||||
With Doxygen and Graphviz installed, issue the command
|
|
||||||
`doxygen` from the command line in the main project directory, which will
|
|
||||||
generate the API documentation in HTML format.
|
|
||||||
The just generated `api-doc/index.html` can now be opened in a browser.
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
If you want to contribute to this project:
|
If you want to contribute to this project:
|
||||||
- Report bugs and errors
|
- Report bugs and errors
|
||||||
|
|||||||
240
arduino-irremote.sublime-workspace
Normal file
240
arduino-irremote.sublime-workspace
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
{
|
||||||
|
"auto_complete":
|
||||||
|
{
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"vb",
|
||||||
|
"vboMatrix"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"buffers":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"build_system": "",
|
||||||
|
"build_system_choices":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"build_varint": "",
|
||||||
|
"command_palette":
|
||||||
|
{
|
||||||
|
"height": 275.0,
|
||||||
|
"last_filter": "blame",
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"blame",
|
||||||
|
"Git: Blame"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"install",
|
||||||
|
"Package Control: Install Package"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"diff",
|
||||||
|
"Git: Diff Current File"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"js",
|
||||||
|
"Set Syntax: JavaScript"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"i",
|
||||||
|
"Package Control: Install Package"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"instal",
|
||||||
|
"Package Control: Install Package"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"width": 510.0
|
||||||
|
},
|
||||||
|
"console":
|
||||||
|
{
|
||||||
|
"height": 126.0,
|
||||||
|
"history":
|
||||||
|
[
|
||||||
|
"import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"distraction_free":
|
||||||
|
{
|
||||||
|
"menu_visible": true,
|
||||||
|
"show_minimap": false,
|
||||||
|
"show_open_files": false,
|
||||||
|
"show_tabs": false,
|
||||||
|
"side_bar_visible": false,
|
||||||
|
"status_bar_visible": false
|
||||||
|
},
|
||||||
|
"expanded_folders":
|
||||||
|
[
|
||||||
|
"/C/Users/Rafi Khan/Documents/Arduino/libraries/Arduino-IRremote"
|
||||||
|
],
|
||||||
|
"file_history":
|
||||||
|
[
|
||||||
|
"/C/Users/Rafi Khan/Documents/Arduino/libraries/Arduino-IRremote/changelog.md",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/Arduino-IRremote/arduino-irremote.sublime-project",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/Arduino-IRremote/.gitignore",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/README.md",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/shader.frag",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/package.json",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/block.js",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/chunker.js",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/index.js",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/blocks",
|
||||||
|
"/C/Users/Rafi Khan/AppData/Roaming/Sublime Text 3/Packages/User/Preferences.sublime-settings",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/shader.vert",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/magic.sublime-project",
|
||||||
|
"/C/Users/Rafi Khan/Documents/Development/magic/node_modules/browserify/node_modules/syntax-error/node_modules/acorn/.tern-project",
|
||||||
|
"/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/supermarket.py",
|
||||||
|
"/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/takingavacation.py",
|
||||||
|
"/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/TipCalculator.py",
|
||||||
|
"/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/battleship.py",
|
||||||
|
"/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/exam.py",
|
||||||
|
"/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/pyglatin.py",
|
||||||
|
"/C/Users/Rafi Khan/OneDrive/Documents/School-RafiKhan/Grade 11/CS30/Python/student.py"
|
||||||
|
],
|
||||||
|
"find":
|
||||||
|
{
|
||||||
|
"height": 28.0
|
||||||
|
},
|
||||||
|
"find_in_files":
|
||||||
|
{
|
||||||
|
"height": 0.0,
|
||||||
|
"where_history":
|
||||||
|
[
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"find_state":
|
||||||
|
{
|
||||||
|
"case_sensitive": false,
|
||||||
|
"find_history":
|
||||||
|
[
|
||||||
|
"i",
|
||||||
|
"Direction",
|
||||||
|
";",
|
||||||
|
";\n",
|
||||||
|
"north",
|
||||||
|
"cubeMatrix",
|
||||||
|
")\n",
|
||||||
|
"vec3.set",
|
||||||
|
"f",
|
||||||
|
";",
|
||||||
|
"();\n",
|
||||||
|
"render",
|
||||||
|
"this",
|
||||||
|
"y"
|
||||||
|
],
|
||||||
|
"highlight": true,
|
||||||
|
"in_selection": false,
|
||||||
|
"preserve_case": false,
|
||||||
|
"regex": false,
|
||||||
|
"replace_history":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"reverse": false,
|
||||||
|
"show_context": true,
|
||||||
|
"use_buffer2": true,
|
||||||
|
"whole_word": false,
|
||||||
|
"wrap": true
|
||||||
|
},
|
||||||
|
"groups":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"sheets":
|
||||||
|
[
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"incremental_find":
|
||||||
|
{
|
||||||
|
"height": 28.0
|
||||||
|
},
|
||||||
|
"input":
|
||||||
|
{
|
||||||
|
"height": 66.0
|
||||||
|
},
|
||||||
|
"layout":
|
||||||
|
{
|
||||||
|
"cells":
|
||||||
|
[
|
||||||
|
[
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"cols":
|
||||||
|
[
|
||||||
|
0.0,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"rows":
|
||||||
|
[
|
||||||
|
0.0,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"menu_visible": true,
|
||||||
|
"output.find_results":
|
||||||
|
{
|
||||||
|
"height": 0.0
|
||||||
|
},
|
||||||
|
"pinned_build_system": "",
|
||||||
|
"project": "arduino-irremote.sublime-project",
|
||||||
|
"replace":
|
||||||
|
{
|
||||||
|
"height": 52.0
|
||||||
|
},
|
||||||
|
"save_all_on_build": true,
|
||||||
|
"select_file":
|
||||||
|
{
|
||||||
|
"height": 0.0,
|
||||||
|
"last_filter": "",
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"json",
|
||||||
|
"package.json"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"inde",
|
||||||
|
"index.js"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"width": 0.0
|
||||||
|
},
|
||||||
|
"select_project":
|
||||||
|
{
|
||||||
|
"height": 0.0,
|
||||||
|
"last_filter": "",
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"width": 0.0
|
||||||
|
},
|
||||||
|
"select_symbol":
|
||||||
|
{
|
||||||
|
"height": 0.0,
|
||||||
|
"last_filter": "",
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"width": 0.0
|
||||||
|
},
|
||||||
|
"selected_group": 0,
|
||||||
|
"settings":
|
||||||
|
{
|
||||||
|
},
|
||||||
|
"show_minimap": true,
|
||||||
|
"show_open_files": false,
|
||||||
|
"show_tabs": true,
|
||||||
|
"side_bar_visible": true,
|
||||||
|
"side_bar_width": 150.0,
|
||||||
|
"status_bar_visible": true,
|
||||||
|
"template_settings":
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,37 +15,13 @@
|
|||||||
//
|
//
|
||||||
// JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
// JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
|
||||||
// Whynter A/C ARC-110WD added by Francesco Meschia
|
// Whynter A/C ARC-110WD added by Francesco Meschia
|
||||||
|
|
||||||
|
// Sparkfun Pro Micro support by Alastair McCormack
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
#ifndef boarddefs_h
|
#ifndef boarddefs_h
|
||||||
#define boarddefs_h
|
#define boarddefs_h
|
||||||
|
|
||||||
// Define some defaults, that some boards may like to override
|
|
||||||
// (This is to avoid negative logic, ! DONT_... is just awkward.)
|
|
||||||
|
|
||||||
// This board has/needs the avr/interrupt.h
|
|
||||||
#define HAS_AVR_INTERRUPT_H
|
|
||||||
|
|
||||||
// Define if sending is supported
|
|
||||||
#define SENDING_SUPPORTED
|
|
||||||
|
|
||||||
// If defined, a standard enableIRIn function will be define.
|
|
||||||
// Undefine for boards supplying their own.
|
|
||||||
#define USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
|
|
||||||
// Duty cycle in percent for sent signals. Presently takes effect only with USE_SOFT_CARRIER
|
|
||||||
#define DUTY_CYCLE 50
|
|
||||||
|
|
||||||
// If USE_SOFT_CARRIER, this amount (in micro seconds) is subtracted from the
|
|
||||||
// on-time of the pulses.
|
|
||||||
#define PULSE_CORRECTION 3
|
|
||||||
|
|
||||||
// digitalWrite is supposed to be slow. If this is an issue, define faster,
|
|
||||||
// board-dependent versions of these macros SENDPIN_ON(pin) and SENDPIN_OFF(pin).
|
|
||||||
// Portable, possibly slow, default definitions are given at the end of this file.
|
|
||||||
// If defining new versions, feel free to ignore the pin argument if it
|
|
||||||
// is not configurable on the current board.
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Defines for blinking the LED
|
// Defines for blinking the LED
|
||||||
//
|
//
|
||||||
@@ -65,31 +41,11 @@
|
|||||||
# define BLINKLED_ON() (PORTD |= B00000001)
|
# define BLINKLED_ON() (PORTD |= B00000001)
|
||||||
# define BLINKLED_OFF() (PORTD &= B11111110)
|
# define BLINKLED_OFF() (PORTD &= B11111110)
|
||||||
|
|
||||||
#elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
|
// No system LED on ESP32, disable blinking
|
||||||
# define BLINKLED LED_BUILTIN
|
|
||||||
# define BLINKLED_ON() (digitalWrite(LED_BUILTIN, HIGH))
|
|
||||||
# define BLINKLED_OFF() (digitalWrite(LED_BUILTIN, LOW))
|
|
||||||
|
|
||||||
# define USE_SOFT_CARRIER
|
|
||||||
// Define to use spin wait instead of delayMicros()
|
|
||||||
//# define USE_SPIN_WAIT
|
|
||||||
# undef USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
|
|
||||||
// The default pin used used for sending.
|
|
||||||
# define SEND_PIN 9
|
|
||||||
|
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
// No system LED on ESP32, disable blinking by NOT defining BLINKLED
|
# define BLINKLED 255
|
||||||
|
# define BLINKLED_ON() 1
|
||||||
// avr/interrupt.h is not present
|
# define BLINKLED_OFF() 1
|
||||||
# undef HAS_AVR_INTERRUPT_H
|
|
||||||
|
|
||||||
// Sending not implemented
|
|
||||||
# undef SENDING_SUPPORTED
|
|
||||||
|
|
||||||
// Supply own enbleIRIn
|
|
||||||
# undef USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# define BLINKLED 13
|
# define BLINKLED 13
|
||||||
# define BLINKLED_ON() (PORTB |= B00100000)
|
# define BLINKLED_ON() (PORTB |= B00100000)
|
||||||
@@ -116,8 +72,14 @@
|
|||||||
// switch IRremote to use a different timer.
|
// switch IRremote to use a different timer.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
// Sparkfun Pro Micro
|
||||||
|
#if defined(ARDUINO_AVR_PROMICRO)
|
||||||
|
//#define IR_USE_TIMER1 // tx = pin 9
|
||||||
|
#define IR_USE_TIMER3 // tx = pin 5
|
||||||
|
//#define IR_USE_TIMER4_HS // tx = pin 5
|
||||||
|
|
||||||
// Arduino Mega
|
// Arduino Mega
|
||||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
//#define IR_USE_TIMER1 // tx = pin 11
|
//#define IR_USE_TIMER1 // tx = pin 11
|
||||||
#define IR_USE_TIMER2 // tx = pin 9
|
#define IR_USE_TIMER2 // tx = pin 9
|
||||||
//#define IR_USE_TIMER3 // tx = pin 5
|
//#define IR_USE_TIMER3 // tx = pin 5
|
||||||
@@ -131,8 +93,8 @@
|
|||||||
// Teensy 2.0
|
// Teensy 2.0
|
||||||
#elif defined(__AVR_ATmega32U4__)
|
#elif defined(__AVR_ATmega32U4__)
|
||||||
//#define IR_USE_TIMER1 // tx = pin 14
|
//#define IR_USE_TIMER1 // tx = pin 14
|
||||||
#define IR_USE_TIMER3 // tx = pin 9
|
//#define IR_USE_TIMER3 // tx = pin 9
|
||||||
//#define IR_USE_TIMER4_HS // tx = pin 10
|
#define IR_USE_TIMER4_HS // tx = pin 10
|
||||||
|
|
||||||
// Teensy 3.0 / Teensy 3.1
|
// Teensy 3.0 / Teensy 3.1
|
||||||
#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||||
@@ -184,10 +146,6 @@
|
|||||||
|
|
||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
#define IR_TIMER_USE_ESP32
|
#define IR_TIMER_USE_ESP32
|
||||||
|
|
||||||
#elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
|
|
||||||
#define TIMER_PRESCALER_DIV 64
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc
|
// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc
|
||||||
// ATmega48, ATmega88, ATmega168, ATmega328
|
// ATmega48, ATmega88, ATmega168, ATmega328
|
||||||
@@ -240,17 +198,17 @@
|
|||||||
|
|
||||||
//-----------------
|
//-----------------
|
||||||
#if defined(CORE_OC2B_PIN)
|
#if defined(CORE_OC2B_PIN)
|
||||||
# define SEND_PIN CORE_OC2B_PIN // Teensy
|
# define TIMER_PWM_PIN CORE_OC2B_PIN // Teensy
|
||||||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
# define SEND_PIN 9 // Arduino Mega
|
# define TIMER_PWM_PIN 9 // Arduino Mega
|
||||||
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
|
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
|
||||||
|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \
|
|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \
|
||||||
|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \
|
|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \
|
||||||
|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \
|
|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \
|
||||||
|| defined(__AVR_ATmega164P__)
|
|| defined(__AVR_ATmega164P__)
|
||||||
# define SEND_PIN 14 // MightyCore
|
# define TIMER_PWM_PIN 14 // MightyCore
|
||||||
#else
|
#else
|
||||||
# define SEND_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc
|
# define TIMER_PWM_PIN 3 // Arduino Duemilanove, Diecimila, LilyPad, etc
|
||||||
#endif // ATmega48, ATmega88, ATmega168, ATmega328
|
#endif // ATmega48, ATmega88, ATmega168, ATmega328
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
@@ -293,22 +251,21 @@
|
|||||||
|
|
||||||
//-----------------
|
//-----------------
|
||||||
#if defined(CORE_OC1A_PIN)
|
#if defined(CORE_OC1A_PIN)
|
||||||
# define SEND_PIN CORE_OC1A_PIN // Teensy
|
# define TIMER_PWM_PIN CORE_OC1A_PIN // Teensy
|
||||||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
# define SEND_PIN 11 // Arduino Mega
|
# define TIMER_PWM_PIN 11 // Arduino Mega
|
||||||
#elif defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
|
|
||||||
# define SEND_PIN 13 // MegaCore
|
|
||||||
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
|
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) \
|
||||||
|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \
|
|| defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) \
|
||||||
|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \
|
|| defined(__AVR_ATmega324P__) || defined(__AVR_ATmega324A__) \
|
||||||
|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \
|
|| defined(__AVR_ATmega324PA__) || defined(__AVR_ATmega164A__) \
|
||||||
|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \
|
|| defined(__AVR_ATmega164P__) || defined(__AVR_ATmega32__) \
|
||||||
|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__)
|
|| defined(__AVR_ATmega16__) || defined(__AVR_ATmega8535__) \
|
||||||
# define SEND_PIN 13 // MightyCore
|
|| defined(__AVR_ATmega64__) || defined(__AVR_ATmega128__)
|
||||||
|
# define TIMER_PWM_PIN 13 // MightyCore, MegaCore
|
||||||
#elif defined(__AVR_ATtiny84__)
|
#elif defined(__AVR_ATtiny84__)
|
||||||
# define SEND_PIN 6
|
# define TIMER_PWM_PIN 6
|
||||||
#else
|
#else
|
||||||
# define SEND_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, etc
|
# define TIMER_PWM_PIN 9 // Arduino Duemilanove, Diecimila, LilyPad, Sparkfun Pro Micro etc
|
||||||
#endif // ATmega48, ATmega88, ATmega168, ATmega328
|
#endif // ATmega48, ATmega88, ATmega168, ATmega328
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
@@ -340,11 +297,11 @@
|
|||||||
|
|
||||||
//-----------------
|
//-----------------
|
||||||
#if defined(CORE_OC3A_PIN)
|
#if defined(CORE_OC3A_PIN)
|
||||||
# define SEND_PIN CORE_OC3A_PIN // Teensy
|
# define TIMER_PWM_PIN CORE_OC3A_PIN // Teensy
|
||||||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(ARDUINO_AVR_PROMICRO)
|
||||||
# define SEND_PIN 5 // Arduino Mega
|
# define TIMER_PWM_PIN 5 // Arduino Mega, Sparkfun Pro Micro
|
||||||
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
|
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)
|
||||||
# define SEND_PIN 6 // MightyCore
|
# define TIMER_PWM_PIN 6 // MightyCore
|
||||||
#else
|
#else
|
||||||
# error "Please add OC3A pin number here\n"
|
# error "Please add OC3A pin number here\n"
|
||||||
#endif
|
#endif
|
||||||
@@ -355,12 +312,21 @@
|
|||||||
#elif defined(IR_USE_TIMER4_HS)
|
#elif defined(IR_USE_TIMER4_HS)
|
||||||
|
|
||||||
#define TIMER_RESET
|
#define TIMER_RESET
|
||||||
#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1))
|
|
||||||
#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1)))
|
#if defined(ARDUINO_AVR_PROMICRO) // Sparkfun Pro Micro
|
||||||
|
#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A0)) // Use complimentary O̅C̅4̅A̅ output on pin 5
|
||||||
|
#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A0))) // (Pro Micro does not map PC7 (32/ICP3/CLK0/OC4A)
|
||||||
|
// of ATmega32U4 )
|
||||||
|
#else
|
||||||
|
#define TIMER_ENABLE_PWM (TCCR4A |= _BV(COM4A1))
|
||||||
|
#define TIMER_DISABLE_PWM (TCCR4A &= ~(_BV(COM4A1)))
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4))
|
#define TIMER_ENABLE_INTR (TIMSK4 = _BV(TOIE4))
|
||||||
#define TIMER_DISABLE_INTR (TIMSK4 = 0)
|
#define TIMER_DISABLE_INTR (TIMSK4 = 0)
|
||||||
#define TIMER_INTR_NAME TIMER4_OVF_vect
|
#define TIMER_INTR_NAME TIMER4_OVF_vect
|
||||||
|
|
||||||
|
|
||||||
#define TIMER_CONFIG_KHZ(val) ({ \
|
#define TIMER_CONFIG_KHZ(val) ({ \
|
||||||
const uint16_t pwmval = SYSCLOCK / 2000 / (val); \
|
const uint16_t pwmval = SYSCLOCK / 2000 / (val); \
|
||||||
TCCR4A = (1<<PWM4A); \
|
TCCR4A = (1<<PWM4A); \
|
||||||
@@ -388,9 +354,11 @@
|
|||||||
|
|
||||||
//-----------------
|
//-----------------
|
||||||
#if defined(CORE_OC4A_PIN)
|
#if defined(CORE_OC4A_PIN)
|
||||||
# define SEND_PIN CORE_OC4A_PIN // Teensy
|
# define TIMER_PWM_PIN CORE_OC4A_PIN // Teensy
|
||||||
|
#elif defined(ARDUINO_AVR_PROMICRO)
|
||||||
|
# define TIMER_PWM_PIN 5 // Sparkfun Pro Micro
|
||||||
#elif defined(__AVR_ATmega32U4__)
|
#elif defined(__AVR_ATmega32U4__)
|
||||||
# define SEND_PIN 13 // Leonardo
|
# define TIMER_PWM_PIN 13 // Leonardo
|
||||||
#else
|
#else
|
||||||
# error "Please add OC4A pin number here\n"
|
# error "Please add OC4A pin number here\n"
|
||||||
#endif
|
#endif
|
||||||
@@ -424,9 +392,9 @@
|
|||||||
|
|
||||||
//-----------------
|
//-----------------
|
||||||
#if defined(CORE_OC4A_PIN)
|
#if defined(CORE_OC4A_PIN)
|
||||||
# define SEND_PIN CORE_OC4A_PIN
|
# define TIMER_PWM_PIN CORE_OC4A_PIN
|
||||||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
# define SEND_PIN 6 // Arduino Mega
|
# define TIMER_PWM_PIN 6 // Arduino Mega
|
||||||
#else
|
#else
|
||||||
# error "Please add OC4A pin number here\n"
|
# error "Please add OC4A pin number here\n"
|
||||||
#endif
|
#endif
|
||||||
@@ -460,9 +428,9 @@
|
|||||||
|
|
||||||
//-----------------
|
//-----------------
|
||||||
#if defined(CORE_OC5A_PIN)
|
#if defined(CORE_OC5A_PIN)
|
||||||
# define SEND_PIN CORE_OC5A_PIN
|
# define TIMER_PWM_PIN CORE_OC5A_PIN
|
||||||
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||||
# define SEND_PIN 46 // Arduino Mega
|
# define TIMER_PWM_PIN 46 // Arduino Mega
|
||||||
#else
|
#else
|
||||||
# error "Please add OC5A pin number here\n"
|
# error "Please add OC5A pin number here\n"
|
||||||
#endif
|
#endif
|
||||||
@@ -529,7 +497,7 @@
|
|||||||
CMT_MSC = 0x03; \
|
CMT_MSC = 0x03; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define SEND_PIN 5
|
#define TIMER_PWM_PIN 5
|
||||||
|
|
||||||
// defines for TPM1 timer on Teensy-LC
|
// defines for TPM1 timer on Teensy-LC
|
||||||
#elif defined(IR_USE_TIMER_TPM1)
|
#elif defined(IR_USE_TIMER_TPM1)
|
||||||
@@ -559,7 +527,7 @@
|
|||||||
FTM1_C0V = 0; \
|
FTM1_C0V = 0; \
|
||||||
FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0) | FTM_SC_TOF | FTM_SC_TOIE; \
|
FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_PS(0) | FTM_SC_TOF | FTM_SC_TOIE; \
|
||||||
})
|
})
|
||||||
#define SEND_PIN 16
|
#define TIMER_PWM_PIN 16
|
||||||
|
|
||||||
// defines for timer_tiny0 (8 bits)
|
// defines for timer_tiny0 (8 bits)
|
||||||
#elif defined(IR_USE_TIMER_TINY0)
|
#elif defined(IR_USE_TIMER_TINY0)
|
||||||
@@ -593,7 +561,7 @@
|
|||||||
})
|
})
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SEND_PIN 1 /* ATtiny85 */
|
#define TIMER_PWM_PIN 1 /* ATtiny85 */
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// ESP32 (ESP8266 should likely be added here too)
|
// ESP32 (ESP8266 should likely be added here too)
|
||||||
@@ -610,29 +578,12 @@
|
|||||||
// way to do this on ESP32 is using the RMT built in driver like in this incomplete library below
|
// way to do this on ESP32 is using the RMT built in driver like in this incomplete library below
|
||||||
// https://github.com/ExploreEmbedded/ESP32_RMT
|
// https://github.com/ExploreEmbedded/ESP32_RMT
|
||||||
#elif defined(IR_TIMER_USE_ESP32)
|
#elif defined(IR_TIMER_USE_ESP32)
|
||||||
|
|
||||||
#define TIMER_RESET
|
#define TIMER_RESET
|
||||||
|
#define TIMER_ENABLE_PWM
|
||||||
#ifdef ISR
|
#define TIMER_DISABLE_PWM Serial.println("IRsend not implemented for ESP32 yet");
|
||||||
# undef ISR
|
#define TIMER_ENABLE_INTR
|
||||||
#endif
|
#define TIMER_DISABLE_INTR
|
||||||
#define ISR(f) void IRTimer()
|
#define TIMER_INTR_NAME
|
||||||
|
|
||||||
#elif defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
|
|
||||||
// use timer 3 hardcoded at this time
|
|
||||||
|
|
||||||
#define TIMER_RESET
|
|
||||||
#define TIMER_ENABLE_PWM // Not presently used
|
|
||||||
#define TIMER_DISABLE_PWM
|
|
||||||
#define TIMER_ENABLE_INTR NVIC_EnableIRQ(TC3_IRQn) // Not presently used
|
|
||||||
#define TIMER_DISABLE_INTR NVIC_DisableIRQ(TC3_IRQn)
|
|
||||||
#define TIMER_INTR_NAME TC3_Handler // Not presently used
|
|
||||||
#define TIMER_CONFIG_KHZ(f)
|
|
||||||
|
|
||||||
#ifdef ISR
|
|
||||||
# undef ISR
|
|
||||||
#endif
|
|
||||||
#define ISR(f) void irs()
|
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// Unknown Timer
|
// Unknown Timer
|
||||||
@@ -641,13 +592,4 @@
|
|||||||
# error "Internal code configuration error, no known IR_USE_TIMER# defined\n"
|
# error "Internal code configuration error, no known IR_USE_TIMER# defined\n"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Provide default definitions, portable but possibly slower than necessary.
|
|
||||||
#ifndef SENDPIN_ON
|
|
||||||
#define SENDPIN_ON(pin) digitalWrite(pin, HIGH)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SENDPIN_OFF
|
|
||||||
#define SENDPIN_OFF(pin) digitalWrite(pin, LOW)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // ! boarddefs_h
|
#endif // ! boarddefs_h
|
||||||
@@ -1,9 +1,3 @@
|
|||||||
## 2.5.0
|
|
||||||
- Added Philips Extended RC-5 protocol support [PR #522] (https://github.com/z3t0/Arduino-IRremote/pull/522)
|
|
||||||
|
|
||||||
## 2.4.0 - 2017/08/10
|
|
||||||
- Cleanup of hardware dependencies. Merge in SAM support [PR #437](https://github.com/z3t0/Arduino-IRremote/pull/437)
|
|
||||||
|
|
||||||
## 2.3.3 - 2017/03/31
|
## 2.3.3 - 2017/03/31
|
||||||
- Added ESP32 IR receive support [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/425)
|
- Added ESP32 IR receive support [PR #427](https://github.com/z3t0/Arduino-IRremote/pull/425)
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ int toggle = 0; // The RC5/6 toggle state
|
|||||||
// Most of this code is just logging
|
// Most of this code is just logging
|
||||||
void storeCode(decode_results *results) {
|
void storeCode(decode_results *results) {
|
||||||
codeType = results->decode_type;
|
codeType = results->decode_type;
|
||||||
int count = results->rawlen;
|
//int count = results->rawlen;
|
||||||
if (codeType == UNKNOWN) {
|
if (codeType == UNKNOWN) {
|
||||||
Serial.println("Received unknown code, saving as raw");
|
Serial.println("Received unknown code, saving as raw");
|
||||||
codeLen = results->rawlen - 1;
|
codeLen = results->rawlen - 1;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void dumpTIMER() {
|
|||||||
|
|
||||||
void dumpTimerPin() {
|
void dumpTimerPin() {
|
||||||
Serial.print(F("IR Tx Pin: "));
|
Serial.print(F("IR Tx Pin: "));
|
||||||
Serial.println(SEND_PIN);
|
Serial.println(TIMER_PWM_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpClock() {
|
void dumpClock() {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <IRremote.h>
|
#include <IRremote.h>
|
||||||
|
#include <IRremoteInt.h>
|
||||||
|
|
||||||
// Dumps out the decode_results structure.
|
// Dumps out the decode_results structure.
|
||||||
// Call this after IRrecv::decode()
|
// Call this after IRrecv::decode()
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void setup()
|
|||||||
// Wait for the gap between tests, to synchronize with
|
// Wait for the gap between tests, to synchronize with
|
||||||
// the sender.
|
// the sender.
|
||||||
// Specifically, wait for a signal followed by a gap of at last gap ms.
|
// Specifically, wait for a signal followed by a gap of at last gap ms.
|
||||||
void waitForGap(int gap) {
|
void waitForGap(unsigned long gap) {
|
||||||
Serial.println("Waiting for gap");
|
Serial.println("Waiting for gap");
|
||||||
while (1) {
|
while (1) {
|
||||||
while (digitalRead(RECV_PIN) == LOW) {
|
while (digitalRead(RECV_PIN) == LOW) {
|
||||||
@@ -125,7 +125,7 @@ void dump(decode_results *results) {
|
|||||||
// The motivation behind this method is that the sender and the receiver
|
// The motivation behind this method is that the sender and the receiver
|
||||||
// can do the same test calls, and the mode variable indicates whether
|
// can do the same test calls, and the mode variable indicates whether
|
||||||
// to send or receive.
|
// to send or receive.
|
||||||
void test(char *label, int type, unsigned long value, int bits) {
|
void test(const char *label, int type, unsigned long value, int bits) {
|
||||||
if (mode == SENDER) {
|
if (mode == SENDER) {
|
||||||
Serial.println(label);
|
Serial.println(label);
|
||||||
if (type == NEC) {
|
if (type == NEC) {
|
||||||
@@ -175,7 +175,7 @@ void test(char *label, int type, unsigned long value, int bits) {
|
|||||||
|
|
||||||
// Test raw send or receive. This is similar to the test method,
|
// Test raw send or receive. This is similar to the test method,
|
||||||
// except it send/receives raw data.
|
// except it send/receives raw data.
|
||||||
void testRaw(char *label, unsigned int *rawbuf, int rawlen) {
|
void testRaw(const char *label, unsigned int *rawbuf, int rawlen) {
|
||||||
if (mode == SENDER) {
|
if (mode == SENDER) {
|
||||||
Serial.println(label);
|
Serial.println(label);
|
||||||
irsend.sendRaw(rawbuf, rawlen, 38 /* kHz */);
|
irsend.sendRaw(rawbuf, rawlen, 38 /* kHz */);
|
||||||
|
|||||||
@@ -192,12 +192,12 @@ void loop()
|
|||||||
ac_activate(AC_TEMPERATURE, AC_FLOW);
|
ac_activate(AC_TEMPERATURE, AC_FLOW);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if ( b == 0 | b == 1 ) {
|
if ( b == 0 || b == 1 ) {
|
||||||
ac_change_air_swing(b);
|
ac_change_air_swing(b);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: // 1 : clean on, power on
|
case 3: // 1 : clean on, power on
|
||||||
if ( b == 0 | b == 1 ) {
|
if ( b == 0 || b == 1 ) {
|
||||||
ac_air_clean(b);
|
ac_air_clean(b);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <IRremote.h>
|
#include <IRremote.h>
|
||||||
|
#include <IRremoteInt.h>
|
||||||
|
|
||||||
IRsend irsend;
|
IRsend irsend;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
|
#ifdef IR_TIMER_USE_ESP32
|
||||||
|
hw_timer_t *timer;
|
||||||
|
void IRTimer(); // defined in IRremote.cpp
|
||||||
|
#endif
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
// Decodes the received IR message
|
// Decodes the received IR message
|
||||||
@@ -84,6 +90,11 @@ int IRrecv::decode (decode_results *results)
|
|||||||
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.
|
||||||
// If you add any decodes, add them before this.
|
// If you add any decodes, add them before this.
|
||||||
@@ -114,10 +125,19 @@ IRrecv::IRrecv (int recvpin, int blinkpin)
|
|||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
// initialization
|
// initialization
|
||||||
//
|
//
|
||||||
#ifdef USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
void IRrecv::enableIRIn ( )
|
void IRrecv::enableIRIn ( )
|
||||||
{
|
{
|
||||||
// Interrupt Service Routine - Fires every 50uS
|
// 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();
|
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)
|
||||||
@@ -131,6 +151,7 @@ void IRrecv::enableIRIn ( )
|
|||||||
TIMER_RESET;
|
TIMER_RESET;
|
||||||
|
|
||||||
sei(); // enable interrupts
|
sei(); // enable interrupts
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize state machine variables
|
// Initialize state machine variables
|
||||||
irparams.rcvstate = STATE_IDLE;
|
irparams.rcvstate = STATE_IDLE;
|
||||||
@@ -139,17 +160,14 @@ void IRrecv::enableIRIn ( )
|
|||||||
// Set pin modes
|
// Set pin modes
|
||||||
pinMode(irparams.recvpin, INPUT);
|
pinMode(irparams.recvpin, INPUT);
|
||||||
}
|
}
|
||||||
#endif // USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
// Enable/disable blinking of pin 13 on IR processing
|
// Enable/disable blinking of pin 13 on IR processing
|
||||||
//
|
//
|
||||||
void IRrecv::blink13 (int blinkflag)
|
void IRrecv::blink13 (int blinkflag)
|
||||||
{
|
{
|
||||||
#ifdef BLINKLED
|
|
||||||
irparams.blinkflag = blinkflag;
|
irparams.blinkflag = blinkflag;
|
||||||
if (blinkflag) pinMode(BLINKLED, OUTPUT) ;
|
if (blinkflag) pinMode(BLINKLED, OUTPUT) ;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
#ifdef SENDING_SUPPORTED
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
void IRsend::sendRaw (const unsigned int buf[], unsigned int len, unsigned int hz)
|
void IRsend::sendRaw (const unsigned int buf[], unsigned int len, unsigned int hz)
|
||||||
{
|
{
|
||||||
@@ -15,59 +15,14 @@ void IRsend::sendRaw (const unsigned int buf[], unsigned int len, unsigned in
|
|||||||
space(0); // Always end with the LED off
|
space(0); // Always end with the LED off
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_SOFT_CARRIER
|
|
||||||
void inline IRsend::sleepMicros(unsigned long us)
|
|
||||||
{
|
|
||||||
#ifdef USE_SPIN_WAIT
|
|
||||||
sleepUntilMicros(micros() + us);
|
|
||||||
#else
|
|
||||||
if (us > 0U) // Is this necessary? (Official docu https://www.arduino.cc/en/Reference/DelayMicroseconds does not tell.)
|
|
||||||
delayMicroseconds((unsigned int) us);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void inline IRsend::sleepUntilMicros(unsigned long targetTime)
|
|
||||||
{
|
|
||||||
#ifdef USE_SPIN_WAIT
|
|
||||||
while (micros() < targetTime)
|
|
||||||
;
|
|
||||||
#else
|
|
||||||
unsigned long now = micros();
|
|
||||||
if (now < targetTime)
|
|
||||||
sleepMicros(targetTime - now);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif // USE_SOFT_CARRIER
|
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
// Sends an IR mark for the specified number of microseconds.
|
// Sends an IR mark for the specified number of microseconds.
|
||||||
// The mark output is modulated at the PWM frequency.
|
// The mark output is modulated at the PWM frequency.
|
||||||
//
|
//
|
||||||
|
void IRsend::mark (unsigned int time)
|
||||||
void IRsend::mark(unsigned int time)
|
|
||||||
{
|
{
|
||||||
#ifdef USE_SOFT_CARRIER
|
|
||||||
unsigned long start = micros();
|
|
||||||
unsigned long stop = start + time;
|
|
||||||
if (stop + periodTime < start)
|
|
||||||
// Counter wrap-around, happens very seldomly, but CAN happen.
|
|
||||||
// Just give up instead of possibly damaging the hardware.
|
|
||||||
return;
|
|
||||||
|
|
||||||
unsigned long nextPeriodEnding = start;
|
|
||||||
unsigned long now = micros();
|
|
||||||
while (now < stop) {
|
|
||||||
SENDPIN_ON(sendPin);
|
|
||||||
sleepMicros(periodOnTime);
|
|
||||||
SENDPIN_OFF(sendPin);
|
|
||||||
nextPeriodEnding += periodTime;
|
|
||||||
sleepUntilMicros(nextPeriodEnding);
|
|
||||||
now = micros();
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
TIMER_ENABLE_PWM; // Enable pin 3 PWM output
|
TIMER_ENABLE_PWM; // Enable pin 3 PWM output
|
||||||
if (time > 0) custom_delay_usec(time);
|
if (time > 0) custom_delay_usec(time);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
@@ -99,16 +54,13 @@ void IRsend::space (unsigned int time)
|
|||||||
//
|
//
|
||||||
void IRsend::enableIROut (int khz)
|
void IRsend::enableIROut (int khz)
|
||||||
{
|
{
|
||||||
#ifdef USE_SOFT_CARRIER
|
// FIXME: implement ESP32 support, see IR_TIMER_USE_ESP32 in boarddefs.h
|
||||||
periodTime = (1000U + khz/2) / khz; // = 1000/khz + 1/2 = round(1000.0/khz)
|
#ifndef ESP32
|
||||||
periodOnTime = periodTime * DUTY_CYCLE / 100U - PULSE_CORRECTION;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Disable the Timer2 Interrupt (which is used for receiving IR)
|
// Disable the Timer2 Interrupt (which is used for receiving IR)
|
||||||
TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt
|
TIMER_DISABLE_INTR; //Timer2 Overflow Interrupt
|
||||||
|
|
||||||
pinMode(sendPin, OUTPUT);
|
pinMode(TIMER_PWM_PIN, OUTPUT);
|
||||||
SENDPIN_OFF(sendPin); // When not sending, we want it low
|
digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low
|
||||||
|
|
||||||
// COM2A = 00: disconnect OC2A
|
// COM2A = 00: disconnect OC2A
|
||||||
// COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted
|
// COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted
|
||||||
@@ -116,6 +68,7 @@ void IRsend::enableIROut (int khz)
|
|||||||
// CS2 = 000: no prescaling
|
// CS2 = 000: no prescaling
|
||||||
// The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A.
|
// The top value for the timer. The modulation frequency will be SYSCLOCK / 2 / OCR2A.
|
||||||
TIMER_CONFIG_KHZ(khz);
|
TIMER_CONFIG_KHZ(khz);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
@@ -135,4 +88,3 @@ void IRsend::custom_delay_usec(unsigned long uSecs) {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SENDING_SUPPORTED
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// AAA IIIII W W AAA
|
// AAA IIIII W W AAA
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
// Reverse Engineered by looking at RAW dumps generated by IRremote
|
// Reverse Engineered by looking at RAW dumps generated by IRremote
|
||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// DDDD IIIII SSSS H H
|
// DDDD IIIII SSSS H H
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// JJJJJ V V CCCC
|
// JJJJJ V V CCCC
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// L GGGG
|
// L GGGG
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
#include "ir_Lego_PF_BitStreamEncoder.h"
|
#include "ir_Lego_PF_BitStreamEncoder.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// MMMMM IIIII TTTTT SSSS U U BBBB IIIII SSSS H H IIIII
|
// MMMMM IIIII TTTTT SSSS U U BBBB IIIII SSSS H H IIIII
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// N N EEEEE CCCC
|
// N N EEEEE CCCC
|
||||||
89
ir_NerfLaserOpsPro.cpp
Normal file
89
ir_NerfLaserOpsPro.cpp
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// NERF LASER OPS PRO
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
#define BITS 15 // The number of bits in the command
|
||||||
|
|
||||||
|
#define HDR_MARK 2800 // The length of the Header:Mark
|
||||||
|
#define HDR_SPACE 6000 // The lenght of the Header:Space
|
||||||
|
|
||||||
|
#define ONE_MARK 1800 // The length of a Bit:Mark for 1's
|
||||||
|
#define ZERO_MARK 800 // The length of a Bit:Mark for 0's
|
||||||
|
#define ALL_SPACE 2100 // The length of a Bit:Space
|
||||||
|
|
||||||
|
#define purpule 0x440
|
||||||
|
#define red 0x400
|
||||||
|
#define blue 0x420
|
||||||
|
|
||||||
|
//+=============================================================================
|
||||||
|
//
|
||||||
|
#if SEND_NERF_LOP
|
||||||
|
void IRsend::sendNerfLOP (unsigned long data, int nbits)
|
||||||
|
{
|
||||||
|
// Set IR carrier frequency
|
||||||
|
enableIROut(40);
|
||||||
|
|
||||||
|
// Header
|
||||||
|
mark (HDR_MARK);
|
||||||
|
space(HDR_SPACE);
|
||||||
|
mark (HDR_MARK);
|
||||||
|
|
||||||
|
// Data
|
||||||
|
for (unsigned long mask = 1UL << (nbits - 1); mask; mask >>= 1) {
|
||||||
|
if (data & mask) {
|
||||||
|
space(ALL_SPACE);
|
||||||
|
mark (ONE_MARK);
|
||||||
|
} else {
|
||||||
|
space(ALL_SPACE);
|
||||||
|
mark (ZERO_MARK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
space(0); // Always end with the LED off
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//+=============================================================================
|
||||||
|
//
|
||||||
|
#if DECODE_NERF_LOP
|
||||||
|
bool IRrecv::decodeNerfLOP (decode_results *results)
|
||||||
|
{
|
||||||
|
//NOT IMPLEMENTED YET
|
||||||
|
return false;
|
||||||
|
unsigned long data = 0; // Somewhere to build our code
|
||||||
|
int offset = 1; // Skip the Gap reading
|
||||||
|
|
||||||
|
// Check we have the right amount of data
|
||||||
|
if (irparams.rawlen != 1 + 2 + (2 * BITS) + 1) return false ;
|
||||||
|
|
||||||
|
// Check initial Mark+Space match
|
||||||
|
if (!MATCH_MARK (results->rawbuf[offset++], HDR_MARK )) return false ;
|
||||||
|
if (!MATCH_SPACE(results->rawbuf[offset++], HDR_SPACE)) return false ;
|
||||||
|
|
||||||
|
// Read the bits in
|
||||||
|
for (int i = 0; i < SHUZU_BITS; i++) {
|
||||||
|
// Each bit looks like: MARK + SPACE_1 -> 1
|
||||||
|
// or : MARK + SPACE_0 -> 0
|
||||||
|
if (!MATCH_MARK(results->rawbuf[offset++], BIT_MARK)) return false ;
|
||||||
|
|
||||||
|
// IR data is big-endian, so we shuffle it in from the right:
|
||||||
|
if (MATCH_SPACE(results->rawbuf[offset], ONE_SPACE)) data = (data << 1) | 1 ;
|
||||||
|
else if (MATCH_SPACE(results->rawbuf[offset], ZERO_SPACE)) data = (data << 1) | 0 ;
|
||||||
|
else return false ;
|
||||||
|
offset++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Success
|
||||||
|
results->bits = BITS;
|
||||||
|
results->value = data;
|
||||||
|
results->decode_type = SHUZU;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// PPPP AAA N N AAA SSSS OOO N N IIIII CCCC
|
// PPPP AAA N N AAA SSSS OOO N N IIIII CCCC
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
// Gets one undecoded level at a time from the raw buffer.
|
// Gets one undecoded level at a time from the raw buffer.
|
||||||
@@ -77,73 +78,6 @@ void IRsend::sendRC5 (unsigned long data, int nbits)
|
|||||||
|
|
||||||
space(0); // Always end with the LED off
|
space(0); // Always end with the LED off
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRsend::sendRC5ext (unsigned long addr, unsigned long cmd, boolean toggle)
|
|
||||||
{
|
|
||||||
// Set IR carrier frequency
|
|
||||||
enableIROut(36);
|
|
||||||
|
|
||||||
unsigned long addressBits = 5;
|
|
||||||
unsigned long commandBits = 7;
|
|
||||||
unsigned long nbits = addressBits + commandBits;
|
|
||||||
|
|
||||||
// Start
|
|
||||||
mark(RC5_T1);
|
|
||||||
|
|
||||||
// Bit #6 of the command part, but inverted!
|
|
||||||
unsigned long cmdBit6 = (1UL << (commandBits-1)) & cmd;
|
|
||||||
if (cmdBit6) {
|
|
||||||
// Inverted (1 -> 0 = mark-to-space)
|
|
||||||
mark(RC5_T1);
|
|
||||||
space(RC5_T1);
|
|
||||||
} else {
|
|
||||||
space(RC5_T1);
|
|
||||||
mark(RC5_T1);
|
|
||||||
}
|
|
||||||
commandBits--;
|
|
||||||
|
|
||||||
// Toggle bit
|
|
||||||
static int toggleBit = 1;
|
|
||||||
if (toggle) {
|
|
||||||
if (toggleBit == 0) {
|
|
||||||
toggleBit = 1;
|
|
||||||
} else {
|
|
||||||
toggleBit = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (toggleBit) {
|
|
||||||
space(RC5_T1);
|
|
||||||
mark(RC5_T1);
|
|
||||||
} else {
|
|
||||||
mark(RC5_T1);
|
|
||||||
space(RC5_T1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Address
|
|
||||||
for (unsigned long mask = 1UL << (addressBits - 1); mask; mask >>= 1) {
|
|
||||||
if (addr & mask) {
|
|
||||||
space(RC5_T1); // 1 is space, then mark
|
|
||||||
mark(RC5_T1);
|
|
||||||
} else {
|
|
||||||
mark(RC5_T1);
|
|
||||||
space(RC5_T1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Command
|
|
||||||
for (unsigned long mask = 1UL << (commandBits - 1); mask; mask >>= 1) {
|
|
||||||
if (cmd & mask) {
|
|
||||||
space(RC5_T1); // 1 is space, then mark
|
|
||||||
mark(RC5_T1);
|
|
||||||
} else {
|
|
||||||
mark(RC5_T1);
|
|
||||||
space(RC5_T1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
space(0); // Always end with the LED off
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//+=============================================================================
|
//+=============================================================================
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// SSSS AAA MMM SSSS U U N N GGGG
|
// SSSS AAA MMM SSSS U U N N GGGG
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// SSSS AAA N N Y Y OOO
|
// SSSS AAA N N Y Y OOO
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// SSSS H H AAA RRRR PPPP
|
// SSSS H H AAA RRRR PPPP
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// SSSS OOO N N Y Y
|
// SSSS OOO N N Y Y
|
||||||
@@ -92,6 +92,7 @@ Regards,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//
|
//
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "IRremote.h"
|
#include "IRremote.h"
|
||||||
|
#include "IRremoteInt.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// W W H H Y Y N N TTTTT EEEEE RRRRR
|
// W W H H Y Y N N TTTTT EEEEE RRRRR
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/z3t0/Arduino-IRremote.git"
|
"url": "https://github.com/z3t0/Arduino-IRremote.git"
|
||||||
},
|
},
|
||||||
"version": "2.4.0",
|
"version": "2.3.3",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "atmelavr",
|
"platforms": "atmelavr",
|
||||||
"authors" :
|
"authors" :
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
name=IRremote
|
name=IRremote
|
||||||
version=2.4.0
|
version=2.2.3
|
||||||
author=shirriff, z3t0
|
author=shirriff
|
||||||
maintainer=z3t0
|
maintainer=shirriff
|
||||||
sentence=Send and receive infrared signals with multiple protocols
|
sentence=Send and receive infrared signals with multiple protocols
|
||||||
paragraph=Find more information at https://github.com/z3t0/Arduino-IRremote
|
paragraph=Send and receive infrared signals with multiple protocols
|
||||||
category=Communication
|
category=Signal Input/Output
|
||||||
url=https://github.com/z3t0/Arduino-IRremote
|
url=https://github.com/shirriff/Arduino-IRremote.git
|
||||||
architectures=*
|
architectures=*
|
||||||
|
|||||||
97
readmdFrench.md
Normal file
97
readmdFrench.md
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
## IRremote Library
|
||||||
|
|
||||||
|
|
||||||
|
Cette bibliothèque vous permet d'envoyer et de recevoir des signaux infrarouges sur un Arduino.
|
||||||
|
Des tutoriels et plus d'informations seront disponibles sur la page d'accueil officielle.
|
||||||
|
|
||||||
|
## Version - 2.2.3
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
1. Allez à la [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page.
|
||||||
|
2. Téléchargez la dernière version.
|
||||||
|
3. Extraire le fichier zip
|
||||||
|
4. Déplacez le dossier "IRremote" vers vos bibliothèques.
|
||||||
|
5. Assurez-vous de supprimer Arduino_Root / libraries / RobotIRremote. Où Arduino_Root fait référence au répertoire d'installation d'Arduino. La bibliothèque RobotIRremote a des définitions similaires à IRremote et provoque des erreurs.
|
||||||
|
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
Je ne travaille pas correctement en utilisant Neopixels (aka WS2811 / WS2812 / WS2812B)
|
||||||
|
Que vous utilisiez la librairie Adafruit Neopixel ou FastLED, les interruptions sont désactivées sur de nombreux processeurs bas de gamme comme les arduinos de base. À son tour, cela empêche le gestionnaire IR de s'exécuter quand il le faut. Il y a quelques solutions à ce processus, voir cette page de Marc MERLIN
|
||||||
|
[cette page de Marc MERLIN](http://marc.merlins.org/perso/arduino/post_2017-04-03_Arduino-328P-Uno-Teensy3_1-ESP8266-ESP32-IR-and-Neopixels.html)
|
||||||
|
|
||||||
|
|
||||||
|
## Conseils pris en charge
|
||||||
|
|
||||||
|
- Teensy 1.0 / 1.0++ / 2.0 / 2++ / 3.0 / 3.1 / Teensy-LC; Crédits: @PaulStoffregen (Teensy Team)
|
||||||
|
- Sanguino
|
||||||
|
- ATmega8, 48, 88, 168, 328
|
||||||
|
- ATmega8535, 16, 32, 164, 324, 644, 1284,
|
||||||
|
- ATmega64, 128
|
||||||
|
- ATtiny 84 / 85
|
||||||
|
- ESP32 (recevoir seulement)
|
||||||
|
- ESP8266 est basé sur un ancien code qui n'est pas très récent, mais cela fonctionne raisonnablement bien. Voir https://github.com/markszabo/IRremoteESP8266
|
||||||
|
Sparkfun Pro Micro
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Nous sommes ouverts aux suggestions d'ajout de support pour les nouveaux tableaux, cependant, nous vous recommandons fortement de contacter votre fournisseur et de fournir un soutien de leur côté.
|
||||||
|
|
||||||
|
|
||||||
|
## Spécifications matérielles
|
||||||
|
|
||||||
|
|
||||||
|
| Carte/CPU | Envoyer Pin | Compteurs |
|
||||||
|
|--------------------------------------------------------------------------|---------------------|-------------------|
|
||||||
|
| [ATtiny84](https://github.com/SpenceKonde/ATTinyCore) | **6** | **1** |
|
||||||
|
| [ATtiny85](https://github.com/SpenceKonde/ATTinyCore) | **1** | **TINY0** |
|
||||||
|
| [ATmega8](https://github.com/MCUdude/MiniCore) | **9** | **1** |
|
||||||
|
| Atmega32u4 | 5, 9, **13** | 1, 3, **4** |
|
||||||
|
| [ATmega48, ATmega88, ATmega168, ATmega328](https://github.com/MCUdude/MiniCore) | **3**, 9 | 1, **2** |
|
||||||
|
| [ATmega1284](https://github.com/MCUdude/MightyCore) | 13, 14, 6 | 1, **2**, 3 |
|
||||||
|
| [ATmega164, ATmega324, ATmega644](https://github.com/MCUdude/MightyCore) | 13, **14** | 1, **2** |
|
||||||
|
| [ATmega8535 ATmega16, ATmega32](https://github.com/MCUdude/MightyCore) | **13** | **1** |
|
||||||
|
| [ATmega64, ATmega128](https://github.com/MCUdude/MegaCore) | **13** | **1** |
|
||||||
|
| ATmega1280, ATmega2560 | 5, 6, **9**, 11, 46 | 1, **2**, 3, 4, 5 |
|
||||||
|
| [ESP32](http://esp32.net/) | N/A (insupporté) | **1** |
|
||||||
|
| [Sparkfun Pro Micro](https://www.sparkfun.com/products/12640) | 9, **5**, 5 | 1, **3**, 4_HS |
|
||||||
|
| [Teensy 1.0](https://www.pjrc.com/teensy/) | **17** | **1** |
|
||||||
|
| [Teensy 2.0](https://www.pjrc.com/teensy/) | 9, **10**, 14 | 1, 3, **4_HS** |
|
||||||
|
| [Teensy++ 1.0 / 2.0](https://www.pjrc.com/teensy/) | **1**, 16, 25 | 1, **2**, 3 |
|
||||||
|
| [Teensy 3.0 / 3.1](https://www.pjrc.com/teensy/) | **5** | **CMT** |
|
||||||
|
| [Teensy-LC](https://www.pjrc.com/teensy/) | **16** | **TPM1** |
|
||||||
|
|
||||||
|
|
||||||
|
## Patchs expérimentaux
|
||||||
|
|
||||||
|
Voici les correctifs strictement pris en charge qui n'ont pas encore été intégrés. Si vous avez des questions, n'hésitez pas à demander ici. Si cela fonctionne, faites le nous savoir!
|
||||||
|
|
||||||
|
[Arduino 101](https://github.com/z3t0/Arduino-IRremote/pull/481#issuecomment-311243146)
|
||||||
|
|
||||||
|
Le tableau ci-dessus répertorie les temporisations actuellement supportées et les broches d'envoi correspondantes, beaucoup de ces broches supplémentaires sont ouvertes.
|
||||||
|
|
||||||
|
|
||||||
|
## Utilisation
|
||||||
|
- À faire TODO (Vérifier les exemples pour l'instant)
|
||||||
|
|
||||||
|
|
||||||
|
## Contribution
|
||||||
|
Si vous voulez contribuer à ce projet:
|
||||||
|
- Signaler les bogues et les erreurs
|
||||||
|
- Demander des améliorations
|
||||||
|
- Créer des problèmes et tirer des requêtes
|
||||||
|
- Parlez de cette bibliothèque à d'autres personnes
|
||||||
|
- Contribuer de nouveaux protocoles
|
||||||
|
Vérifiez ici [ici](Contributing.md) pour quelques guidelines
|
||||||
|
|
||||||
|
|
||||||
|
## Contact
|
||||||
|
Email: zetoslab@gmail.com
|
||||||
|
Please only email me if it is more appropriate than creating an Issue / PR. I **will** not respond to requests for adding support for particular boards, unless of course you are the creator of the board and would like to cooperate on the project. I will also **ignore** any emails asking me to tell you how to implement your ideas. However, if you have a private inquiry that you would only apply to you and you would prefer it to be via email, by all means.
|
||||||
|
|
||||||
|
## Contributeurs
|
||||||
|
Check [here](Contributors.md)
|
||||||
|
@Lsuperman735 French translation
|
||||||
|
|
||||||
|
## Copyright
|
||||||
|
Copyright 2009-2012 Ken Shirriff
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#ifdef ESP32
|
|
||||||
|
|
||||||
// This file contains functions specific to the ESP32.
|
|
||||||
|
|
||||||
#include "IRremote.h"
|
|
||||||
|
|
||||||
// "Idiot check"
|
|
||||||
#ifdef USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
#error Must undef USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
hw_timer_t *timer;
|
|
||||||
void IRTimer(); // defined in IRremote.cpp, masqueraded as ISR(TIMER_INTR_NAME)
|
|
||||||
|
|
||||||
//+=============================================================================
|
|
||||||
// initialization
|
|
||||||
//
|
|
||||||
void IRrecv::enableIRIn ( )
|
|
||||||
{
|
|
||||||
// Interrupt Service Routine - Fires every 50uS
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
// Initialize state machine variables
|
|
||||||
irparams.rcvstate = STATE_IDLE;
|
|
||||||
irparams.rawlen = 0;
|
|
||||||
|
|
||||||
// Set pin modes
|
|
||||||
pinMode(irparams.recvpin, INPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // ESP32
|
|
||||||
101
src/sam.cpp
101
src/sam.cpp
@@ -1,101 +0,0 @@
|
|||||||
// Support routines for SAM processor boards
|
|
||||||
|
|
||||||
#include "IRremote.h"
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
|
|
||||||
|
|
||||||
// "Idiot check"
|
|
||||||
#ifdef USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
#error Must undef USE_DEFAULT_ENABLE_IR_IN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//+=============================================================================
|
|
||||||
// ATSAMD Timer setup & IRQ functions
|
|
||||||
//
|
|
||||||
|
|
||||||
// following based on setup from GitHub jdneo/timerInterrupt.ino
|
|
||||||
|
|
||||||
static void setTimerFrequency(int frequencyHz)
|
|
||||||
{
|
|
||||||
int compareValue = (SYSCLOCK / (TIMER_PRESCALER_DIV * frequencyHz)) - 1;
|
|
||||||
//Serial.println(compareValue);
|
|
||||||
TcCount16* TC = (TcCount16*) TC3;
|
|
||||||
// Make sure the count is in a proportional position to where it was
|
|
||||||
// to prevent any jitter or disconnect when changing the compare value.
|
|
||||||
TC->COUNT.reg = map(TC->COUNT.reg, 0, TC->CC[0].reg, 0, compareValue);
|
|
||||||
TC->CC[0].reg = compareValue;
|
|
||||||
//Serial.print("COUNT.reg ");
|
|
||||||
//Serial.println(TC->COUNT.reg);
|
|
||||||
//Serial.print("CC[0].reg ");
|
|
||||||
//Serial.println(TC->CC[0].reg);
|
|
||||||
while (TC->STATUS.bit.SYNCBUSY == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void startTimer()
|
|
||||||
{
|
|
||||||
REG_GCLK_CLKCTRL = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID_TCC2_TC3);
|
|
||||||
while (GCLK->STATUS.bit.SYNCBUSY == 1); // wait for sync
|
|
||||||
|
|
||||||
TcCount16* TC = (TcCount16*) TC3;
|
|
||||||
|
|
||||||
TC->CTRLA.reg &= ~TC_CTRLA_ENABLE;
|
|
||||||
while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync
|
|
||||||
|
|
||||||
// Use the 16-bit timer
|
|
||||||
TC->CTRLA.reg |= TC_CTRLA_MODE_COUNT16;
|
|
||||||
while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync
|
|
||||||
|
|
||||||
// Use match mode so that the timer counter resets when the count matches the compare register
|
|
||||||
TC->CTRLA.reg |= TC_CTRLA_WAVEGEN_MFRQ;
|
|
||||||
while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync
|
|
||||||
|
|
||||||
// Set prescaler to 1024
|
|
||||||
//TC->CTRLA.reg |= TC_CTRLA_PRESCALER_DIV1024;
|
|
||||||
TC->CTRLA.reg |= TC_CTRLA_PRESCALER_DIV64;
|
|
||||||
while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync
|
|
||||||
|
|
||||||
setTimerFrequency(1000000 / USECPERTICK);
|
|
||||||
|
|
||||||
// Enable the compare interrupt
|
|
||||||
TC->INTENSET.reg = 0;
|
|
||||||
TC->INTENSET.bit.MC0 = 1;
|
|
||||||
|
|
||||||
NVIC_EnableIRQ(TC3_IRQn);
|
|
||||||
|
|
||||||
TC->CTRLA.reg |= TC_CTRLA_ENABLE;
|
|
||||||
while (TC->STATUS.bit.SYNCBUSY == 1); // wait for sync
|
|
||||||
}
|
|
||||||
|
|
||||||
//+=============================================================================
|
|
||||||
// initialization
|
|
||||||
//
|
|
||||||
|
|
||||||
void IRrecv::enableIRIn()
|
|
||||||
{
|
|
||||||
// Interrupt Service Routine - Fires every 50uS
|
|
||||||
//Serial.println("Starting timer");
|
|
||||||
startTimer();
|
|
||||||
//Serial.println("Started timer");
|
|
||||||
|
|
||||||
// Initialize state machine variables
|
|
||||||
irparams.rcvstate = STATE_IDLE;
|
|
||||||
irparams.rawlen = 0;
|
|
||||||
|
|
||||||
// Set pin modes
|
|
||||||
pinMode(irparams.recvpin, INPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void irs(); // Defined in IRRemote as ISR(TIMER_INTR_NAME)
|
|
||||||
|
|
||||||
void TC3_Handler(void)
|
|
||||||
{
|
|
||||||
TcCount16* TC = (TcCount16*) TC3;
|
|
||||||
// If this interrupt is due to the compare register matching the timer count
|
|
||||||
// we toggle the LED.
|
|
||||||
if (TC->INTFLAG.bit.MC0 == 1) {
|
|
||||||
TC->INTFLAG.bit.MC0 = 1;
|
|
||||||
irs();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
|
|
||||||
Reference in New Issue
Block a user