An I/O controller for virtual pinball machines: accelerometer nudge sensing, analog plunger input, button input encoding, LedWiz compatible output controls, and more.

Dependencies:   mbed FastIO FastPWM USBDevice

Fork of Pinscape_Controller by Mike R

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IRProtocols.cpp Source File

IRProtocols.cpp

00001 // IR Protocol handlers
00002 
00003 #include "IRCommand.h"
00004 #include "IRReceiver.h"
00005 #include "IRProtocols.h"
00006 
00007 // -------------------------------------------------------------------------
00008 // 
00009 // IRProtocol base class implementation
00010 //
00011 CircBuf<DebugItem,256> debug;
00012 
00013 // Look up a protocol by ID
00014 IRProtocol *IRProtocol::senderForId(int id)
00015 {
00016     // try each protocol singleton in the sender list
00017     #define IR_PROTOCOL_TX(className) \
00018         if (protocols->s_##className.isSenderFor(id)) \
00019             return &protocols->s_##className;
00020     #include "IRProtocolList.h"
00021     
00022     // not found    
00023     return 0;
00024 }
00025 
00026 // report code with a specific protocol
00027 void IRProtocol::reportCode(
00028     IRRecvProIfc *receiver, int pro, uint64_t code, bool3 toggle, bool3 ditto)
00029 {
00030     IRCommand cmd(pro, code, toggle, ditto);
00031     receiver->writeCommand(cmd);
00032 }
00033 
00034 // protocol handler singletons
00035 IRProtocols *IRProtocol::protocols;
00036 
00037 // allocate the protocol singletons
00038 void IRProtocol::allocProtocols()
00039 {
00040     if (protocols == 0)
00041         protocols = new IRProtocols();
00042 }
00043 
00044 // -------------------------------------------------------------------------
00045 //
00046 // Kaseikyo class implementation.
00047 //
00048 
00049 // OEM <-> subprotocol map
00050 const IRPKaseikyo::OEMMap IRPKaseikyo::oemMap[] = {
00051     { 0x0000, IRPRO_KASEIKYO48, 48 },
00052     { 0x0000, IRPRO_KASEIKYO56, 56 },
00053     { 0x5432, IRPRO_DENONK, 48 },
00054     { 0x1463, IRPRO_FUJITSU48, 48 },
00055     { 0x1463, IRPRO_FUJITSU56, 56 },
00056     { 0x0301, IRPRO_JVC48, 48 },
00057     { 0x0301, IRPRO_JVC56, 56 },
00058     { 0x23CB, IRPRO_MITSUBISHIK, 48 },
00059     { 0x0220, IRPRO_PANASONIC48, 48 },
00060     { 0x0220, IRPRO_PANASONIC56, 56 },
00061     { 0xAA5A, IRPRO_SHARPK, 48 },
00062     { 0x4353, IRPRO_TEACK, 48 }
00063 };
00064 const int IRPKaseikyo::nOemMap = sizeof(oemMap)/sizeof(oemMap[0]);
00065