diff options
| author | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-09 12:31:55 +0000 |
|---|---|---|
| committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-12-09 12:31:55 +0000 |
| commit | 1e3513ed70565daf100aa2a3425b3912dea4d2c8 (patch) | |
| tree | 652d2ea7cefcc1465d5e15c3727994404d5c3ceb | |
| parent | 9c8ed168e5805059db7978e6a9a4ad24347c7a6e (diff) | |
| download | lufa-1e3513ed70565daf100aa2a3425b3912dea4d2c8.tar.gz lufa-1e3513ed70565daf100aa2a3425b3912dea4d2c8.tar.bz2 lufa-1e3513ed70565daf100aa2a3425b3912dea4d2c8.zip | |
Add even parity bit to the software USART framing in the AVRISP project's PDI programming code.
| -rw-r--r-- | LUFA/ManPages/ChangeLog.txt | 4 | ||||
| -rw-r--r-- | Projects/AVRISP/Lib/PDITarget.c | 36 |
2 files changed, 33 insertions, 7 deletions
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 143b5a146..0daed3187 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -39,6 +39,8 @@ * with the rest of the library errorcodes
* - Make MIDI device demos also turn off the on board LEDs if MIDI Note On messages are sent with a velocity of zero,
* which some devices use instead of Note Off messages (thanks to Robin Green)
+ * - The CDC demos are now named "VirtualSerial" instead to indicate the demos' function rather than its implemented USB class,
+ * to reduce confusion and to be in line with the rest of the LUFA demos
*
* <b>Fixed:</b>
* - Added missing CDC_Host_CreateBlockingStream() function code to the CDC Host Class driver
@@ -56,7 +58,7 @@ * - Fixed TeensyHID bootloader not properly shutting down the USB interface to trigger a disconnection on the host before resetting
* - Fixed MassStorageHost Class driver demo not having USB_STREAM_TIMEOUT_MS compile time option set properly to prevent slow
* devices from timing out the data pipes
- * - Fixed the definition of the Endpoint_BytesInEndpoint() macro for the U4 parts
+ * - Fixed the definition of the Endpoint_BytesInEndpoint() macro for the U4 series AVR parts
*
* \section Sec_ChangeLog091122 Version 091122
*
diff --git a/Projects/AVRISP/Lib/PDITarget.c b/Projects/AVRISP/Lib/PDITarget.c index 03dd77998..7b35a3336 100644 --- a/Projects/AVRISP/Lib/PDITarget.c +++ b/Projects/AVRISP/Lib/PDITarget.c @@ -45,24 +45,42 @@ */
void PDITarget_SendByte(uint8_t Byte)
{
+ uint8_t LogicOneBits = 0;
+
+ // One Start Bit
PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
TOGGLE_PDI_CLOCK;
-
+
+ // Eight Data Bits
for (uint8_t i = 0; i < 8; i++)
{
if (Byte & 0x01)
- PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
+ {
+ PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
+ LogicOneBits++;
+ }
else
- PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
-
+ {
+ PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
+ }
+
Byte >>= 1;
TOGGLE_PDI_CLOCK;
}
- PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
+ // Even Parity Bit
+ if (LogicOneBits & 0x01)
+ PDIDATA_LINE_PORT &= ~PDIDATA_LINE_MASK;
+ else
+ PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
+
+ TOGGLE_PDI_CLOCK;
+ // Two Stop Bits
+ PDIDATA_LINE_PORT |= PDIDATA_LINE_MASK;
+
TOGGLE_PDI_CLOCK;
TOGGLE_PDI_CLOCK;
}
@@ -77,9 +95,11 @@ uint8_t PDITarget_ReceiveByte(void) PDIDATA_LINE_DDR &= ~PDIDATA_LINE_MASK;
+ // One Start Bit
while (PDIDATA_LINE_PIN & PDIDATA_LINE_MASK);
TOGGLE_PDI_CLOCK;
-
+
+ // Eight Data Bits
for (uint8_t i = 0; i < 8; i++)
{
if (PDIDATA_LINE_PIN & PDIDATA_LINE_MASK)
@@ -90,6 +110,10 @@ uint8_t PDITarget_ReceiveByte(void) TOGGLE_PDI_CLOCK;
}
+ // Even Parity Bit (discarded)
+ TOGGLE_PDI_CLOCK;
+
+ // Two Stop Bits
TOGGLE_PDI_CLOCK;
TOGGLE_PDI_CLOCK;
|
