Go to the documentation of this file.
32 #ifndef _IR_SAMSUNG_HPP
33 #define _IR_SAMSUNG_HPP
35 #if defined(DEBUG) && !defined(LOCAL_DEBUG)
79 #define SAMSUNG_ADDRESS_BITS 16
80 #define SAMSUNG_COMMAND16_BITS 16
81 #define SAMSUNG_COMMAND32_BITS 32
82 #define SAMSUNG_BITS (SAMSUNG_ADDRESS_BITS + SAMSUNG_COMMAND16_BITS)
83 #define SAMSUNG48_BITS (SAMSUNG_ADDRESS_BITS + SAMSUNG_COMMAND32_BITS)
86 #define SAMSUNG_UNIT 560 // 21.28 periods of 38 kHz, 11.2 ticks TICKS_LOW = 8.358 TICKS_HIGH = 15.0
87 #define SAMSUNG_HEADER_MARK (8 * SAMSUNG_UNIT) // 4500 | 180
88 #define SAMSUNG_HEADER_SPACE (8 * SAMSUNG_UNIT) // 4500
89 #define SAMSUNG_BIT_MARK SAMSUNG_UNIT
90 #define SAMSUNG_ONE_SPACE (3 * SAMSUNG_UNIT) // 1690 | 33.8 TICKS_LOW = 25.07 TICKS_HIGH = 45.0
91 #define SAMSUNG_ZERO_SPACE SAMSUNG_UNIT
93 #define SAMSUNG_AVERAGE_DURATION 55000 // SAMSUNG_HEADER_MARK + SAMSUNG_HEADER_SPACE + 32 * 2,5 * SAMSUNG_UNIT + SAMSUNG_UNIT // 2.5 because we assume more zeros than ones
94 #define SAMSUNG_REPEAT_DURATION (SAMSUNG_HEADER_MARK + SAMSUNG_HEADER_SPACE + SAMSUNG_BIT_MARK + SAMSUNG_ZERO_SPACE + SAMSUNG_BIT_MARK)
95 #define SAMSUNG_REPEAT_PERIOD 110000 // Commands are repeated every 110 ms (measured from start to start) for as long as the key on the remote control is held down.
96 #define SAMSUNG_REPEAT_DISTANCE (SAMSUNG_REPEAT_PERIOD - SAMSUNG_AVERAGE_DURATION)
118 #if !defined(DISABLE_CODE_FOR_RECEIVER)
134 #if !defined(DISABLE_CODE_FOR_RECEIVER)
166 tSendValue.
UWords[0] = aAddress;
184 #if __INT_WIDTH__ < 32
185 uint32_t tRawSamsungData[2];
188 tSendValue.
UWords[0] = aAddress;
191 uint8_t tUpper8BitsOfCommand =
aCommand >> 8;
192 tRawSamsungData[1] = tUpper8BitsOfCommand | (~tUpper8BitsOfCommand) << 8;
193 tRawSamsungData[0] = tSendValue.
ULong;
198 tSendValue.
UWords[0] = aAddress;
202 uint8_t tUpper8BitsOfCommand =
aCommand >> 8;
203 tSendValue.
UBytes[4] = tUpper8BitsOfCommand;
204 tSendValue.
UBytes[5] = ~tUpper8BitsOfCommand;
241 #if defined(LOCAL_DEBUG)
242 Serial.print(F(
"Samsung: "));
243 Serial.println(F(
"Decode failed"));
258 #if defined(LOCAL_DEBUG)
259 Serial.print(F(
"Samsung: "));
260 Serial.println(F(
"Decode failed"));
270 #if __INT_WIDTH__ >= 32
311 unsigned int offset = 1;
323 aResults->
value = 0xFFFFFFFF;
363 #if !defined(DISABLE_CODE_FOR_RECEIVER)
369 #if defined(LOCAL_DEBUG)
372 #endif // _IR_SAMSUNG_HPP
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
Union to specify parts / manifestations of a 32 bit Long without casts and shifts.
#define SAMSUNG_HEADER_SPACE
Results returned from old decoders !!!deprecated!!!
#define SAMSUNG_REPEAT_DISTANCE
#define PROTOCOL_IS_MSB_FIRST
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
void uint8_t int_fast8_t aNumberOfRepeats
#define MICROS_IN_ONE_MILLI
struct LongUnion::@4 UByte
struct PulseDistanceWidthProtocolConstants SamsungProtocolConstants
void mark(unsigned int aMarkMicros)
Sends an IR mark for the specified number of microseconds.
void sendSamsungLGRepeat()
Send repeat Repeat commands should be sent in a 110 ms raster.
#define IRDATA_FLAGS_IS_REPEAT
void restartAfterSend()
Restarts receiver after send.
void sendPulseDistanceWidth(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
Sends PulseDistance frames and repeats.
irparams_struct * rawDataPtr
Pointer of the raw timing data to be decoded. Mainly the OverflowFlag and the data buffer filled by r...
decode_type_t decode_type
IRRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send functions.
#define IR_DEBUG_PRINT(...)
If DEBUG, print the arguments, otherwise do nothing.
uint_fast8_t rawlen
counter of entries in rawbuf
Union to specify parts / manifestations of a 64 bit LongLong without casts and shifts.
bool decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits, uint_fast8_t aStartOffset=3)
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants.
void sendSamsung(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
Here we send Samsung32 If we get a command < 0x100, we send command and then ~command.
#define IRDATA_FLAGS_PARITY_FAILED
the current (autorepeat) frame violated parity check
bool decodeSAMSUNG(decode_results *aResults)
bool matchSpace(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
Compensate for spaces shortened by demodulator hardware.
void sendPulseDistanceWidthFromArray(uint_fast8_t aFrequencyKHz, unsigned int aHeaderMarkMicros, unsigned int aHeaderSpaceMicros, unsigned int aOneMarkMicros, unsigned int aOneSpaceMicros, unsigned int aZeroMarkMicros, unsigned int aZeroSpaceMicros, IRRawDataType *aDecodedRawDataArray, unsigned int aNumberOfBits, bool aMSBfirst, bool aSendStopBit, unsigned int aRepeatPeriodMillis, int_fast8_t aNumberOfRepeats)
Sends PulseDistance data from array For LSB First the LSB of array[0] is sent first then all bits unt...
uint8_t flags
See IRDATA_FLAGS_* definitions above.
void sendSamsungLG(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
#define PROTOCOL_IS_LSB_FIRST
void sendSamsungLGSpecialRepeat()
Static function for sending special repeat frame.
void checkForRepeatSpaceAndSetFlag(unsigned int aMediumRepeatSpaceMicros)
bool checkHeader(PulseDistanceWidthProtocolConstants *aProtocolConstants)
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
#define SAMSUNG_COMMAND16_BITS
#define SAMSUNG_ZERO_SPACE
uint32_t lastDecodedCommand
static void space(unsigned int aSpaceMicros)
Sends an IR space for the specified number of microseconds.
#define IRDATA_FLAGS_IS_LSB_FIRST
#define SAMSUNG_REPEAT_PERIOD
#define SAMSUNG_HEADER_MARK
void sendSamsung48(uint16_t aAddress, uint16_t aCommand, int_fast8_t aNumberOfRepeats)
Here we send Samsung48 We send 2 x (8 bit command and then ~command)
#define SAMSUNG_COMMAND32_BITS
#define SAMSUNG_ONE_SPACE
void sendSAMSUNG(unsigned long data, int nbits)
struct LongUnion::@6 UWord
void sendPulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits)
Sends PulseDistance data The output always ends with a space Each additional call costs 16 bytes prog...
uint32_t lastDecodedAddress
#define IR_DEBUG_PRINTLN(...)
If DEBUG, print the arguments as a line, otherwise do nothing.
bool matchMark(unsigned int aMeasuredTicks, unsigned int aMatchValueMicros)
Compensate for marks exceeded by demodulator hardware.
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
if(irparams.TickCounterForISR< UINT16_MAX)
IRrecv IrReceiver
The receiver instance.
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.