M5Unit-INFRARED 0.2.0 git rev:76ad9e1
Loading...
Searching...
No Matches
m5::unit::ir::MitsubishiCodec Class Reference

Mitsubishi 16-bit IR protocol encoder/decoder. More...

#include <mitsubishi_codec.hpp>

Inheritance diagram for m5::unit::ir::MitsubishiCodec:
m5::unit::ir::IRCodec

Public Member Functions

 MitsubishiCodec ()
 Constructor.
 
item_container_type encode (uint16_t address, uint16_t command, bool repeat) override
 Encode a single 16-bit Mitsubishi frame (UnitIR::send() replicates per minFrames())
 
bool decode (const gpio::m5_rmt_item_t *items, uint32_t num, DecodeResult &result) override
 Decode a single 16-bit Mitsubishi frame (16 data items + trailing stop mark)
 
uint32_t carrierFrequencyHz () const override
 Carrier frequency for Mitsubishi (33 kHz)
 
uint8_t minFrames () const override
 Mitsubishi requires the frame to be sent twice per keypress.
 
uint16_t frameGapUs () const override
 Inter-frame gap ≈ 28.5 ms as used by real Mitsubishi remotes.
 
- Public Member Functions inherited from m5::unit::ir::IRCodec
 IRCodec (CodecType t)
 
CodecType type () const
 Get codec type for safe downcasting.
 
virtual float carrierDuty () const
 Carrier duty cycle (0.0 - 1.0)
 
virtual bool decode (const m5::unit::gpio::m5_rmt_item_t *items, uint32_t num, DecodeResult &result)=0
 Try to decode RMT items into an IR command.
 

Detailed Description

Mitsubishi 16-bit IR protocol encoder/decoder.

  • Carrier: 33 kHz
  • Modulation: Pulse Distance (no leader/header)
  • Bit order: MSB first
  • 16 bits, data sent twice with ~28ms gap
  • No leader pulse (data starts immediately)
Timing
Element Mark (us) Space (us)
Bit "1" 300 2100
Bit "0" 300 900
Stop 300 -
Gap - ~28500
API mapping
  • address = 0 (unused)
  • command = full 16-bit data value
Note
encode() emits a single 16-bit frame. Real Mitsubishi remotes always send the frame twice per keypress, so minFrames() returns 2 and UnitIR::send() replicates the frame automatically (with frameGapUs() ≈ 28.5ms between them).

Member Function Documentation

◆ carrierFrequencyHz()

uint32_t m5::unit::ir::MitsubishiCodec::carrierFrequencyHz ( ) const
inlineoverridevirtual

Carrier frequency for Mitsubishi (33 kHz)

Implements m5::unit::ir::IRCodec.

◆ encode()

item_container_type m5::unit::ir::MitsubishiCodec::encode ( uint16_t address,
uint16_t command,
bool repeat )
overridevirtual

Encode a single 16-bit Mitsubishi frame (UnitIR::send() replicates per minFrames())

Implements m5::unit::ir::IRCodec.

◆ frameGapUs()

uint16_t m5::unit::ir::MitsubishiCodec::frameGapUs ( ) const
inlineoverridevirtual

Inter-frame gap ≈ 28.5 ms as used by real Mitsubishi remotes.

Reimplemented from m5::unit::ir::IRCodec.

◆ minFrames()

uint8_t m5::unit::ir::MitsubishiCodec::minFrames ( ) const
inlineoverridevirtual

Mitsubishi requires the frame to be sent twice per keypress.

Reimplemented from m5::unit::ir::IRCodec.