return;\r
\r
/* Wait for the start bit when receiving */\r
- if ((SoftUSART_BitCount == BITS_IN_FRAME) && (BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK))\r
+ if ((SoftUSART_BitCount == BITS_IN_PDI_FRAME) && (BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK))\r
return;\r
\r
/* Shift in the bit one less than the frame size in position, so that the start bit will eventually\r
* be discarded leaving the data to be byte-aligned for quick access */\r
if (BITBANG_PDIDATA_PIN & BITBANG_PDIDATA_MASK)\r
- SoftUSART_Data |= (1 << (BITS_IN_FRAME - 1));\r
+ SoftUSART_Data |= (1 << (BITS_IN_PDI_FRAME - 1));\r
\r
SoftUSART_Data >>= 1;\r
SoftUSART_BitCount--;\r
TCCR1B = (1 << WGM12) | (1 << CS10);\r
TIMSK1 = (1 << OCIE1A);\r
\r
+ /* Send two BREAKs of 12 bits each to enable TPI interface (need at least 16 idle bits) */\r
PDITarget_SendBreak();\r
PDITarget_SendBreak();\r
#endif\r
/* Tristate DATA and CLOCK lines */\r
BITBANG_PDIDATA_PORT &= ~BITBANG_PDIDATA_MASK;\r
BITBANG_PDICLOCK_PORT &= ~BITBANG_PDICLOCK_MASK;\r
-\r
- TCCR0B = 0;\r
#endif\r
}\r
\r
\r
/* Data shifted out LSB first, START DATA PARITY STOP STOP */\r
SoftUSART_Data = NewUSARTData;\r
- SoftUSART_BitCount = BITS_IN_FRAME;\r
+ SoftUSART_BitCount = BITS_IN_PDI_FRAME;\r
#endif\r
}\r
\r
}\r
\r
/* Wait until a byte has been received before reading */\r
- SoftUSART_BitCount = BITS_IN_FRAME;\r
+ SoftUSART_BitCount = BITS_IN_PDI_FRAME;\r
while (SoftUSART_BitCount);\r
\r
/* Throw away the parity and stop bits to leave only the data (start bit is already discarded) */\r
}\r
\r
/* Need to do nothing for a full frame to send a BREAK */\r
- for (uint8_t i = 0; i < BITS_IN_FRAME; i++)\r
+ for (uint8_t i = 0; i < BITS_IN_PDI_FRAME; i++)\r
{\r
/* Wait for a full cycle of the clock */\r
while (PIND & (1 << 5));\r
\r
/* Need to do nothing for a full frame to send a BREAK */\r
SoftUSART_Data = 0x0FFF;\r
- SoftUSART_BitCount = BITS_IN_FRAME;\r
+ SoftUSART_BitCount = BITS_IN_PDI_FRAME;\r
#endif\r
}\r
\r