* Convert 16 bit address and 16 bit command to 32 bit NECRaw data * If we get a command < 0x100, we send command and then ~command * If we get an address < 0x100, we send 8 bit address and then ~address * !!! Be aware, that this is flexible, but makes it impossible to send e.g. 0x0042 as 16 bit value!!! * To force send 16 bit address, use: sendOnkyo(). */
| 155 | * To force send 16 bit address, use: sendOnkyo(). |
| 156 | */ |
| 157 | uint32_t IRsend::computeNECRawDataAndChecksum(uint16_t aAddress, uint16_t aCommand) { |
| 158 | LongUnion tRawData; |
| 159 | |
| 160 | // Address 16 bit LSB first |
| 161 | if ((aAddress & 0xFF00) == 0) { |
| 162 | // assume 8 bit address -> send 8 address bits and then 8 inverted address bits LSB first |
| 163 | tRawData.UByte.LowByte = aAddress; |
| 164 | tRawData.UByte.MidLowByte = ~tRawData.UByte.LowByte; |
| 165 | } else { |
| 166 | tRawData.UWord.LowWord = aAddress; |
| 167 | } |
| 168 | |
| 169 | // send 8 command bits and then 8 inverted command bits LSB first |
| 170 | tRawData.UByte.MidHighByte = aCommand; |
| 171 | tRawData.UByte.HighByte = ~aCommand; |
| 172 | return tRawData.ULong; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * NEC Send frame and special repeats |
nothing calls this directly
no outgoing calls
no test coverage detected