LinuxTux.China 发表于 2020-5-4 11:24:56

一个开源红外软解码代码:IRMP - Infrarot-Multiprotokoll-Decoder

attach://512271.zip

IRMP - Infrarot-Multiprotokoll-Decoder

刚刚看有人问红外解码的代码,我想起以前测试过的一个方案,把代码撸下来放这里备份。

LinuxTux.China 发表于 2020-5-4 11:25:44



LinuxTux.China 发表于 2020-5-4 11:27:45

supported protocols
Protocol        Vendor
A1TVBOX        ADB (Advanced Digital Broadcast), z.B. A1 TV Box
APPLE        Apple
ACP24        Stiebel Eltron
B&O        Bang & Olufsen
BOSE        Bose
DENON        Denon, Sharp
FAN        FAN, remote for fans
FDC        FDC Keyboard
GRUNDIG        Grundig
NOKIA        Nokia, e.g. D-Box
IR60 (SDA2008)        various european vendors
JVC        JVC
KASEIKYO        Panasonic, Technics, Denon and other japanese vendors which are members of the "Japan's Association for Electric Home Application".
KATHREIN        KATHREIN
LEGO        Lego
LGAIR        LG Air Conditioner
MATSUSHITA        Matsushita
MITSU_HEAVY        Mitsubishi Air Conditioner
NEC16        JVC, Daewoo
NEC42        JVC
MERLIN        MERLIN remote (Pollin article number: 620 185)
NEC        NEC, Yamaha, Canon, Tevion, Harman/Kardon, Hitachi, JVC, Pioneer, Toshiba, Xoro, Orion, NoName and many more asian vendors.
NETBOX        Netbox
NIKON        NIKON
NUBERT        Nubert, e.g. Subwoofer Systems
ORTEK        Ortek, Hama
PANASONIC        PANASONIC Beamer
PENTAX        PENTAX
RC5        Philips and other european vendors
RC6A        Philips, Kathrein and others, e.g. XBOX
RC6        Philips and other european vendors
RCCAR        RC Car: IR remote for RC toys
RCII        T+A (NEW!)
RECS80        Philips, Nokia, Thomson, Nordmende, Telefunken, Saba
RECS80EXT        Philips, Technisat, Thomson, Nordmende, Telefunken, Saba
RCMM        Fujitsu-Siemens e.g. Activy keyboard
ROOMBA        iRobot Roomba vacuum cleaner
S100        similar to RC5, but 14 instead of 13 Bits and 56kHz modulation. vendor unknown.
SAMSUNG32        Samsung
SAMSUNG48        various air conditions
SAMSUNG        Samsung
RUWIDO        RUWIDO (e.g. T-Home-Mediareceiver, MERLIN-keyboard(Pollin))
SIEMENS        Siemens, z.B. Gigaset M740AV
SIRCS        Sony
SPEAKER        Speaker Systems like X-Tensions
TECHNICS        Technics
TELEFUNKEN        Telefunken
THOMSON        Thomson
VINCENT        Vincent
Each of these protocols can be activated separately. If you want, you can activate all protocols. If you need only one protocol, you can disable all others. It will only be compiled the code that has been selected by the user.

vtte 发表于 2020-5-4 11:44:30

顶楼主,这个不错,感谢!

了无 发表于 2020-5-4 12:33:58

非常不错,感谢分享

pcwinner 发表于 2020-5-4 13:11:24

感谢分享!!!

srygg 发表于 2020-5-4 13:51:21

谢谢分享!

weiwei4 发表于 2020-5-4 13:53:10

感谢分享开源红外软解码代码,支持的协议还挺多

anguo 发表于 2020-5-4 14:04:13

谢谢分享!

xtaens 发表于 2020-5-4 16:18:28

多谢分享,怎么同一个遥控器的同一个按键,使能不同的解码协议后解出的command不同呢?而且我发现我这个遥控器的数据格式是16位地址+16命令+16位命令,IRMP只解析了8位的命令,这16位的命令我扩展的话容易做到吗?谢谢

