Skip to content
Snippets Groups Projects
Commit 7aecda6f authored by Dean Camera's avatar Dean Camera
Browse files

Fix PDITarget_ReceiveByte() not discarding the start bit properly, and reading...

Fix PDITarget_ReceiveByte() not discarding the start bit properly, and reading in the bits inverted and in the wrong order.
parent 1e3513ed
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment