source: trunk/Arduino/libraries/Adafruit_Circuit_Playground/utility/IRLib_P09_GICable.h

Last change on this file was 3, checked in by markus, 7 years ago

Setup project structure

File size: 2.5 KB
Line 
1/* IRLib_P09_GICable.h
2 * Part of IRLib Library for Arduino receiving, decoding, and sending
3 * infrared signals. See COPYRIGHT.txt and LICENSE.txt for more information.
4 */
5
6/* The G.I. Cable protocol is is used by many Motorola brand cable boxes manufactured by
7 * General Instruments. The IRP notation for this protocol is
8 * "{38.7k,490}<1,-4.5|1,-9>(18,-9,F:8,D:4,C:4,1,-84,(18,-4.5,1,-178)*) {C = -(D + F:4 + F:4:4)}"
9 * It is a 16-bit code which uses an unusual "ditto" repeat sequence similar to NEC.
10 * In fact it is so similar that IRLib generally not distinguish between the two.
11 * The header timing for G.I. Cable ditto is 8820,1960 and for NEC is 9024,2256
12 * If you are using both protocols and you receive an NEC ditto immediately after
13 * receiving a G.I.Cable then you should presume it is a G.I.Cable and vice versa.
14 */
15#ifndef IRLIB_PROTOCOL_09_H
16#define IRLIB_PROTOCOL_09_H
17#define IR_SEND_PROTOCOL_09             case 9: IRsendGICable::send(data); break;
18#define IR_DECODE_PROTOCOL_09   if(IRdecodeGICable::decode()) return true;
19#ifdef IRLIB_HAVE_COMBO
20        #define PV_IR_DECODE_PROTOCOL_09 ,public virtual IRdecodeGICable
21        #define PV_IR_SEND_PROTOCOL_09   ,public virtual IRsendGICable
22#else
23        #define PV_IR_DECODE_PROTOCOL_09  public virtual IRdecodeGICable
24        #define PV_IR_SEND_PROTOCOL_09    public virtual IRsendGICable
25#endif
26
27#ifdef IRLIBSENDBASE_H
28class IRsendGICable: public virtual IRsendBase {
29  public:
30    void send(uint32_t data) {
31      if(data==REPEAT_CODE) {
32        enableIROut(39);
33        mark (490*18); space(2205);//actually "490*4.5"
34        mark (490); space(220);delay(87);//actually 490*178 or "space(87220);"
35      } else {
36        sendGeneric(data,16, 490*18, 490*9, 490, 490, 490*9, 2205/*(4.5*490)*/, 39, true);
37        space(37*490);
38      }
39    }
40};
41#endif  //IRLIBSENDBASE_H
42
43#ifdef IRLIBDECODEBASE_H
44class IRdecodeGICable: public virtual IRdecodeBase {
45  public:
46    bool decode(void) {
47      IRLIB_ATTEMPT_MESSAGE(F("G.I.cable"));
48      // Check for repeat
49      if (recvGlobal.decodeLength == 4 && MATCH(recvGlobal.decodeBuffer[1], 490*18) && MATCH(recvGlobal.decodeBuffer[2],2205)
50              && MATCH(recvGlobal.decodeBuffer[3],490)) {
51        bits = 0;
52        value = REPEAT_CODE;
53        protocolNum=GICABLE;
54        return true;
55      }
56      if(!decodeGeneric(36, 18*490, 9*490, 490, 9*490, 2205/*(4.5*490)*/)) return false;
57      protocolNum=GICABLE;
58      return true;
59    }
60};
61#endif //IRLIBDECODEBASE_H
62
63#define IRLIB_HAVE_COMBO
64
65#endif //IRLIB_PROTOCOL_09_H
Note: See TracBrowser for help on using the repository browser.