I looked through the old IR Toy code and it’s not very complex overall, but it is tightly wound into the PIC registers. Most of the modes are covered elsewhere (SUMP logic analyzer), but two seem worth saving: IRMAN (Lirc, etc), and sampling mode (AnalysIR).
IRMAN
//final USB packet is:
//byte 1 bits 7-5 (don't care)
//byte 1 bits 4-0 (5 address bits)
//byte 2 bit 7 (don't care)
//byte 2 bit 6 (RC5x/start bit 2, not inversed)
//byte 2 bits 5-0 (RC5 6 bit command)
//byte 3-6 (unused)
A simple six byte packet with decoded RC5 or NEC (etc) shoveled in.
putc_cdc('O');
putc_cdc('K');
Response to r or R should be OK.
This is a pretty old protocol and second priority, but it is easy to integrate with the existing PIO IR decoders.
Sampling Mode
This is the mode compatible with AnalysIR software, and perhaps some other random scripts here and there. An IR signal triggers a timer, and we measure the length of each high and low period until a timeout occurs. This one is a real mess because the protocol is dead simple, but is ~~750 lines of configuring registers using hex values. Man the world used to be grim.
I wrote to Chris at AnalysIR, who was instrumental in choosing the right stuff to max out the IR Toy plank, to see what version of the old IR Toy firmware they actually support. He suggested using their AIR syntax instead and I am inclined to do that.
- $ start character
- carrier frequency / 1000 (this comes from the learner sensor)
- ASCII decimals representing the lengths of pulse and no-pulse in uS (anyone think that 90804 is a timeout?). CSV formatted, including the final value
- Terminated with ;
Since this can be used to transmit, we can add that enhanced feature too.