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

Method sendSamsung48

src/ir_Samsung.hpp:234–263  ·  view source on GitHub ↗

* Here we send Samsung48 * We send 2 x (8 bit command and then ~command) */

Source from the content-addressed store, hash-verified

232 * We send 2 x (8 bit command and then ~command)
233 */
234void IRsend::sendSamsung48(uint16_t aAddress, uint32_t aCommand, int_fast8_t aNumberOfRepeats) {
235
236 // send 16 bit address and 2 x ( 8 command bits and then 8 inverted command bits) LSB first
237#if __INT_WIDTH__ < 32
238 uint32_t tRawSamsungData[2]; // prepare 2 long for Samsung48
239
240 LongUnion tSendValue;
241 tSendValue.UWords[0] = aAddress;
242 tSendValue.UBytes[2] = aCommand;
243 tSendValue.UBytes[3] = ~aCommand;
244 uint8_t tUpper8BitsOfCommand = aCommand >> 8;
245 tRawSamsungData[1] = tUpper8BitsOfCommand | (~tUpper8BitsOfCommand) << 8;
246 tRawSamsungData[0] = tSendValue.ULong;
247
248 sendPulseDistanceWidthFromArray_P(&SamsungProtocolConstants, &tRawSamsungData[0], SAMSUNG48_BITS, aNumberOfRepeats);
249#else
250 LongLongUnion tSendValue;
251 tSendValue.UWords[0] = aAddress;
252 if (aCommand < 0x10000) {
253 tSendValue.UBytes[2] = aCommand;
254 tSendValue.UBytes[3] = ~aCommand;
255 uint8_t tUpper8BitsOfCommand = aCommand >> 8;
256 tSendValue.UBytes[4] = tUpper8BitsOfCommand;
257 tSendValue.UBytes[5] = ~tUpper8BitsOfCommand;
258 } else {
259 tSendValue.ULongLong = aAddress | aCommand << 16;
260 }
261 sendPulseDistanceWidth_P(&SamsungProtocolConstants, tSendValue.ULongLong, SAMSUNG48_BITS, aNumberOfRepeats);
262#endif
263}
264
265/*
266 * We cannot decode frames with 8 command bits and then 8 inverted command bits LSB and 16 bit address,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected