* Here we send Samsung32 * 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 the same 8 bit address again, this makes it flipper IRDB compatible * !!! 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: sendSamsung16BitAddressAndCommand().
| 170 | * @param aNumberOfRepeats If < 0 then only a special repeat frame will be sent |
| 171 | */ |
| 172 | void IRsend::sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats) { |
| 173 | |
| 174 | LongUnion tSendValue; |
| 175 | if (aAddress < 0x100) { |
| 176 | // This makes it flipper IRDB compatible: |
| 177 | // https://github.com/flipperdevices/flipperzero-firmware/blob/master/lib/infrared/encoder_decoder/samsung/infrared_decoder_samsung.c#L18 |
| 178 | // Duplicate address byte, if address is only 8 bit |
| 179 | tSendValue.UBytes[1] = aAddress; |
| 180 | tSendValue.UBytes[0] = aAddress; |
| 181 | } else { |
| 182 | tSendValue.UWords[0] = aAddress; |
| 183 | } |
| 184 | |
| 185 | if (aCommand < 0x100) { |
| 186 | // Send 8 command bits and then 8 inverted command bits LSB first |
| 187 | tSendValue.UBytes[2] = aCommand; |
| 188 | tSendValue.UBytes[3] = ~aCommand; |
| 189 | |
| 190 | } else { |
| 191 | // Send 16 command bits |
| 192 | tSendValue.UWords[1] = aCommand; |
| 193 | } |
| 194 | |
| 195 | sendPulseDistanceWidth_P(&SamsungProtocolConstants, tSendValue.ULong, SAMSUNG_BITS, aNumberOfRepeats); |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Maybe no one needs it in the wild... |
nothing calls this directly
no outgoing calls
no test coverage detected