- /* Send a LD command with indirect access and post-increment to read out the bytes */
- XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
- while (ReadSize-- && TimeoutTicksRemaining)
- *(ReadBuffer++) = XPROGTarget_ReceiveByte();
+ /* Send a LD command with indirect access and post-increment to read out the bytes */
+ XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
+ while (ReadSize-- && TimeoutTicksRemaining)
+ *(ReadBuffer++) = XPROGTarget_ReceiveByte();
+ }
+ else
+ {
+ /* Send a LDS command with the read address to read out the requested byte */
+ XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2));
+ XMEGANVM_SendAddress(ReadAddress);
+ *(ReadBuffer++) = XPROGTarget_ReceiveByte();
+ }