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

Method decodeSony

src/ir_Sony.hpp:107–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107bool IRrecv::decodeSony() {
108
109 if (!checkHeader_P(&SonyProtocolConstants)) {
110 return false;
111 }
112
113 // Check we have enough data. +2 for initial gap and start bit mark and space minus the last/MSB space. NO stop bit! 26, 32, 42
114 if (!(decodedIRData.rawlen == (2 * SONY_BITS_MIN) + 2 || decodedIRData.rawlen == (2 * SONY_BITS_MAX) + 2
115 || decodedIRData.rawlen == (2 * SONY_BITS_15) + 2)) {
116 DEBUG_PRINT(F("Sony: Data length="));
117 DEBUG_PRINT(decodedIRData.rawlen);
118 DEBUG_PRINTLN(F(" is not 12, 15 or 20"));
119 return false;
120 }
121
122 decodePulseDistanceWidthData_P(&SonyProtocolConstants, (decodedIRData.rawlen - 1) / 2, 3);
123
124 // Success
125// decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value
126 decodedIRData.command = decodedIRData.decodedRawData & 0x7F; // first 7 bits
127 decodedIRData.address = decodedIRData.decodedRawData >> 7; // next 5 or 8 or 13 bits
128 decodedIRData.numberOfBits = (decodedIRData.rawlen - 1) / 2;
129 decodedIRData.protocol = SONY;
130
131 //Check for repeat
132 checkForRepeatSpaceTicksAndSetFlag(SONY_MAXIMUM_REPEAT_DISTANCE / MICROS_PER_TICK);
133
134 return true;
135}
136
137/*********************************************************************************
138 * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected