Go to the documentation of this file.
33 #if defined(DEBUG) && !defined(LOCAL_DEBUG)
75 #define SONY_ADDRESS_BITS 5
76 #define SONY_COMMAND_BITS 7
77 #define SONY_EXTRA_BITS 8
78 #define SONY_BITS_MIN (SONY_COMMAND_BITS + SONY_ADDRESS_BITS) // 12 bits
79 #define SONY_BITS_15 (SONY_COMMAND_BITS + SONY_ADDRESS_BITS + 3) // 15 bits
80 #define SONY_BITS_MAX (SONY_COMMAND_BITS + SONY_ADDRESS_BITS + SONY_EXTRA_BITS) // 20 bits == SIRCS_20_PROTOCOL
81 #define SONY_UNIT 600 // 24 periods of 40kHz
83 #define SONY_HEADER_MARK (4 * SONY_UNIT) // 2400
84 #define SONY_ONE_MARK (2 * SONY_UNIT) // 1200
85 #define SONY_ZERO_MARK SONY_UNIT
86 #define SONY_SPACE SONY_UNIT
88 #define SONY_AVERAGE_DURATION_MIN 21000 // SONY_HEADER_MARK + SONY_SPACE + 12 * 2,5 * SONY_UNIT // 2.5 because we assume more zeros than ones
89 #define SONY_AVERAGE_DURATION_MAX 33000 // SONY_HEADER_MARK + SONY_SPACE + 20 * 2,5 * SONY_UNIT // 2.5 because we assume more zeros than ones
90 #define SONY_REPEAT_PERIOD 45000 // Commands are repeated every 45 ms (measured from start to start) for as long as the key on the remote control is held down.
91 #define SONY_MAXIMUM_REPEAT_DISTANCE (SONY_REPEAT_PERIOD - SONY_AVERAGE_DURATION_MIN) // 24 ms
103 void IRsend::sendSony(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint8_t numberOfBits) {
104 uint32_t tData = (uint32_t) aAddress << 7 | (
aCommand & 0x7F);
126 #if defined(LOCAL_DEBUG)
127 Serial.print(F(
"Sony: "));
128 Serial.println(F(
"Decode failed"));
153 #define SONY_DOUBLE_SPACE_USECS 500 // usually see 713 - not using ticks as get number wrap around
157 unsigned int offset = 0;
166 #if defined(LOCAL_DEBUG)
167 Serial.println(F(
"IR Gap found"));
170 aResults->
value = 0xFFFFFFFF;
184 while (offset + 1 < aResults->
rawlen) {
195 data = (data << 1) | 1;
197 data = (data << 1) | 0;
206 aResults->
bits = bits;
207 aResults->
value = data;
232 #if defined(LOCAL_DEBUG)
235 #endif // _IR_SONY_HPP
uint16_t address
Decoded address, Distance protocol (tMarkTicksLong (if tMarkTicksLong == 0, then tMarkTicksShort) << ...
#define MICROS_PER_TICK
microseconds per clock interrupt tick
Results returned from old decoders !!!deprecated!!!
#define PROTOCOL_IS_MSB_FIRST
uint16_t numberOfBits
Number of bits received for data (address + command + parity) - to determine protocol length if diffe...
void int_fast8_t aNumberOfRepeats
#define MICROS_IN_ONE_MILLI
void sendSony(uint16_t aAddress, uint8_t aCommand, int_fast8_t aNumberOfRepeats, uint8_t numberOfBits=12)
void mark(uint16_t aMarkMicros)
Sends an IR mark for the specified number of microseconds.
#define SONY_MAXIMUM_REPEAT_DISTANCE
#define SONY_DOUBLE_SPACE_USECS
#define IRDATA_FLAGS_IS_REPEAT
The gap between the preceding frame is as smaller than the maximum gap expected for a repeat....
void sendPulseDistanceWidth(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits, int_fast8_t aNumberOfRepeats)
Sends PulseDistance frames and repeats.
decode_type_t decode_type
IRRawDataType decodedRawData
Up to 32/64 bit decoded raw data, to be used for send functions.
void checkForRepeatSpaceTicksAndSetFlag(uint16_t aMaximumRepeatSpaceTicks)
#define IR_DEBUG_PRINT(...)
If DEBUG, print the arguments, otherwise do nothing.
bool decodeSonyMSB(decode_results *aResults)
bool matchSpace(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Compensate for spaces shortened by demodulator hardware.
uint8_t flags
IRDATA_FLAGS_IS_REPEAT, IRDATA_FLAGS_WAS_OVERFLOW etc. See IRDATA_FLAGS_* definitions above.
#define PROTOCOL_IS_LSB_FIRST
bool checkHeader(PulseDistanceWidthProtocolConstants *aProtocolConstants)
bool decodePulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, uint_fast8_t aNumberOfBits, IRRawlenType aStartOffset=3)
Decode pulse distance protocols for PulseDistanceWidthProtocolConstants.
uint16_t command
Decoded command, Distance protocol (tMarkTicksShort << 8) | tSpaceTicksShort.
bool matchMark(uint16_t aMeasuredTicks, uint16_t aMatchValueMicros)
Compensate for marks exceeded by demodulator hardware.
struct PulseDistanceWidthProtocolConstants SonyProtocolConstants
void sendSonyMSB(unsigned long data, int nbits)
Old version with MSB first data.
static void space(uint16_t aSpaceMicros)
Sends an IR space for the specified number of microseconds.
IRRawlenType rawlen
counter of entries in rawbuf of last received frame.
#define SONY_REPEAT_PERIOD
void sendPulseDistanceWidthData(PulseDistanceWidthProtocolConstants *aProtocolConstants, IRRawDataType aData, uint_fast8_t aNumberOfBits)
Sends PulseDistance from data contained in parameter using ProtocolConstants structure for timing etc...
#define IR_DEBUG_PRINTLN(...)
If DEBUG, print the arguments as a line, otherwise do nothing.
decode_type_t protocol
UNKNOWN, NEC, SONY, RC5, PULSE_DISTANCE, ...
void enableIROut(uint_fast8_t aFrequencyKHz)
Enables IR output.