Fix CRLF issues.

Many problems happen with git due to some machines liking CRLF at the
end of lines, and others linking CR.  To try to straighten this out,
I'm using Unix-style LF (\n) as the line endings.  To make sure your
repository remains consistent, try:

$ git config --global core.autocrlf input

For details, see:
http://help.github.com/dealing-with-lineendings/
This commit is contained in:
Ken Shirriff
2010-05-15 15:19:55 -07:00
parent 19320b2144
commit acca27b698
9 changed files with 1149 additions and 1157 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,101 +1,101 @@
/* /*
* IRremote * IRremote
* Version 0.1 July, 2009 * Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff * Copyright 2009 Ken Shirriff
* For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.htm http://arcfn.com * For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.htm http://arcfn.com
* *
* Interrupt code based on NECIRrcv by Joe Knapp * Interrupt code based on NECIRrcv by Joe Knapp
* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556 * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
*/ */
#ifndef IRremote_h #ifndef IRremote_h
#define IRremote_h #define IRremote_h
// The following are compile-time library options. // The following are compile-time library options.
// If you change them, recompile the library. // If you change them, recompile the library.
// If DEBUG is defined, a lot of debugging output will be printed during decoding. // If DEBUG is defined, a lot of debugging output will be printed during decoding.
// TEST must be defined for the IRtest unittests to work. It will make some // TEST must be defined for the IRtest unittests to work. It will make some
// methods virtual, which will be slightly slower, which is why it is optional. // methods virtual, which will be slightly slower, which is why it is optional.
// #define DEBUG // #define DEBUG
// #define TEST // #define TEST
// Results returned from the decoder // Results returned from the decoder
class decode_results { class decode_results {
public: public:
int decode_type; // NEC, SONY, RC5, UNKNOWN int decode_type; // NEC, SONY, RC5, UNKNOWN
unsigned long value; // Decoded value unsigned long value; // Decoded value
int bits; // Number of bits in decoded value int bits; // Number of bits in decoded value
volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks volatile unsigned int *rawbuf; // Raw intervals in .5 us ticks
int rawlen; // Number of records in rawbuf. int rawlen; // Number of records in rawbuf.
}; };
// Values for decode_type // Values for decode_type
#define NEC 1 #define NEC 1
#define SONY 2 #define SONY 2
#define RC5 3 #define RC5 3
#define RC6 4 #define RC6 4
#define DISH 5 #define DISH 5
#define SHARP 6 #define SHARP 6
#define UNKNOWN -1 #define UNKNOWN -1
// 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:
IRrecv(int recvpin); IRrecv(int recvpin);
void blink13(int blinkflag); void blink13(int blinkflag);
int decode(decode_results *results); int decode(decode_results *results);
void enableIRIn(); void enableIRIn();
void resume(); void resume();
private: private:
// These are called by decode // These are called by decode
int getRClevel(decode_results *results, int *offset, int *used, int t1); int getRClevel(decode_results *results, int *offset, int *used, int t1);
long decodeNEC(decode_results *results); long decodeNEC(decode_results *results);
long decodeSony(decode_results *results); long decodeSony(decode_results *results);
long decodeRC5(decode_results *results); long decodeRC5(decode_results *results);
long decodeRC6(decode_results *results); long decodeRC6(decode_results *results);
long decodeHash(decode_results *results); long decodeHash(decode_results *results);
int compare(unsigned int oldval, unsigned int newval); int compare(unsigned int oldval, unsigned int newval);
} }
; ;
// Only used for testing; can remove virtual for shorter code // Only used for testing; can remove virtual for shorter code
#ifdef TEST #ifdef TEST
#define VIRTUAL virtual #define VIRTUAL virtual
#else #else
#define VIRTUAL #define VIRTUAL
#endif #endif
class IRsend class IRsend
{ {
public: public:
IRsend() {} IRsend() {}
void sendNEC(unsigned long data, int nbits); void sendNEC(unsigned long data, int nbits);
void sendSony(unsigned long data, int nbits); void sendSony(unsigned long data, int nbits);
void sendRaw(unsigned int buf[], int len, int hz); void sendRaw(unsigned int buf[], int len, int hz);
void sendRC5(unsigned long data, int nbits); void sendRC5(unsigned long data, int nbits);
void sendRC6(unsigned long data, int nbits); void sendRC6(unsigned long data, int nbits);
void sendDISH(unsigned long data, int nbits); void sendDISH(unsigned long data, int nbits);
void sendSharp(unsigned long data, int nbits); void sendSharp(unsigned long data, int nbits);
// private: // private:
void enableIROut(int khz); void enableIROut(int khz);
VIRTUAL void mark(int usec); VIRTUAL void mark(int usec);
VIRTUAL void space(int usec); VIRTUAL void space(int usec);
} }
; ;
// Some useful constants // Some useful constants
#define USECPERTICK 50 // microseconds per clock interrupt tick #define USECPERTICK 50 // microseconds per clock interrupt tick
#define RAWBUF 76 // Length of raw duration buffer #define RAWBUF 76 // Length of raw duration buffer
// Marks tend to be 100us too long, and spaces 100us too short // Marks tend to be 100us too long, and spaces 100us too short
// when received due to sensor lag. // when received due to sensor lag.
#define MARK_EXCESS 100 #define MARK_EXCESS 100
#endif #endif

View File

@@ -1,129 +1,129 @@
/* /*
* IRremote * IRremote
* Version 0.1 July, 2009 * Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff * Copyright 2009 Ken Shirriff
* For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html * For details, see http://arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
* *
* Interrupt code based on NECIRrcv by Joe Knapp * Interrupt code based on NECIRrcv by Joe Knapp
* http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556 * http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1210243556
* Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/ * Also influenced by http://zovirl.com/2008/11/12/building-a-universal-remote-with-an-arduino/
*/ */
#ifndef IRremoteint_h #ifndef IRremoteint_h
#define IRremoteint_h #define IRremoteint_h
#include <WProgram.h> #include <WProgram.h>
#define CLKFUDGE 5 // fudge factor for clock interrupt overhead #define CLKFUDGE 5 // fudge factor for clock interrupt overhead
#define CLK 256 // max value for clock (timer 2) #define CLK 256 // max value for clock (timer 2)
#define PRESCALE 8 // timer2 clock prescale #define PRESCALE 8 // timer2 clock prescale
#define SYSCLOCK 16000000 // main Arduino clock #define SYSCLOCK 16000000 // main Arduino clock
#define CLKSPERUSEC (SYSCLOCK/PRESCALE/1000000) // timer clocks per microsecond #define CLKSPERUSEC (SYSCLOCK/PRESCALE/1000000) // timer clocks per microsecond
#define ERR 0 #define ERR 0
#define DECODED 1 #define DECODED 1
#define BLINKLED 13 #define BLINKLED 13
// defines for setting and clearing register bits // defines for setting and clearing register bits
#ifndef cbi #ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif #endif
#ifndef sbi #ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif #endif
// clock timer reset value // clock timer reset value
#define INIT_TIMER_COUNT2 (CLK - USECPERTICK*CLKSPERUSEC + CLKFUDGE) #define INIT_TIMER_COUNT2 (CLK - USECPERTICK*CLKSPERUSEC + CLKFUDGE)
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT2 #define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT2
// pulse parameters in usec // pulse parameters in usec
#define NEC_HDR_MARK 9000 #define NEC_HDR_MARK 9000
#define NEC_HDR_SPACE 4500 #define NEC_HDR_SPACE 4500
#define NEC_BIT_MARK 560 #define NEC_BIT_MARK 560
#define NEC_ONE_SPACE 1600 #define NEC_ONE_SPACE 1600
#define NEC_ZERO_SPACE 560 #define NEC_ZERO_SPACE 560
#define NEC_RPT_SPACE 2250 #define NEC_RPT_SPACE 2250
#define SONY_HDR_MARK 2400 #define SONY_HDR_MARK 2400
#define SONY_HDR_SPACE 600 #define SONY_HDR_SPACE 600
#define SONY_ONE_MARK 1200 #define SONY_ONE_MARK 1200
#define SONY_ZERO_MARK 600 #define SONY_ZERO_MARK 600
#define SONY_RPT_LENGTH 45000 #define SONY_RPT_LENGTH 45000
#define RC5_T1 889 #define RC5_T1 889
#define RC5_RPT_LENGTH 46000 #define RC5_RPT_LENGTH 46000
#define RC6_HDR_MARK 2666 #define RC6_HDR_MARK 2666
#define RC6_HDR_SPACE 889 #define RC6_HDR_SPACE 889
#define RC6_T1 444 #define RC6_T1 444
#define RC6_RPT_LENGTH 46000 #define RC6_RPT_LENGTH 46000
#define SHARP_BIT_MARK 245 #define SHARP_BIT_MARK 245
#define SHARP_ONE_SPACE 1805 #define SHARP_ONE_SPACE 1805
#define SHARP_ZERO_SPACE 795 #define SHARP_ZERO_SPACE 795
#define SHARP_GAP 600000 #define SHARP_GAP 600000
#define SHARP_TOGGLE_MASK 0x3FF #define SHARP_TOGGLE_MASK 0x3FF
#define SHARP_RPT_SPACE 3000 #define SHARP_RPT_SPACE 3000
#define DISH_HDR_MARK 400 #define DISH_HDR_MARK 400
#define DISH_HDR_SPACE 6100 #define DISH_HDR_SPACE 6100
#define DISH_BIT_MARK 400 #define DISH_BIT_MARK 400
#define DISH_ONE_SPACE 1700 #define DISH_ONE_SPACE 1700
#define DISH_ZERO_SPACE 2800 #define DISH_ZERO_SPACE 2800
#define DISH_RPT_SPACE 6200 #define DISH_RPT_SPACE 6200
#define DISH_TOP_BIT 0x8000 #define DISH_TOP_BIT 0x8000
#define SHARP_BITS 15 #define SHARP_BITS 15
#define DISH_BITS 16 #define DISH_BITS 16
#define TOLERANCE 25 // percent tolerance in measurements #define TOLERANCE 25 // percent tolerance in measurements
#define LTOL (1.0 - TOLERANCE/100.) #define LTOL (1.0 - TOLERANCE/100.)
#define UTOL (1.0 + TOLERANCE/100.) #define UTOL (1.0 + TOLERANCE/100.)
#define _GAP 5000 // Minimum map between transmissions #define _GAP 5000 // Minimum map between transmissions
#define GAP_TICKS (_GAP/USECPERTICK) #define GAP_TICKS (_GAP/USECPERTICK)
#define TICKS_LOW(us) (int) (((us)*LTOL/USECPERTICK)) #define TICKS_LOW(us) (int) (((us)*LTOL/USECPERTICK))
#define TICKS_HIGH(us) (int) (((us)*UTOL/USECPERTICK + 1)) #define TICKS_HIGH(us) (int) (((us)*UTOL/USECPERTICK + 1))
#ifndef DEBUG #ifndef DEBUG
#define MATCH(measured_ticks, desired_us) ((measured_ticks) >= TICKS_LOW(desired_us) && (measured_ticks) <= TICKS_HIGH(desired_us)) #define MATCH(measured_ticks, desired_us) ((measured_ticks) >= TICKS_LOW(desired_us) && (measured_ticks) <= TICKS_HIGH(desired_us))
#define MATCH_MARK(measured_ticks, desired_us) MATCH(measured_ticks, (desired_us) + MARK_EXCESS) #define MATCH_MARK(measured_ticks, desired_us) MATCH(measured_ticks, (desired_us) + MARK_EXCESS)
#define MATCH_SPACE(measured_ticks, desired_us) MATCH((measured_ticks), (desired_us) - MARK_EXCESS) #define MATCH_SPACE(measured_ticks, desired_us) MATCH((measured_ticks), (desired_us) - MARK_EXCESS)
// Debugging versions are in IRremote.cpp // Debugging versions are in IRremote.cpp
#endif #endif
// receiver states // receiver states
#define STATE_IDLE 2 #define STATE_IDLE 2
#define STATE_MARK 3 #define STATE_MARK 3
#define STATE_SPACE 4 #define STATE_SPACE 4
#define STATE_STOP 5 #define STATE_STOP 5
// information for the interrupt handler // information for the interrupt handler
typedef struct { typedef struct {
uint8_t recvpin; // pin for IR data from detector uint8_t recvpin; // pin for IR data from detector
uint8_t rcvstate; // state machine uint8_t rcvstate; // state machine
uint8_t blinkflag; // TRUE to enable blinking of pin 13 on IR processing uint8_t blinkflag; // TRUE to enable blinking of pin 13 on IR processing
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 rawlen; // counter of entries in rawbuf uint8_t rawlen; // counter of entries in rawbuf
} }
irparams_t; irparams_t;
// Defined in IRremote.cpp // Defined in IRremote.cpp
extern volatile irparams_t irparams; extern volatile irparams_t irparams;
// IR detector output is active low // IR detector output is active low
#define MARK 0 #define MARK 0
#define SPACE 1 #define SPACE 1
#define TOPBIT 0x80000000 #define TOPBIT 0x80000000
#define NEC_BITS 32 #define NEC_BITS 32
#define SONY_BITS 12 #define SONY_BITS 12
#define MIN_RC5_SAMPLES 11 #define MIN_RC5_SAMPLES 11
#define MIN_RC6_SAMPLES 1 #define MIN_RC6_SAMPLES 1
#endif #endif

