mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-12 17:36:15 +00:00
* new file: Doxyfile; #461. * Doxygen related documentation to two files. (Not complete.) #461.
This commit is contained in:
committed by
Rafi Khan
parent
5bbd55c650
commit
e206e122e5
105
src/IRremote.h
105
src/IRremote.h
@@ -1,3 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* @file IRremote.h
|
||||||
|
* @brief Public API to the library.
|
||||||
|
*/
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// IRremote
|
// IRremote
|
||||||
@@ -94,10 +98,10 @@
|
|||||||
#define PRONTO_FALLBACK true
|
#define PRONTO_FALLBACK true
|
||||||
#define PRONTO_NOFALLBACK false
|
#define PRONTO_NOFALLBACK false
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
/**
|
||||||
// An enumerated list of all supported formats
|
* An enum consisting 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,
|
||||||
@@ -122,9 +126,9 @@ typedef
|
|||||||
}
|
}
|
||||||
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
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -134,7 +138,13 @@ 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
|
||||||
|
|
||||||
@@ -145,39 +155,71 @@ 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:
|
||||||
@@ -186,10 +228,17 @@ 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
|
||||||
@@ -253,9 +302,9 @@ class IRrecv
|
|||||||
# endif
|
# endif
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
/**
|
||||||
// Main class for sending IR
|
* Main class for sending IR
|
||||||
//
|
*/
|
||||||
class IRsend
|
class IRsend
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -357,7 +406,7 @@ class IRsend
|
|||||||
|
|
||||||
unsigned int periodTime;
|
unsigned int periodTime;
|
||||||
unsigned int periodOnTime;
|
unsigned int periodOnTime;
|
||||||
|
|
||||||
void sleepMicros(unsigned long us);
|
void sleepMicros(unsigned long us);
|
||||||
void sleepUntilMicros(unsigned long targetTime);
|
void sleepUntilMicros(unsigned long targetTime);
|
||||||
|
|
||||||
|
|||||||
@@ -34,19 +34,22 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Information for the Interrupt Service Routine
|
// 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
|
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;
|
||||||
|
|
||||||
@@ -57,9 +60,11 @@ 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
|
/**
|
||||||
// NB. The data can be changed by the ISR at any time, even mid-function
|
* Allow all parts of the code access to the ISR data
|
||||||
// Therefore we declare it as "volatile" to stop the compiler/CPU caching it
|
* 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;
|
EXTERN volatile irparams_t irparams;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@@ -79,8 +84,12 @@ 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
|
/**
|
||||||
// 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
|
#define MARK_EXCESS 100
|
||||||
|
|
||||||
// Upper and Lower percentage tolerances in measurements
|
// Upper and Lower percentage tolerances in measurements
|
||||||
|
|||||||
Reference in New Issue
Block a user