MCPcopy Create free account
hub / github.com/Arduino-IRremote/Arduino-IRremote / sendSamsung

Method sendSamsung

src/ir_Samsung.hpp:172–196  ·  view source on GitHub ↗

* 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().

Source from the content-addressed store, hash-verified

170 * @param aNumberOfRepeats If < 0 then only a special repeat frame will be sent
171 */
172void 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...

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected