Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Modified to fit the third prototype board

  • Loading branch information...
commit 7747457d59f097536a3653c3ad5fc4954d80e51b 1 parent 5957559
@dnet authored
Showing with 11 additions and 11 deletions.
  1. +5 −5 firmware/main.c
  2. +6 −6 ioparport.cpp
View
10 firmware/main.c
@@ -60,10 +60,10 @@ uchar usbFunctionRead(uchar *data, uchar len)
}
void procByte(const uchar b) {
- PORTC = (PORTC & 0xF0) | (b & 0x03); // ....i0dd
- PORTC |= 0x04; // .....1.. TCK
+ PORTC = (PORTC & 0xC3) | ((b & 0x03) << 4); // ..dd0i..
+ PORTC |= 0x08; // ....1... TCK
if ((b & 4) == 4) {
- readValue = (PINC & 0x08) >> 3;
+ readValue = (PINC & 0x04) >> 2;
}
}
@@ -114,8 +114,8 @@ uchar i;
* That's the way we need D+ and D-. Therefore we don't need any
* additional hardware initialization.
*/
- DDRC = (DDRC & 0xF0) | 0x07; // ....0111 - TDO-TCK-TDI-TMS
- PORTC &= 0xF0; // TCK = TDI = TMS = 0, TDO pullup disabled
+ DDRC = (DDRC & 0xC3) | 0x38; // ..1110.. - TMS-TDI-TCK-TDO
+ PORTC &= 0xC3; // TCK = TDI = TMS = 0, TDO pullup disabled
usbInit();
usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */
i = 0;
View
12 ioparport.cpp
@@ -82,8 +82,8 @@ bool IOParport::txrx(bool tms, bool tdi)
} else {
buffer[0] = 0;
buffer[1] = 4;
- if (tdi) buffer[1] |= 2;
- if (tms) buffer[1] |= 1;
+ if (tdi) buffer[1] |= 1;
+ if (tms) buffer[1] |= 2;
if((err = usbhidSetReport(dev, buffer, sizeof(buffer))) != 0) { /* add a dummy report ID */
fprintf(stderr, "error writing data: %s\n", usbErrorMessage(err));
error = true;
@@ -103,13 +103,13 @@ void IOParport::buftx(bool tms, bool tdi, char startval) {
if (TOB & 8) {
TOB <<= 4;
TOB |= startval;
- if (tdi) TOB |= 2;
- if (tms) TOB |= 1;
+ if (tdi) TOB |= 1;
+ if (tms) TOB |= 2;
if (++txonlybufpos == sizeof(txonlybuf)) flushtob();
} else {
TOB = startval | 8;
- if (tdi) TOB |= 2;
- if (tms) TOB |= 1;
+ if (tdi) TOB |= 1;
+ if (tms) TOB |= 2;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.