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

Philips RC6 Mode 0 IR protocol encoder/decoder. More...

#include <rc6_codec.hpp>

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

Public Member Functions

 Rc6Codec ()
 Constructor.
 
item_container_type encode (uint16_t address, uint16_t command, bool repeat) override
 Encode an RC6 Mode 0 frame (21 bits: SB+Mode+Trailer+Addr+Cmd)
 
bool decode (const gpio::m5_rmt_item_t *items, uint32_t num, DecodeResult &result) override
 Decode an RC6 Mode 0 Manchester frame (with 2t-wide trailer bit)
 
uint32_t carrierFrequencyHz () const override
 Carrier frequency for RC6 (36 kHz)
 
bool toggle () const
 Toggle bit state.
 
void setToggle (bool t)
 Set toggle bit.
 
void flipToggle ()
 Flip toggle bit.
 
- 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 uint8_t minFrames () const
 Number of frames that should be transmitted per keypress for this protocol.
 
virtual uint16_t frameGapUs () const
 Inter-frame gap (microseconds) when transmitting multiple frames in one burst.
 
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

Philips RC6 Mode 0 IR protocol encoder/decoder.

  • Carrier: 36 kHz, duty 1/3
  • Modulation: Manchester (bi-phase), opposite polarity to RC5
  • 1t = 444us (16 cycles of 36kHz)
  • Leader: 6t mark + 2t space
  • Frame: SB(1) + Mode(3) + Trailer(1,2t) + Address(8) + Command(8) = 21 bits
  • RC6 polarity: "0" = space+mark, "1" = mark+space (opposite of RC5)
  • Trailer bit uses 2t half-bit width (double the normal 1t)

Member Function Documentation

◆ carrierFrequencyHz()

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

Carrier frequency for RC6 (36 kHz)

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

◆ encode()

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

Encode an RC6 Mode 0 frame (21 bits: SB+Mode+Trailer+Addr+Cmd)

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

◆ setToggle()

void m5::unit::ir::Rc6Codec::setToggle ( bool t)
inline

Set toggle bit.

Parameters
tNew toggle value; the next encode() emits this bit as the trailer

◆ toggle()

bool m5::unit::ir::Rc6Codec::toggle ( ) const
inline

Toggle bit state.

Returns
Current toggle (trailer-bit) value