- if ((ByteToWrite != Write_Memory_Params.PollValue1) && (V2Command == CMD_PROGRAM_FLASH_ISP))\r
- PollAddress = (((CurrentAddress & 0xFFFF) << 1) | IsOddByte);\r
- else if ((ByteToWrite != Write_Memory_Params.PollValue2) && (V2Command == CMD_PROGRAM_EEPROM_ISP))\r
- PollAddress = (CurrentAddress & 0xFFFF);\r
-\r
- ProgrammingStatus = V2Protocol_WaitForProgrammingComplete(PollAddress, Write_Memory_Params.ProgrammingMode);\r
+ if (ByteToWrite != PollValue)\r
+ {\r
+ if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))\r
+ Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;\r
+ \r
+ PollAddress = (CurrentAddress & 0xFFFF);\r
+ }\r
+ \r
+ /* Check if the endpoint bank is currently empty */\r
+ if (!(Endpoint_IsReadWriteAllowed()))\r
+ {\r
+ Endpoint_ClearOUT();\r
+ Endpoint_WaitUntilReady();\r
+ } \r