Rover 5 Infrared Code Processing Notes

Infrared Codes Auto-Generated Array Declaration and Comments

Below is an example of my program's auto-generation of the Array Declaration (and comments ) which stores the pattern produced by pushing my toy Remote Control's Power button, showing both the index# of each pulse, and whether it is Long or Short.

In an ideal world, I'd represent the pulse chains as hex bits, where a Long pulse represents 0b1, and a Short pulse represents 0b0.

But I wasn't sure how may stop- and start-bits are in these chains, so I just stored them as counts of Long and Short pulses instead:

// For brevity, I'll express each button's pattern as pairs of:
//    Long pulses, Short pulses.
// -1's = placeholders, to ensure Long-followed-by-Short order,
// for when there is no Short pulse preceeding a Gap, etc.
// -2's = a Short pulse comes first after this Gap, rather than a Long one.
//
int toyPowerButtonPattern[] =
{
// We want to start at index 1, to match the output of the
// rawirdecode program. so let's put this spot to good use,
// to store our command name.
(int)"POWER",
//
// For 1-16:
// l s l s l s
// 1 2 8 9 1016
   1,6,1,1,6,1,
//
// For 17-21:
// l s l s
// 17181920
   1,1,1,2,
//
// For 22-30:
// l s l s l s
// 222326272830
   1,3,1,1,2,1,
//
// For 31-33:
// l
// 31
   3,-1,
//
// For 34: Gap of 1182 * 20 uS.
-1182, -1,
//
// For 35-44:
// l s l s
// 35363740
   1,1,3,5,
//
// For 45-53:
// l s
// 4548
   3,6,
//
// For 54-62:
// l s l s l s
// 545556576062
   1,1,1,3,2,1,
//
// For 63-67:
// l s l
// 636465
   1,1,3,-1,
//
// For 68: Gap of 1184 * 20 uS.
-1184, -1,
//
// For 69-73:
// l s
// 6973
   4,1,
//
// For 74-85:
// l s l s
// 74757879
   1,3,1,7,
//
// For 86-91:
// l s l s
// 86878891
   1,1,3,1,
//
// For 92-103:
// l s l s  
// 929698101
   4,2,3,3,
//
// For 104-111:
// l  s  l  
// 104106109
   2, 3, 3, -1,
}; // End of toyPowerButtonPattern[].

Back to Previous Page...