比如采用如下配置,得到按键的编码为:
Protocol=SAMSG32, Addr=0xB24D, Cmd=0x29D6
// typical protocols, disable here!             EnableRemarks               F_INTERRUPTS            Program Space
#define IRMP_SUPPORT_SIRCS_PROTOCOL             1       // Sony SIRCS         >= 10000               ~150 bytes
#define IRMP_SUPPORT_NEC_PROTOCOL               1       // NEC + APPLE + ONKYO>= 10000               ~300 bytes
#define IRMP_SUPPORT_SAMSUNG_PROTOCOL         1       // Samsung + Samsg32    >= 10000               ~300 bytes
#define IRMP_SUPPORT_KASEIKYO_PROTOCOL          1       // Kaseikyo             >= 10000               ~250 bytes

// more protocols, enable here!               EnableRemarks               F_INTERRUPTS            Program Space
#define IRMP_SUPPORT_JVC_PROTOCOL               1       // JVC                  >= 10000               ~150 bytes
#define IRMP_SUPPORT_NEC16_PROTOCOL             1       // NEC16                >= 10000               ~100 bytes
#define IRMP_SUPPORT_NEC42_PROTOCOL             1       // NEC42                >= 10000               ~300 bytes
#define IRMP_SUPPORT_MATSUSHITA_PROTOCOL      1       // Matsushita         >= 10000                  ~50 bytes
#define IRMP_SUPPORT_DENON_PROTOCOL             1       // DENON, Sharp         >= 10000               ~250 bytes
#define IRMP_SUPPORT_RC5_PROTOCOL               1       // RC5                  >= 10000               ~250 bytes
#define IRMP_SUPPORT_RC6_PROTOCOL               1       // RC6 & RC6A         >= 10000               ~250 bytes
#define IRMP_SUPPORT_IR60_PROTOCOL            1       // IR60 (SDA2008)       >= 10000               ~300 bytes
#define IRMP_SUPPORT_GRUNDIG_PROTOCOL         1       // Grundig            >= 10000               ~300 bytes
#define IRMP_SUPPORT_SIEMENS_PROTOCOL         1       // Siemens Gigaset      >= 15000               ~550 bytes
#define IRMP_SUPPORT_NOKIA_PROTOCOL             1       // Nokia                >= 10000               ~300 bytes

