V1/Toolbox.NETMF.Hardware.InfraredTX/InfraredCodecRC5.cs
/// <summary>
/// Send a RC-5 message
/// </summary>
/// <param name="address">Specifies the address in the message</param>
/// <param name="command">Specifies the command to be sent</param>
Send a RC-5 message
Send a RC - 5 message
public void Send(
            int address,
            int command)
        {
            this.Modulate(true);
            if (this.ExtendedMode)
            {
                this.Modulate((command & 0x40) == 0);
            }
            else
            {
                this.Modulate(true);
            }
            this.Modulate(this._toggle);
            this._toggle = !this._toggle;
            for (int i = 0; i < 5; i++)
            {
                this.Modulate((address & 0x10) != 0);
                address <<= 1;
            }
            for (int i = 0; i < 6; i++)
            {
                this.Modulate((command & 0x20) != 0);
                command <<= 1;
            }
            this.Transmitter
                .Send(this);
        }
public void Send ( int address , int command ) { this . Modulate ( true ) ; if ( this . ExtendedMode ) { this . Modulate ( ( command & 0x40 ) == 0 ) ; } else { this . Modulate ( true ) ; } this . Modulate ( this . _toggle ) ; this . _toggle = ! this . _toggle ; for ( int i = 0 ; i < 5 ; i ++ ) { this . Modulate ( ( address & 0x10 ) != 0 ) ; address <<= 1 ; } for ( int i = 0 ; i < 6 ; i ++ ) { this . Modulate ( ( command & 0x20 ) != 0 ) ; command <<= 1 ; } this . Transmitter . Send ( this ) ; }
Send a RC-5 message
Send a RC - 5 message
//S1: always "ONE" //place the 7th command bit, but inverted //S2: always "ONE" //toggle //address (5 bits, MSB first) //command (6 bits, MSB first) //send
address
int
Specifies the address in the message
Specifies the address in the message
command
int
Specifies the command to be sent
Specifies the command to be sent