| 94 | } |
| 95 | |
| 96 | bool IRrecv::decodeFAST() { |
| 97 | |
| 98 | // uint_fast8_t tRawlen = decodedIRData.rawlen; // Using a local variable does not improve code size |
| 99 | |
| 100 | // Check we have the right amount of data (36). The +4 is for initial gap, start bit mark and space + stop bit mark. |
| 101 | if (decodedIRData.rawlen != ((2 * FAST_BITS) + 4)) { |
| 102 | DEBUG_PRINT(F("FAST: Data length=")); |
| 103 | DEBUG_PRINT(decodedIRData.rawlen); |
| 104 | DEBUG_PRINTLN(F(" is not 36")); |
| 105 | return false; |
| 106 | } |
| 107 | |
| 108 | if (!checkHeader_P(&FASTProtocolConstants)) { |
| 109 | return false; |
| 110 | } |
| 111 | |
| 112 | decodePulseDistanceWidthData_P(&FASTProtocolConstants, FAST_BITS); |
| 113 | WordUnion tValue; |
| 114 | tValue.UWord = decodedIRData.decodedRawData; |
| 115 | |
| 116 | if (tValue.UByte.LowByte != (uint8_t) ~(tValue.UByte.HighByte)) { |
| 117 | DEBUG_PRINT(F("FAST: 8 bit parity is not correct. Expected=0x")); |
| 118 | DEBUG_PRINT((uint8_t) ~(tValue.UByte.LowByte), HEX); |
| 119 | DEBUG_PRINT(F(" received=0x")); |
| 120 | DEBUG_PRINT(tValue.UByte.HighByte, HEX); |
| 121 | DEBUG_PRINT(F(" data=0x")); |
| 122 | DEBUG_PRINTLN(tValue.UWord, HEX); |
| 123 | |
| 124 | decodedIRData.flags = IRDATA_FLAGS_PARITY_FAILED; |
| 125 | } |
| 126 | |
| 127 | checkForRepeatSpaceTicksAndSetFlag(FAST_MAXIMUM_REPEAT_DISTANCE / MICROS_PER_TICK); |
| 128 | |
| 129 | // Success |
| 130 | // decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value |
| 131 | decodedIRData.command = tValue.UByte.LowByte; |
| 132 | decodedIRData.address = 0; // No address for this protocol |
| 133 | decodedIRData.numberOfBits = FAST_BITS; |
| 134 | decodedIRData.protocol = FAST; |
| 135 | |
| 136 | return true; |
| 137 | } |
| 138 | |
| 139 | /** @}*/ |
| 140 | #include "LocalDebugLevelEnd.h" |
nothing calls this directly
no outgoing calls
no test coverage detected