Mirror with some correction
Dependencies: mbed FastIO FastPWM USBDevice
IRRemote/IRProtocols.cpp@116:7a67265d7c19, 2021-10-01 (annotated)
- Committer:
- arnoz
- Date:
- Fri Oct 01 08:19:46 2021 +0000
- Revision:
- 116:7a67265d7c19
- Parent:
- 77:0b96f6867312
- Correct information regarding your last merge
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mjr | 77:0b96f6867312 | 1 | // IR Protocol handlers |
mjr | 77:0b96f6867312 | 2 | |
mjr | 77:0b96f6867312 | 3 | #include "IRCommand.h" |
mjr | 77:0b96f6867312 | 4 | #include "IRReceiver.h" |
mjr | 77:0b96f6867312 | 5 | #include "IRProtocols.h" |
mjr | 77:0b96f6867312 | 6 | |
mjr | 77:0b96f6867312 | 7 | // ------------------------------------------------------------------------- |
mjr | 77:0b96f6867312 | 8 | // |
mjr | 77:0b96f6867312 | 9 | // IRProtocol base class implementation |
mjr | 77:0b96f6867312 | 10 | // |
mjr | 77:0b96f6867312 | 11 | CircBuf<DebugItem,256> debug; |
mjr | 77:0b96f6867312 | 12 | |
mjr | 77:0b96f6867312 | 13 | // Look up a protocol by ID |
mjr | 77:0b96f6867312 | 14 | IRProtocol *IRProtocol::senderForId(int id) |
mjr | 77:0b96f6867312 | 15 | { |
mjr | 77:0b96f6867312 | 16 | // try each protocol singleton in the sender list |
mjr | 77:0b96f6867312 | 17 | #define IR_PROTOCOL_TX(className) \ |
mjr | 77:0b96f6867312 | 18 | if (protocols->s_##className.isSenderFor(id)) \ |
mjr | 77:0b96f6867312 | 19 | return &protocols->s_##className; |
mjr | 77:0b96f6867312 | 20 | #include "IRProtocolList.h" |
mjr | 77:0b96f6867312 | 21 | |
mjr | 77:0b96f6867312 | 22 | // not found |
mjr | 77:0b96f6867312 | 23 | return 0; |
mjr | 77:0b96f6867312 | 24 | } |
mjr | 77:0b96f6867312 | 25 | |
mjr | 77:0b96f6867312 | 26 | // report code with a specific protocol |
mjr | 77:0b96f6867312 | 27 | void IRProtocol::reportCode( |
mjr | 77:0b96f6867312 | 28 | IRRecvProIfc *receiver, int pro, uint64_t code, bool3 toggle, bool3 ditto) |
mjr | 77:0b96f6867312 | 29 | { |
mjr | 77:0b96f6867312 | 30 | IRCommand cmd(pro, code, toggle, ditto); |
mjr | 77:0b96f6867312 | 31 | receiver->writeCommand(cmd); |
mjr | 77:0b96f6867312 | 32 | } |
mjr | 77:0b96f6867312 | 33 | |
mjr | 77:0b96f6867312 | 34 | // protocol handler singletons |
mjr | 77:0b96f6867312 | 35 | IRProtocols *IRProtocol::protocols; |
mjr | 77:0b96f6867312 | 36 | |
mjr | 77:0b96f6867312 | 37 | // allocate the protocol singletons |
mjr | 77:0b96f6867312 | 38 | void IRProtocol::allocProtocols() |
mjr | 77:0b96f6867312 | 39 | { |
mjr | 77:0b96f6867312 | 40 | if (protocols == 0) |
mjr | 77:0b96f6867312 | 41 | protocols = new IRProtocols(); |
mjr | 77:0b96f6867312 | 42 | } |
mjr | 77:0b96f6867312 | 43 | |
mjr | 77:0b96f6867312 | 44 | // ------------------------------------------------------------------------- |
mjr | 77:0b96f6867312 | 45 | // |
mjr | 77:0b96f6867312 | 46 | // Kaseikyo class implementation. |
mjr | 77:0b96f6867312 | 47 | // |
mjr | 77:0b96f6867312 | 48 | |
mjr | 77:0b96f6867312 | 49 | // OEM <-> subprotocol map |
mjr | 77:0b96f6867312 | 50 | const IRPKaseikyo::OEMMap IRPKaseikyo::oemMap[] = { |
mjr | 77:0b96f6867312 | 51 | { 0x0000, IRPRO_KASEIKYO48, 48 }, |
mjr | 77:0b96f6867312 | 52 | { 0x0000, IRPRO_KASEIKYO56, 56 }, |
mjr | 77:0b96f6867312 | 53 | { 0x5432, IRPRO_DENONK, 48 }, |
mjr | 77:0b96f6867312 | 54 | { 0x1463, IRPRO_FUJITSU48, 48 }, |
mjr | 77:0b96f6867312 | 55 | { 0x1463, IRPRO_FUJITSU56, 56 }, |
mjr | 77:0b96f6867312 | 56 | { 0x0301, IRPRO_JVC48, 48 }, |
mjr | 77:0b96f6867312 | 57 | { 0x0301, IRPRO_JVC56, 56 }, |
mjr | 77:0b96f6867312 | 58 | { 0x23CB, IRPRO_MITSUBISHIK, 48 }, |
mjr | 77:0b96f6867312 | 59 | { 0x0220, IRPRO_PANASONIC48, 48 }, |
mjr | 77:0b96f6867312 | 60 | { 0x0220, IRPRO_PANASONIC56, 56 }, |
mjr | 77:0b96f6867312 | 61 | { 0xAA5A, IRPRO_SHARPK, 48 }, |
mjr | 77:0b96f6867312 | 62 | { 0x4353, IRPRO_TEACK, 48 } |
mjr | 77:0b96f6867312 | 63 | }; |
mjr | 77:0b96f6867312 | 64 | const int IRPKaseikyo::nOemMap = sizeof(oemMap)/sizeof(oemMap[0]); |
mjr | 77:0b96f6867312 | 65 |