// exotic protocols, enable here!               EnableRemarks               F_INTERRUPTS            Program Space
#define IRMP_SUPPORT_BOSE_PROTOCOL            0       // BOSE               >= 10000               ~150 bytes
#define IRMP_SUPPORT_KATHREIN_PROTOCOL          0       // Kathrein             >= 10000               ~200 bytes
#define IRMP_SUPPORT_NUBERT_PROTOCOL            0       // NUBERT               >= 10000                  ~50 bytes
#define IRMP_SUPPORT_FAN_PROTOCOL               0       // FAN (ventilator)   >= 10000                  ~50 bytes
#define IRMP_SUPPORT_SPEAKER_PROTOCOL         0       // SPEAKER (~NUBERT)    >= 10000                  ~50 bytes
#define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL      0       // Bang & Olufsen       >= 10000               ~200 bytes
#define IRMP_SUPPORT_RECS80_PROTOCOL            0       // RECS80 (SAA3004)   >= 15000                  ~50 bytes
#define IRMP_SUPPORT_RECS80EXT_PROTOCOL         0       // RECS80EXT (SAA3008)>= 15000                  ~50 bytes
#define IRMP_SUPPORT_THOMSON_PROTOCOL         0       // Thomson            >= 10000               ~250 bytes
#define IRMP_SUPPORT_NIKON_PROTOCOL             0       // NIKON camera         >= 10000               ~250 bytes
#define IRMP_SUPPORT_NETBOX_PROTOCOL            0       // Netbox keyboard      >= 10000               ~400 bytes (PROTOTYPE!)
#define IRMP_SUPPORT_ORTEK_PROTOCOL             0       // ORTEK (Hama)         >= 10000               ~150 bytes
#define IRMP_SUPPORT_TELEFUNKEN_PROTOCOL      0       // Telefunken 1560      >= 10000               ~150 bytes
#define IRMP_SUPPORT_FDC_PROTOCOL               0       // FDC3402 keyboard   >= 10000 (better 15000)~150 bytes (~400 in combination with RC5)
#define IRMP_SUPPORT_RCCAR_PROTOCOL             0       // RC Car               >= 10000 (better 15000)~150 bytes (~500 in combination with RC5)
#define IRMP_SUPPORT_ROOMBA_PROTOCOL            0       // iRobot Roomba      >= 10000               ~150 bytes
#define IRMP_SUPPORT_RUWIDO_PROTOCOL            0       // RUWIDO, T-Home       >= 15000               ~550 bytes
#define IRMP_SUPPORT_A1TVBOX_PROTOCOL         0       // A1 TV BOX            >= 15000 (better 20000)~300 bytes
#define IRMP_SUPPORT_LEGO_PROTOCOL            0       // LEGO Power RC      >= 20000               ~150 bytes
#define IRMP_SUPPORT_RCMM_PROTOCOL            0       // RCMM 12,24, or 32    >= 20000               ~150 bytes
#define IRMP_SUPPORT_LGAIR_PROTOCOL             0       // LG Air Condition   >= 10000               ~300 bytes
#define IRMP_SUPPORT_SAMSUNG48_PROTOCOL         0       // Samsung48            >= 10000               ~100 bytes (SAMSUNG must be enabled!)
#define IRMP_SUPPORT_MERLIN_PROTOCOL            0       // Merlin               >= 15000 (better 20000)~300 bytes
#define IRMP_SUPPORT_PENTAX_PROTOCOL            0       // Pentax               >= 10000               ~150 bytes
#define IRMP_SUPPORT_S100_PROTOCOL            0       // S100               >= 10000               ~250 bytes
#define IRMP_SUPPORT_ACP24_PROTOCOL             0       // ACP24                >= 10000               ~250 bytes
#define IRMP_SUPPORT_TECHNICS_PROTOCOL          0       // TECHNICS             >= 10000               ~250 bytes
#define IRMP_SUPPORT_PANASONIC_PROTOCOL         0       // PANASONIC Beamer   >= 10000               ~250 bytes
#define IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL       0       // Mitsubishi Aircond   >= 10000               ~250 bytes
#define IRMP_SUPPORT_VINCENT_PROTOCOL         0       // VINCENT            >= 10000               ~250 bytes
#define IRMP_SUPPORT_SAMSUNGAH_PROTOCOL         0       // SAMSUNG AH         >= 10000               ~250 bytes
#define IRMP_SUPPORT_IRMP16_PROTOCOL            0       // IRMP specific      >= 15000               ~250 bytes
#define IRMP_SUPPORT_GREE_PROTOCOL            0       // GREE CLIMATE         >= 10000               ~250 bytes
#define IRMP_SUPPORT_RCII_PROTOCOL            0       // RCII T+A             >= 15000               ~250 bytes
#define IRMP_SUPPORT_METZ_PROTOCOL            0       // METZ               >= 15000               ~250 bytes
#define IRMP_SUPPORT_RADIO1_PROTOCOL            0       // RADIO, e.g. TEVION   >= 10000               ~250 bytes (experimental)



Protocol=SAMSG48, Addr=0xB24D, Cmd=0x07D6【协议名称和cmd码与前面的不同】
// typical protocols, disable here!             EnableRemarks               F_INTERRUPTS            Program Space
#define IRMP_SUPPORT_SIRCS_PROTOCOL             1       // Sony SIRCS         >= 10000               ~150 bytes
#define IRMP_SUPPORT_NEC_PROTOCOL               1       // NEC + APPLE + ONKYO>= 10000               ~300 bytes
#define IRMP_SUPPORT_SAMSUNG_PROTOCOL         1       // Samsung + Samsg32    >= 10000               ~300 bytes
#define IRMP_SUPPORT_KASEIKYO_PROTOCOL          1       // Kaseikyo             >= 10000               ~250 bytes

