Clearly mark the start of every function to aid is source navigation & code maintainability

This commit is contained in:
Bluechip
2015-06-17 21:59:04 +01:00
parent 9170c0b4a1
commit 942dcf4051

View File

@@ -74,6 +74,7 @@ int MATCH_SPACE(int measured_ticks, int desired_us) {return MATCH(measured_ticks
// Debugging versions are in IRremote.cpp
#endif
//+=============================================================================
#ifdef SEND_NEC
void IRsend::sendNEC(unsigned long data, int nbits)
{
@@ -96,6 +97,7 @@ void IRsend::sendNEC(unsigned long data, int nbits)
}
#endif
//+=============================================================================
#ifdef SEND_WHYNTER
void IRsend::sendWhynter(unsigned long data, int nbits) {
enableIROut(38);
@@ -119,6 +121,7 @@ void IRsend::sendWhynter(unsigned long data, int nbits) {
}
#endif
//+=============================================================================
#ifdef SEND_SONY
void IRsend::sendSony(unsigned long data, int nbits) {
enableIROut(40);
@@ -139,6 +142,7 @@ void IRsend::sendSony(unsigned long data, int nbits) {
}
#endif
//+=============================================================================
void IRsend::sendRaw(unsigned int buf[], int len, int hz)
{
enableIROut(hz);
@@ -153,6 +157,7 @@ void IRsend::sendRaw(unsigned int buf[], int len, int hz)
space(0); // Just to be sure
}
//+=============================================================================
#ifdef SEND_RC5
// Note: first bit must be a one (start bit)
void IRsend::sendRC5(unsigned long data, int nbits)
@@ -177,6 +182,7 @@ void IRsend::sendRC5(unsigned long data, int nbits)
}
#endif
//+=============================================================================
#ifdef SEND_RC6
// Caller needs to take care of flipping the toggle bit
void IRsend::sendRC6(unsigned long data, int nbits)
@@ -211,6 +217,7 @@ void IRsend::sendRC6(unsigned long data, int nbits)
}
#endif
//+=============================================================================
#ifdef SEND_PANASONIC
void IRsend::sendPanasonic(unsigned int address, unsigned long data) {
enableIROut(35);
@@ -241,6 +248,7 @@ void IRsend::sendPanasonic(unsigned int address, unsigned long data) {
}
#endif
//+=============================================================================
#ifdef SEND_JVC
void IRsend::sendJVC(unsigned long data, int nbits, int repeat)
{
@@ -266,6 +274,7 @@ void IRsend::sendJVC(unsigned long data, int nbits, int repeat)
}
#endif
//+=============================================================================
#ifdef SEND_SAMSUNG
void IRsend::sendSAMSUNG(unsigned long data, int nbits)
{
@@ -288,6 +297,7 @@ void IRsend::sendSAMSUNG(unsigned long data, int nbits)
}
#endif
//+=============================================================================
void IRsend::mark(int time) {
// Sends an IR mark for the specified number of microseconds.
// The mark output is modulated at the PWM frequency.
@@ -295,6 +305,7 @@ void IRsend::mark(int time) {
if (time > 0) delayMicroseconds(time);
}
//+=============================================================================
/* Leave pin off for time (given in microseconds) */
void IRsend::space(int time) {
// Sends an IR space for the specified number of microseconds.
@@ -303,6 +314,7 @@ void IRsend::space(int time) {
if (time > 0) delayMicroseconds(time);
}
//+=============================================================================
void IRsend::enableIROut(int khz) {
// Enables IR output. The khz value controls the modulation frequency in kilohertz.
// The IR output will be on pin 3 (OC2B).
@@ -330,12 +342,14 @@ void IRsend::enableIROut(int khz) {
TIMER_CONFIG_KHZ(khz);
}
//+=============================================================================
IRrecv::IRrecv(int recvpin)
{
irparams.recvpin = recvpin;
irparams.blinkflag = 0;
}
//+=============================================================================
// initialization
void IRrecv::enableIRIn() {
cli();
@@ -360,6 +374,7 @@ void IRrecv::enableIRIn() {
pinMode(irparams.recvpin, INPUT);
}
//+=============================================================================
// enable/disable blinking of pin 13 on IR processing
void IRrecv::blink13(int blinkflag)
{
@@ -368,6 +383,7 @@ void IRrecv::blink13(int blinkflag)
pinMode(BLINKLED, OUTPUT);
}
//+=============================================================================
// TIMER2 interrupt code to collect raw data.
// Widths of alternating SPACE, MARK are recorded in rawbuf.
// Recorded in ticks of 50 microseconds.
@@ -442,13 +458,13 @@ ISR(TIMER_INTR_NAME)
}
}
//+=============================================================================
void IRrecv::resume() {
irparams.rcvstate = STATE_IDLE;
irparams.rawlen = 0;
}
//+=============================================================================
// Decodes the received IR message
// Returns 0 if no data ready, 1 if data ready.
// Results of decoding are stored in results
@@ -577,6 +593,7 @@ int IRrecv::decode(decode_results *results) {
return ERR;
}
//+=============================================================================
#ifdef DECODE_NEC
// NECs have a repeat only 4 items long
long IRrecv::decodeNEC(decode_results *results) {
@@ -628,6 +645,7 @@ long IRrecv::decodeNEC(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_SONY
long IRrecv::decodeSony(decode_results *results) {
long data = 0;
@@ -686,6 +704,7 @@ long IRrecv::decodeSony(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_WHYNTER
long IRrecv::decodeWhynter(decode_results *results) {
long data = 0;
@@ -746,6 +765,7 @@ long IRrecv::decodeWhynter(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_SANYO
// I think this is a Sanyo decoder - serial = SA 8650B
// Looks like Sony except for timings, 48 chars of data and time/space different
@@ -812,6 +832,7 @@ long IRrecv::decodeSanyo(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_MITSUBISHI
// Looks like Sony except for timings, 48 chars of data and time/space different
long IRrecv::decodeMitsubishi(decode_results *results) {
@@ -878,6 +899,7 @@ long IRrecv::decodeMitsubishi(decode_results *results) {
}
#endif
//+=============================================================================
// Gets one undecoded level at a time from the raw buffer.
// The RC5/6 decoding is easier if the data is broken into time intervals.
// E.g. if the buffer has MARK for 2 time intervals and SPACE for 1,
@@ -924,6 +946,7 @@ int IRrecv::getRClevel(decode_results *results, int *offset, int *used, int t1)
return val;
}
//+=============================================================================
#ifdef DECODE_RC5
long IRrecv::decodeRC5(decode_results *results) {
if (irparams.rawlen < MIN_RC5_SAMPLES + 2) {
@@ -961,6 +984,7 @@ long IRrecv::decodeRC5(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_RC6
long IRrecv::decodeRC6(decode_results *results) {
if (results->rawlen < MIN_RC6_SAMPLES) {
@@ -1014,6 +1038,7 @@ long IRrecv::decodeRC6(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_PANASONIC
long IRrecv::decodePanasonic(decode_results *results) {
unsigned long long data = 0;
@@ -1050,6 +1075,7 @@ long IRrecv::decodePanasonic(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_LG
long IRrecv::decodeLG(decode_results *results) {
long data = 0;
@@ -1098,6 +1124,7 @@ long IRrecv::decodeLG(decode_results *results) {
#endif
//+=============================================================================
#ifdef DECODE_JVC
long IRrecv::decodeJVC(decode_results *results) {
long data = 0;
@@ -1152,6 +1179,7 @@ long IRrecv::decodeJVC(decode_results *results) {
}
#endif
//+=============================================================================
#ifdef DECODE_SAMSUNG
// SAMSUNGs have a repeat only 4 items long
long IRrecv::decodeSAMSUNG(decode_results *results) {
@@ -1203,6 +1231,7 @@ long IRrecv::decodeSAMSUNG(decode_results *results) {
}
#endif
//+=============================================================================
/**
* Aiwa system
* Remote control RC-T501
@@ -1265,6 +1294,7 @@ long IRrecv::decodeAiwaRCT501(decode_results *results) {
#endif
//+=============================================================================
/* -----------------------------------------------------------------------
* hashdecode - decode an arbitrary IR code.
* Instead of decoding using a standard encoding scheme
@@ -1294,6 +1324,7 @@ int IRrecv::compare(unsigned int oldval, unsigned int newval) {
}
}
//+=============================================================================
// Use FNV hash algorithm: http://isthe.com/chongo/tech/comp/fnv/#FNV-param
#define FNV_PRIME_32 16777619
#define FNV_BASIS_32 2166136261
@@ -1319,6 +1350,7 @@ long IRrecv::decodeHash(decode_results *results) {
return DECODED;
}
//+=============================================================================
/* Sharp and DISH support by Todd Treece ( http://unionbridge.org/design/ircommand )
The Dish send function needs to be repeated 4 times, and the Sharp function
@@ -1368,6 +1400,7 @@ void IRsend::sendSharp(unsigned long data, int nbits) {
}
}
//+=============================================================================
// Sharp send compatible with data obtained through decodeSharp
void IRsend::sendSharp(unsigned int address, unsigned int command) {
sendSharpRaw((address << 10) | (command << 2) | 2, 15);
@@ -1375,6 +1408,7 @@ void IRsend::sendSharp(unsigned int address, unsigned int command) {
#endif
//+=============================================================================
#ifdef SEND_DISH
void IRsend::sendDISH(unsigned long data, int nbits)
{
@@ -1394,13 +1428,14 @@ void IRsend::sendDISH(unsigned long data, int nbits)
}
}
#endif
//+=============================================================================
/**
* Aiwa system
* Remote control RC-T501
* Lirc file http://lirc.sourceforge.net/remotes/aiwa/RC-T501
*
*/
#ifdef SEND_AIWA_RC_T501
void IRsend::sendAiwaRCT501(int code) {
// PRE-DATA, 26 bits, 0x227EEC0