aboutsummaryrefslogtreecommitdiffstats
path: root/Projects
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-12-10 00:54:08 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-12-10 00:54:08 +0000
commit7aecda6fda5bcced68d72b0cf73d00174aa5c7cd (patch)
treed4711605cf9dc612ac3282877895bff295daf0ab /Projects
parent1e3513ed70565daf100aa2a3425b3912dea4d2c8 (diff)
downloadlufa-7aecda6fda5bcced68d72b0cf73d00174aa5c7cd.tar.gz
lufa-7aecda6fda5bcced68d72b0cf73d00174aa5c7cd.tar.bz2
lufa-7aecda6fda5bcced68d72b0cf73d00174aa5c7cd.zip
Fix PDITarget_ReceiveByte() not discarding the start bit properly, and reading in the bits inverted and in the wrong order.
Diffstat (limited to 'Projects')
-rw-r--r--Projects/AVRISP/Lib/PDITarget.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Projects/AVRISP/Lib/PDITarget.c b/Projects/AVRISP/Lib/PDITarget.c
index 7b35a3336..a0bbf7dfa 100644
--- a/Projects/AVRISP/Lib/PDITarget.c
+++ b/Projects/AVRISP/Lib/PDITarget.c
@@ -98,14 +98,16 @@ uint8_t PDITarget_ReceiveByte(void)
// One Start Bit
while (PDIDATA_LINE_PIN & PDIDATA_LINE_MASK);
TOGGLE_PDI_CLOCK;
-
+
+ TOGGLE_PDI_CLOCK;
+
// Eight Data Bits
for (uint8_t i = 0; i < 8; i++)
{
- if (PDIDATA_LINE_PIN & PDIDATA_LINE_MASK)
- ReceivedByte |= 0x01;
+ if (!(PDIDATA_LINE_PIN & PDIDATA_LINE_MASK))
+ ReceivedByte |= 0x80;
- ReceivedByte <<= 1;
+ ReceivedByte >>= 1;
TOGGLE_PDI_CLOCK;
}