// more protocols, enable here!               EnableRemarks               F_INTERRUPTS            Program Space
#define IRMP_SUPPORT_JVC_PROTOCOL               1       // JVC                  >= 10000               ~150 bytes
#define IRMP_SUPPORT_NEC16_PROTOCOL             1       // NEC16                >= 10000               ~100 bytes
#define IRMP_SUPPORT_NEC42_PROTOCOL             1       // NEC42                >= 10000               ~300 bytes
#define IRMP_SUPPORT_MATSUSHITA_PROTOCOL      1       // Matsushita         >= 10000                  ~50 bytes
#define IRMP_SUPPORT_DENON_PROTOCOL             1       // DENON, Sharp         >= 10000               ~250 bytes
#define IRMP_SUPPORT_RC5_PROTOCOL               1       // RC5                  >= 10000               ~250 bytes
#define IRMP_SUPPORT_RC6_PROTOCOL               1       // RC6 & RC6A         >= 10000               ~250 bytes
#define IRMP_SUPPORT_IR60_PROTOCOL            1       // IR60 (SDA2008)       >= 10000               ~300 bytes
#define IRMP_SUPPORT_GRUNDIG_PROTOCOL         1       // Grundig            >= 10000               ~300 bytes
#define IRMP_SUPPORT_SIEMENS_PROTOCOL         1       // Siemens Gigaset      >= 15000               ~550 bytes
#define IRMP_SUPPORT_NOKIA_PROTOCOL             1       // Nokia                >= 10000               ~300 bytes

