mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2026-01-04 12:32:51 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
742f72fd0a | ||
|
|
3ab30887f4 | ||
|
|
bdb9f1c1f5 | ||
|
|
71f6daca4f | ||
|
|
2b3188e40a | ||
|
|
d719c27f95 | ||
|
|
20a4d97f61 | ||
|
|
d2939e2366 | ||
|
|
1154607b69 | ||
|
|
c6a2fcd8c9 | ||
|
|
e206e122e5 | ||
|
|
5bbd55c650 | ||
|
|
24dd940107 | ||
|
|
7245efd2f5 | ||
|
|
4eb95a3272 | ||
|
|
542516f116 | ||
|
|
563c82c6c4 | ||
|
|
a406f3b9f9 | ||
|
|
31968a4875 | ||
|
|
635e8a923d | ||
|
|
b0d15b6020 | ||
|
|
622e28bf69 |
18
README.md
18
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/).
|
||||
|
||||
## Version - 2.4.0b
|
||||
## Version - 2.5.0b
|
||||
|
||||
## Installation
|
||||
1. Navigate to the [Releases](https://github.com/z3t0/Arduino-IRremote/releases) page.
|
||||
@@ -43,7 +43,7 @@ We are open to suggestions for adding support to new boards, however we highly r
|
||||
| [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** |
|
||||
| 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** |
|
||||
@@ -68,6 +68,20 @@ The table above lists the currently supported timers and corresponding send pins
|
||||
## Usage
|
||||
- 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
|
||||
If you want to contribute to this project:
|
||||
- Report bugs and errors
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
{
|
||||
"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":
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
## 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)
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
#include <IRremote.h>
|
||||
#include <IRremoteInt.h>
|
||||
|
||||
// Dumps out the decode_results structure.
|
||||
// Call this after IRrecv::decode()
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
#include <IRremote.h>
|
||||
#include <IRremoteInt.h>
|
||||
|
||||
IRsend irsend;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/z3t0/Arduino-IRremote.git"
|
||||
},
|
||||
"version": "2.3.3",
|
||||
"version": "2.4.0",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "atmelavr",
|
||||
"authors" :
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
name=IRremote
|
||||
version=2.2.3
|
||||
author=shirriff
|
||||
maintainer=shirriff
|
||||
version=2.4.0
|
||||
author=shirriff, z3t0
|
||||
maintainer=z3t0
|
||||
sentence=Send and receive infrared signals with multiple protocols
|
||||
paragraph=Send and receive infrared signals with multiple protocols
|
||||
category=Signal Input/Output
|
||||
url=https://github.com/shirriff/Arduino-IRremote.git
|
||||
paragraph=Find more information at https://github.com/z3t0/Arduino-IRremote
|
||||
category=Communication
|
||||
url=https://github.com/z3t0/Arduino-IRremote
|
||||
architectures=*
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
|
||||
// Defining IR_GLOBAL here allows us to declare the instantiation of global variables
|
||||
#define IR_GLOBAL
|
||||
# include "IRremote.h"
|
||||
# include "IRremoteInt.h"
|
||||
#include "IRremote.h"
|
||||
#undef IR_GLOBAL
|
||||
|
||||
#ifdef HAS_AVR_INTERRUPT_H
|
||||
@@ -52,11 +51,12 @@ int MATCH (int measured, int desired)
|
||||
DBG_PRINT(TICKS_HIGH(desired), DEC);
|
||||
|
||||
bool passed = ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
|
||||
if (passed)
|
||||
if (passed) {
|
||||
DBG_PRINTLN(F("?; passed"));
|
||||
else
|
||||
} else {
|
||||
DBG_PRINTLN(F("?; FAILED"));
|
||||
return passed;
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
//+========================================================
|
||||
@@ -78,11 +78,12 @@ int MATCH_MARK (int measured_ticks, int desired_us)
|
||||
|
||||
bool passed = ((measured_ticks >= TICKS_LOW (desired_us + MARK_EXCESS))
|
||||
&& (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS)));
|
||||
if (passed)
|
||||
if (passed) {
|
||||
DBG_PRINTLN(F("?; passed"));
|
||||
else
|
||||
} else {
|
||||
DBG_PRINTLN(F("?; FAILED"));
|
||||
return passed;
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
//+========================================================
|
||||
@@ -104,11 +105,12 @@ int MATCH_SPACE (int measured_ticks, int desired_us)
|
||||
|
||||
bool passed = ((measured_ticks >= TICKS_LOW (desired_us - MARK_EXCESS))
|
||||
&& (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
|
||||
if (passed)
|
||||
if (passed) {
|
||||
DBG_PRINTLN(F("?; passed"));
|
||||
else
|
||||
} else {
|
||||
DBG_PRINTLN(F("?; FAILED"));
|
||||
return passed;
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
|
||||
//+=============================================================================
|
||||
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* @file IRremote.h
|
||||
* @brief Public API to the library.
|
||||
*/
|
||||
|
||||
//******************************************************************************
|
||||
// IRremote
|
||||
@@ -21,7 +25,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// The ISR header contains several useful macros the user may wish to use
|
||||
//
|
||||
#include "IRremoteInt.h"
|
||||
#include "private/IRremoteInt.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Supported IR protocols
|
||||
@@ -94,10 +98,10 @@
|
||||
#define PRONTO_FALLBACK true
|
||||
#define PRONTO_NOFALLBACK false
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// An enumerated list of all supported formats
|
||||
// You do NOT need to remove entries from this list when disabling protocols!
|
||||
//
|
||||
/**
|
||||
* An enum consisting of all supported formats.
|
||||
* You do NOT need to remove entries from this list when disabling protocols!
|
||||
*/
|
||||
typedef
|
||||
enum {
|
||||
UNKNOWN = -1,
|
||||
@@ -122,9 +126,9 @@ typedef
|
||||
}
|
||||
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
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -134,7 +138,13 @@ decode_type_t;
|
||||
# define DBG_PRINT(...) Serial.print(__VA_ARGS__)
|
||||
# define DBG_PRINTLN(...) Serial.println(__VA_ARGS__)
|
||||
#else
|
||||
/**
|
||||
* If DEBUG, print the arguments, otherwise do nothing.
|
||||
*/
|
||||
# define DBG_PRINT(...)
|
||||
/**
|
||||
* If DEBUG, print the arguments as a line, otherwise do nothing.
|
||||
*/
|
||||
# define DBG_PRINTLN(...)
|
||||
#endif
|
||||
|
||||
@@ -145,39 +155,71 @@ int MATCH (int measured, int desired) ;
|
||||
int MATCH_MARK (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
|
||||
{
|
||||
public:
|
||||
decode_type_t decode_type; // UNKNOWN, NEC, SONY, RC5, ...
|
||||
unsigned int address; // Used by Panasonic & Sharp [16-bits]
|
||||
unsigned long value; // Decoded value [max 32-bits]
|
||||
int bits; // Number of bits in decoded value
|
||||
volatile unsigned int *rawbuf; // Raw intervals in 50uS ticks
|
||||
int rawlen; // Number of records in rawbuf
|
||||
int overflow; // true iff IR raw code too long
|
||||
decode_type_t decode_type; ///< UNKNOWN, NEC, SONY, RC5, ...
|
||||
unsigned int address; ///< Used by Panasonic & Sharp [16-bits]
|
||||
unsigned long value; ///< Decoded value [max 32-bits]
|
||||
int bits; ///< Number of bits in decoded value
|
||||
volatile unsigned int *rawbuf; ///< Raw intervals in 50uS ticks
|
||||
int rawlen; ///< Number of records in rawbuf
|
||||
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
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Main class for receiving IR
|
||||
//
|
||||
/**
|
||||
* Main class for receiving IR
|
||||
*/
|
||||
class IRrecv
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Instantiate the IRrecv class. Multiple instantiation is not supported.
|
||||
* @param recvpin Arduino pin to use. No sanity check is made.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* TODO: Why is this public???
|
||||
* @param 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) ;
|
||||
|
||||
/**
|
||||
* Enable IR reception.
|
||||
*/
|
||||
void enableIRIn ( ) ;
|
||||
|
||||
/**
|
||||
* Returns status of reception
|
||||
* @return true if no reception is on-going.
|
||||
*/
|
||||
bool isIdle ( ) ;
|
||||
|
||||
/**
|
||||
* Called to re-enable IR reception.
|
||||
*/
|
||||
void resume ( ) ;
|
||||
|
||||
private:
|
||||
@@ -186,10 +228,17 @@ class IRrecv
|
||||
|
||||
//......................................................................
|
||||
# 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) ;
|
||||
# endif
|
||||
# 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) ;
|
||||
# endif
|
||||
# if DECODE_RC6
|
||||
@@ -253,9 +302,9 @@ class IRrecv
|
||||
# endif
|
||||
} ;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Main class for sending IR
|
||||
//
|
||||
/**
|
||||
* Main class for sending IR
|
||||
*/
|
||||
class IRsend
|
||||
{
|
||||
public:
|
||||
@@ -281,6 +330,7 @@ class IRsend
|
||||
//......................................................................
|
||||
# if SEND_RC5
|
||||
void sendRC5 (unsigned long data, int nbits) ;
|
||||
void sendRC5ext (unsigned long addr, unsigned long cmd, boolean toggle);
|
||||
# endif
|
||||
# if SEND_RC6
|
||||
void sendRC6 (unsigned long data, int nbits) ;
|
||||
@@ -3,7 +3,6 @@
|
||||
// This file contains functions specific to the ESP32.
|
||||
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
// "Idiot check"
|
||||
#ifdef USE_DEFAULT_ENABLE_IR_IN
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//+=============================================================================
|
||||
// Decodes the received IR message
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
#ifdef SENDING_SUPPORTED
|
||||
//+=============================================================================
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// AAA IIIII W W AAA
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
// Reverse Engineered by looking at RAW dumps generated by IRremote
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// DDDD IIIII SSSS H H
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// JJJJJ V V CCCC
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// L GGGG
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
#include "ir_Lego_PF_BitStreamEncoder.h"
|
||||
|
||||
//==============================================================================
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// MMMMM IIIII TTTTT SSSS U U BBBB IIIII SSSS H H IIIII
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// N N EEEEE CCCC
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// PPPP AAA N N AAA SSSS OOO N N IIIII CCCC
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//+=============================================================================
|
||||
// Gets one undecoded level at a time from the raw buffer.
|
||||
@@ -78,6 +77,73 @@ void IRsend::sendRC5 (unsigned long data, int nbits)
|
||||
|
||||
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
|
||||
|
||||
//+=============================================================================
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// SSSS AAA MMM SSSS U U N N GGGG
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// SSSS AAA N N Y Y OOO
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// SSSS H H AAA RRRR PPPP
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// SSSS OOO N N Y Y
|
||||
@@ -92,7 +92,6 @@ Regards,
|
||||
*/
|
||||
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
//
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
//==============================================================================
|
||||
// W W H H Y Y N N TTTTT EEEEE RRRRR
|
||||
@@ -18,15 +18,9 @@
|
||||
#define IRremoteint_h
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Include the right Arduino header
|
||||
// Include the Arduino header
|
||||
//
|
||||
#if defined(ARDUINO) && (ARDUINO >= 100)
|
||||
# include <Arduino.h>
|
||||
#else
|
||||
# if !defined(IRPRONTO)
|
||||
# include <WProgram.h>
|
||||
# endif
|
||||
#endif
|
||||
#include <Arduino.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// This handles definition and access to global variables
|
||||
@@ -40,19 +34,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Information for the Interrupt Service Routine
|
||||
//
|
||||
#define RAWBUF 101 // Maximum length of raw duration buffer
|
||||
#define RAWBUF 101 ///< Maximum length of raw duration buffer. Must be odd.
|
||||
|
||||
/**
|
||||
* This struct is used to communicate with the ISR (interrupt service routine).
|
||||
*/
|
||||
typedef
|
||||
struct {
|
||||
// The fields are ordered to reduce memory over caused by struct-padding
|
||||
uint8_t rcvstate; // State Machine state
|
||||
uint8_t recvpin; // Pin connected to IR data from detector
|
||||
uint8_t rcvstate; ///< State Machine state
|
||||
uint8_t recvpin; ///< Pin connected to IR data from detector
|
||||
uint8_t blinkpin;
|
||||
uint8_t blinkflag; // true -> enable blinking of pin on IR processing
|
||||
uint8_t rawlen; // counter of entries in rawbuf
|
||||
unsigned int timer; // State timer, counts 50uS ticks.
|
||||
unsigned int rawbuf[RAWBUF]; // raw data
|
||||
uint8_t overflow; // Raw buffer overflow occurred
|
||||
uint8_t blinkflag; ///< true -> enable blinking of pin on IR processing
|
||||
uint8_t rawlen; ///< counter of entries in rawbuf
|
||||
unsigned int timer; ///< State timer, counts 50uS ticks.
|
||||
unsigned int rawbuf[RAWBUF]; ///< raw data
|
||||
uint8_t overflow; ///< Raw buffer overflow occurred
|
||||
}
|
||||
irparams_t;
|
||||
|
||||
@@ -63,9 +60,11 @@ irparams_t;
|
||||
#define STATE_STOP 5
|
||||
#define STATE_OVERFLOW 6
|
||||
|
||||
// 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
|
||||
// Therefore we declare it as "volatile" to stop the compiler/CPU caching it
|
||||
/**
|
||||
* 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
|
||||
* Therefore we declare it as "volatile" to stop the compiler/CPU caching it
|
||||
*/
|
||||
EXTERN volatile irparams_t irparams;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -85,8 +84,12 @@ EXTERN volatile irparams_t irparams;
|
||||
// Pulse parameters in uSec
|
||||
//
|
||||
|
||||
// Due to sensor lag, when received, Marks tend to be 100us too long and
|
||||
// Spaces tend to be 100us too short
|
||||
/**
|
||||
* When received, marks tend to be too long and
|
||||
* 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
|
||||
|
||||
// Upper and Lower percentage tolerances in measurements
|
||||
@@ -85,7 +85,7 @@
|
||||
# undef HAS_AVR_INTERRUPT_H
|
||||
|
||||
// Sending not implemented
|
||||
# undef SENDING_SUPPORTED#
|
||||
# undef SENDING_SUPPORTED
|
||||
|
||||
// Supply own enbleIRIn
|
||||
# undef USE_DEFAULT_ENABLE_IR_IN
|
||||
@@ -131,8 +131,8 @@
|
||||
// Teensy 2.0
|
||||
#elif defined(__AVR_ATmega32U4__)
|
||||
//#define IR_USE_TIMER1 // tx = pin 14
|
||||
//#define IR_USE_TIMER3 // tx = pin 9
|
||||
#define IR_USE_TIMER4_HS // tx = pin 10
|
||||
#define IR_USE_TIMER3 // tx = pin 9
|
||||
//#define IR_USE_TIMER4_HS // tx = pin 10
|
||||
|
||||
// Teensy 3.0 / Teensy 3.1
|
||||
#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
@@ -1,7 +1,6 @@
|
||||
// Support routines for SAM processor boards
|
||||
|
||||
#include "IRremote.h"
|
||||
#include "IRremoteInt.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD)
|
||||
|
||||
Reference in New Issue
Block a user