Make TPI writes add a dummy high byte if the data isn't word-aligned.
[pub/USBasp.git] / Projects / AVRISP-MKII / Lib / XPROG / TINYNVM.c
index 39cdf2e..47a265a 100644 (file)
@@ -155,9 +155,9 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress, const uint8_t* WriteBuffer
        if (!(TINYNVM_WaitWhileNVMControllerBusy()))\r
          return false;\r
          \r
-       /* Must have an integer number of words to write - if extra bytes, abort programming */\r
+       /* Must have an integer number of words to write - if extra byte, word-align via a dummy high byte */\r
        if (WriteLength & 0x01)\r
-         return false;\r
+         WriteBuffer[WriteLength++] = 0xFF;\r
 \r
        /* Set the NVM control register to the WORD WRITE command for memory reading */\r
        TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);\r