View File

@@ -165,10 +165,3 @@ void loop() {
} }
lastButtonState = buttonState; lastButtonState = buttonState;
} }

View File

@@ -25,4 +25,4 @@ void loop() {
Serial.println(results.value, HEX); Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value irrecv.resume(); // Receive the next value
} }
} }

View File

@@ -69,4 +69,4 @@ void loop() {
dump(&results); dump(&results);
irrecv.resume(); // Receive the next value irrecv.resume(); // Receive the next value
} }
} }

View File

@@ -82,4 +82,4 @@ void loop() {
last = millis(); last = millis();
irrecv.resume(); // Receive the next value irrecv.resume(); // Receive the next value
} }
} }

View File

@@ -23,4 +23,3 @@ void loop() {
} }
} }
} }

View File

@@ -1,190 +1,190 @@
/* /*
* IRremote: IRtest unittest * IRremote: IRtest unittest
* Version 0.1 July, 2009 * Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff * Copyright 2009 Ken Shirriff
* http://arcfn.com * http://arcfn.com
* *
* Note: to run these tests, edit IRremote/IRremote.h to add "#define TEST" * Note: to run these tests, edit IRremote/IRremote.h to add "#define TEST"
* You must then recompile the library by removing IRremote.o and restarting * You must then recompile the library by removing IRremote.o and restarting
* the arduino IDE. * the arduino IDE.
*/ */
#include <IRremote.h> #include <IRremote.h>
#include <IRremoteInt.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()
// void * to work around compiler issue // void * to work around compiler issue
//void dump(void *v) { //void dump(void *v) {
// decode_results *results = (decode_results *)v // decode_results *results = (decode_results *)v
void dump(decode_results *results) { void dump(decode_results *results) {
int count = results->rawlen; int count = results->rawlen;
if (results->decode_type == UNKNOWN) { if (results->decode_type == UNKNOWN) {
Serial.println("Could not decode message"); Serial.println("Could not decode message");
} }
else { else {
if (results->decode_type == NEC) { if (results->decode_type == NEC) {
Serial.print("Decoded NEC: "); Serial.print("Decoded NEC: ");
} }
else if (results->decode_type == SONY) { else if (results->decode_type == SONY) {
Serial.print("Decoded SONY: "); Serial.print("Decoded SONY: ");
} }
else if (results->decode_type == RC5) { else if (results->decode_type == RC5) {
Serial.print("Decoded RC5: "); Serial.print("Decoded RC5: ");
} }
else if (results->decode_type == RC6) { else if (results->decode_type == RC6) {
Serial.print("Decoded RC6: "); Serial.print("Decoded RC6: ");
} }
Serial.print(results->value, HEX); Serial.print(results->value, HEX);
Serial.print(" ("); Serial.print(" (");
Serial.print(results->bits, DEC); Serial.print(results->bits, DEC);
Serial.println(" bits)"); Serial.println(" bits)");
} }
Serial.print("Raw ("); Serial.print("Raw (");
Serial.print(count, DEC); Serial.print(count, DEC);
Serial.print("): "); Serial.print("): ");
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if ((i % 2) == 1) { if ((i % 2) == 1) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC); Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
} }
else { else {
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC); Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
} }
Serial.print(" "); Serial.print(" ");
} }
Serial.println(""); Serial.println("");
} }
IRrecv irrecv(0); IRrecv irrecv(0);
decode_results results; decode_results results;
class IRsendDummy : class IRsendDummy :
public IRsend public IRsend
{ {
public: public:
// For testing, just log the marks/spaces // For testing, just log the marks/spaces
#define SENDLOG_LEN 128 #define SENDLOG_LEN 128
int sendlog[SENDLOG_LEN]; int sendlog[SENDLOG_LEN];
int sendlogcnt; int sendlogcnt;
IRsendDummy() : IRsendDummy() :
IRsend() { IRsend() {
} }
void reset() { void reset() {
sendlogcnt = 0; sendlogcnt = 0;
} }
void mark(int time) { void mark(int time) {
sendlog[sendlogcnt] = time; sendlog[sendlogcnt] = time;
if (sendlogcnt < SENDLOG_LEN) sendlogcnt++; if (sendlogcnt < SENDLOG_LEN) sendlogcnt++;
} }
void space(int time) { void space(int time) {
sendlog[sendlogcnt] = -time; sendlog[sendlogcnt] = -time;
if (sendlogcnt < SENDLOG_LEN) sendlogcnt++; if (sendlogcnt < SENDLOG_LEN) sendlogcnt++;
} }
// Copies the dummy buf into the interrupt buf // Copies the dummy buf into the interrupt buf
void useDummyBuf() { void useDummyBuf() {
int last = SPACE; int last = SPACE;
irparams.rcvstate = STATE_STOP; irparams.rcvstate = STATE_STOP;
irparams.rawlen = 1; // Skip the gap irparams.rawlen = 1; // Skip the gap
for (int i = 0 ; i < sendlogcnt; i++) { for (int i = 0 ; i < sendlogcnt; i++) {
if (sendlog[i] < 0) { if (sendlog[i] < 0) {
if (last == MARK) { if (last == MARK) {
// New space // New space
irparams.rawbuf[irparams.rawlen++] = (-sendlog[i] - MARK_EXCESS) / USECPERTICK; irparams.rawbuf[irparams.rawlen++] = (-sendlog[i] - MARK_EXCESS) / USECPERTICK;
last = SPACE; last = SPACE;
} }
else { else {
// More space // More space
irparams.rawbuf[irparams.rawlen - 1] += -sendlog[i] / USECPERTICK; irparams.rawbuf[irparams.rawlen - 1] += -sendlog[i] / USECPERTICK;
} }
} }
else if (sendlog[i] > 0) { else if (sendlog[i] > 0) {
if (last == SPACE) { if (last == SPACE) {
// New mark // New mark
irparams.rawbuf[irparams.rawlen++] = (sendlog[i] + MARK_EXCESS) / USECPERTICK; irparams.rawbuf[irparams.rawlen++] = (sendlog[i] + MARK_EXCESS) / USECPERTICK;
last = MARK; last = MARK;
} }
else { else {
// More mark // More mark
irparams.rawbuf[irparams.rawlen - 1] += sendlog[i] / USECPERTICK; irparams.rawbuf[irparams.rawlen - 1] += sendlog[i] / USECPERTICK;
} }
} }
} }
if (irparams.rawlen % 2) { if (irparams.rawlen % 2) {
irparams.rawlen--; // Remove trailing space irparams.rawlen--; // Remove trailing space
} }
} }
}; };
IRsendDummy irsenddummy; IRsendDummy irsenddummy;
void verify(unsigned long val, int bits, int type) { void verify(unsigned long val, int bits, int type) {
irsenddummy.useDummyBuf(); irsenddummy.useDummyBuf();
irrecv.decode(&results); irrecv.decode(&results);
Serial.print("Testing "); Serial.print("Testing ");
Serial.print(val, HEX); Serial.print(val, HEX);
if (results.value == val && results.bits == bits && results.decode_type == type) { if (results.value == val && results.bits == bits && results.decode_type == type) {
Serial.println(": OK"); Serial.println(": OK");
} }
else { else {
Serial.println(": Error"); Serial.println(": Error");
dump(&results); dump(&results);
} }
} }
void testNEC(unsigned long val, int bits) { void testNEC(unsigned long val, int bits) {
irsenddummy.reset(); irsenddummy.reset();
irsenddummy.sendNEC(val, bits); irsenddummy.sendNEC(val, bits);
verify(val, bits, NEC); verify(val, bits, NEC);
} }
void testSony(unsigned long val, int bits) { void testSony(unsigned long val, int bits) {
irsenddummy.reset(); irsenddummy.reset();
irsenddummy.sendSony(val, bits); irsenddummy.sendSony(val, bits);
verify(val, bits, SONY); verify(val, bits, SONY);
} }
void testRC5(unsigned long val, int bits) { void testRC5(unsigned long val, int bits) {
irsenddummy.reset(); irsenddummy.reset();
irsenddummy.sendRC5(val, bits); irsenddummy.sendRC5(val, bits);
verify(val, bits, RC5); verify(val, bits, RC5);
} }
void testRC6(unsigned long val, int bits) { void testRC6(unsigned long val, int bits) {
irsenddummy.reset(); irsenddummy.reset();
irsenddummy.sendRC6(val, bits); irsenddummy.sendRC6(val, bits);
verify(val, bits, RC6); verify(val, bits, RC6);
} }
void test() { void test() {
Serial.println("NEC tests"); Serial.println("NEC tests");
testNEC(0x00000000, 32); testNEC(0x00000000, 32);
testNEC(0xffffffff, 32); testNEC(0xffffffff, 32);
testNEC(0xaaaaaaaa, 32); testNEC(0xaaaaaaaa, 32);
testNEC(0x55555555, 32); testNEC(0x55555555, 32);
testNEC(0x12345678, 32); testNEC(0x12345678, 32);
Serial.println("Sony tests"); Serial.println("Sony tests");
testSony(0xfff, 12); testSony(0xfff, 12);
testSony(0x000, 12); testSony(0x000, 12);
testSony(0xaaa, 12); testSony(0xaaa, 12);
testSony(0x555, 12); testSony(0x555, 12);
testSony(0x123, 12); testSony(0x123, 12);
Serial.println("RC5 tests"); Serial.println("RC5 tests");
testRC5(0xfff, 12); testRC5(0xfff, 12);
testRC5(0x000, 12); testRC5(0x000, 12);
testRC5(0xaaa, 12); testRC5(0xaaa, 12);
testRC5(0x555, 12); testRC5(0x555, 12);
testRC5(0x123, 12); testRC5(0x123, 12);
Serial.println("RC6 tests"); Serial.println("RC6 tests");
testRC6(0xfffff, 20); testRC6(0xfffff, 20);
testRC6(0x00000, 20); testRC6(0x00000, 20);
testRC6(0xaaaaa, 20); testRC6(0xaaaaa, 20);
testRC6(0x55555, 20); testRC6(0x55555, 20);
testRC6(0x12345, 20); testRC6(0x12345, 20);
} }
void setup() void setup()
{ {
Serial.begin(9600); Serial.begin(9600);
test(); test();
} }
void loop() { void loop() {
} }