Skip to main content

You are here

InfraredPlug NEC Decoder

1 post / 0 new
marekj
InfraredPlug NEC Decoder

Hi,

I had a look at the NEC decoding of the Ports library and I wondered whether it assumes most-siginificant bits first or LSB? It looks like MSB to me, new bits are pushed into v from right:

uint8_t InfraredPlug::decoder(uint8_t nibbles) { ... for (byte i = 0; i < 4; ++i) { byte v; for (byte j = 0; j < 8; ++j) v = (v << 1) | (buf[1+j+8*i] >> 5); buf[i] = v; }

However, http://www.sbprojects.com/knowledge/ir/nec.php I saw that the NEC protocol transmits LSB first. They say the same: http://wiki.altium.com/display/ADOH/NEC+Infrared+Transmission+Protocol

So am I reading the code wrong?

Cheers, Marek

Premium Drupal Themes by Adaptivethemes