// exotic protocols, enable here!               EnableRemarks               F_INTERRUPTS            Program Space
#define IRMP_SUPPORT_BOSE_PROTOCOL            1       // BOSE               >= 10000               ~150 bytes
#define IRMP_SUPPORT_KATHREIN_PROTOCOL          1       // Kathrein             >= 10000               ~200 bytes
#define IRMP_SUPPORT_NUBERT_PROTOCOL            1       // NUBERT               >= 10000                  ~50 bytes
#define IRMP_SUPPORT_FAN_PROTOCOL               1       // FAN (ventilator)   >= 10000                  ~50 bytes
#define IRMP_SUPPORT_SPEAKER_PROTOCOL         1       // SPEAKER (~NUBERT)    >= 10000                  ~50 bytes
#define IRMP_SUPPORT_BANG_OLUFSEN_PROTOCOL      1       // Bang & Olufsen       >= 10000               ~200 bytes
#define IRMP_SUPPORT_RECS80_PROTOCOL            1       // RECS80 (SAA3004)   >= 15000                  ~50 bytes
#define IRMP_SUPPORT_RECS80EXT_PROTOCOL         1       // RECS80EXT (SAA3008)>= 15000                  ~50 bytes
#define IRMP_SUPPORT_THOMSON_PROTOCOL         1       // Thomson            >= 10000               ~250 bytes
#define IRMP_SUPPORT_NIKON_PROTOCOL             1       // NIKON camera         >= 10000               ~250 bytes
#define IRMP_SUPPORT_NETBOX_PROTOCOL            1       // Netbox keyboard      >= 10000               ~400 bytes (PROTOTYPE!)
#define IRMP_SUPPORT_ORTEK_PROTOCOL             1       // ORTEK (Hama)         >= 10000               ~150 bytes
#define IRMP_SUPPORT_TELEFUNKEN_PROTOCOL      1       // Telefunken 1560      >= 10000               ~150 bytes
#define IRMP_SUPPORT_FDC_PROTOCOL               1       // FDC3402 keyboard   >= 10000 (better 15000)~150 bytes (~400 in combination with RC5)
#define IRMP_SUPPORT_RCCAR_PROTOCOL             1       // RC Car               >= 10000 (better 15000)~150 bytes (~500 in combination with RC5)
#define IRMP_SUPPORT_ROOMBA_PROTOCOL            1       // iRobot Roomba      >= 10000               ~150 bytes
#define IRMP_SUPPORT_RUWIDO_PROTOCOL            1       // RUWIDO, T-Home       >= 15000               ~550 bytes
#define IRMP_SUPPORT_A1TVBOX_PROTOCOL         1       // A1 TV BOX            >= 15000 (better 20000)~300 bytes
#define IRMP_SUPPORT_LEGO_PROTOCOL            1       // LEGO Power RC      >= 20000               ~150 bytes
#define IRMP_SUPPORT_RCMM_PROTOCOL            1       // RCMM 12,24, or 32    >= 20000               ~150 bytes
#define IRMP_SUPPORT_LGAIR_PROTOCOL             1       // LG Air Condition   >= 10000               ~300 bytes
#define IRMP_SUPPORT_SAMSUNG48_PROTOCOL         1       // Samsung48            >= 10000               ~100 bytes (SAMSUNG must be enabled!)
#define IRMP_SUPPORT_MERLIN_PROTOCOL            1       // Merlin               >= 15000 (better 20000)~300 bytes
#define IRMP_SUPPORT_PENTAX_PROTOCOL            1       // Pentax               >= 10000               ~150 bytes
#define IRMP_SUPPORT_S100_PROTOCOL            1       // S100               >= 10000               ~250 bytes
#define IRMP_SUPPORT_ACP24_PROTOCOL             1       // ACP24                >= 10000               ~250 bytes
#define IRMP_SUPPORT_TECHNICS_PROTOCOL          1       // TECHNICS             >= 10000               ~250 bytes
#define IRMP_SUPPORT_PANASONIC_PROTOCOL         1       // PANASONIC Beamer   >= 10000               ~250 bytes
#define IRMP_SUPPORT_MITSU_HEAVY_PROTOCOL       1       // Mitsubishi Aircond   >= 10000               ~250 bytes
#define IRMP_SUPPORT_VINCENT_PROTOCOL         1       // VINCENT            >= 10000               ~250 bytes
#define IRMP_SUPPORT_SAMSUNGAH_PROTOCOL         1       // SAMSUNG AH         >= 10000               ~250 bytes
#define IRMP_SUPPORT_IRMP16_PROTOCOL            1       // IRMP specific      >= 15000               ~250 bytes
#define IRMP_SUPPORT_GREE_PROTOCOL            1       // GREE CLIMATE         >= 10000               ~250 bytes
#define IRMP_SUPPORT_RCII_PROTOCOL            1       // RCII T+A             >= 15000               ~250 bytes
#define IRMP_SUPPORT_METZ_PROTOCOL            1       // METZ               >= 15000               ~250 bytes
#define IRMP_SUPPORT_RADIO1_PROTOCOL            1       // RADIO, e.g. TEVION   >= 10000               ~250 bytes (experimental)

alding123 发表于 2020-5-4 16:30:07

顶楼主,以前也做过红外解码,做通用的还是停累的!

wanggoals 发表于 2020-5-4 22:41:22

这个不错,20年前曾经搞过空调自学习遥控。
额,我真老了。。。

hall 发表于 2020-5-4 23:10:56

用过这个,很方便

9509238 发表于 2020-5-4 23:13:45

这不是一个老帖子的内容吗?又翻出来了。
https://www.amobbs.com/forum.php?mod=viewthread&tid=5596999&highlight=%E7%

LinuxTux.China 发表于 2020-5-4 23:45:21

9509238 发表于 2020-5-4 23:13
这不是一个老帖子的内容吗?又翻出来了。
https://www.amobbs.com/forum.php?mod=viewthread&tid=5596999&h ...

果然,挖坟了
页: [1]
查看完整版本: 一个开源红外软解码代码:IRMP - Infrarot-Multiprotokoll-Decoder