The janky example address incrementer doesn't clear between addresses

This commit is contained in:
Kevin Santo Cappuccio 2024-11-21 09:20:47 -08:00
parent 1e12c6f030
commit 6d7170ed3a

View File

@ -84,6 +84,8 @@ int core2setupFinished = 0;
int baudRate = 115200; int baudRate = 115200;
int excelCounter = 0;
void setup() { void setup() {
pinMode(0, OUTPUT); pinMode(0, OUTPUT);
pinMode(2, INPUT); pinMode(2, INPUT);
@ -472,6 +474,13 @@ skipinput:
printNodeFile(); printNodeFile();
break; break;
case '*': {
excelCounter++;
Serial.print("42, 56.9, ");
Serial.println(excelCounter);
break;
}
case 'w': case 'w':
if (waveGen() == 1) { if (waveGen() == 1) {
@ -514,9 +523,13 @@ skipinput:
Serial.print("x\n\r"); Serial.print("x\n\r");
break; break;
} }
if (isDigit(row) == false) {
continue;
}
addressRows[i] = row - '0'; addressRows[i] = row - '0';
if (Serial.available() > 0 && Serial.peek() != '\n') { char nextChar = Serial.peek();
if (Serial.available() > 0 && isDigit(nextChar) == true) {
row = Serial.read(); row = Serial.read();
addressRows[i] *= 10; addressRows[i] *= 10;
@ -546,7 +559,7 @@ skipinput:
Serial.print(i); Serial.print(i);
Serial.print("> "); Serial.print("> ");
while (Serial.available() == 0) { while (Serial.available() <= 0) {
} }
int row = Serial.read(); int row = Serial.read();
@ -555,16 +568,20 @@ skipinput:
Serial.print("x\n\r"); Serial.print("x\n\r");
break; break;
} }
if (isDigit(row) == false) {
continue;
}
dataRows[i] = row - '0'; dataRows[i] = row - '0';
if (Serial.available() > 0 && Serial.peek() != '\n') { char nextChar = Serial.peek();
if (Serial.available() > 0 && isDigit(nextChar) == true) {
row = Serial.read(); row = Serial.read();
dataRows[i] *= 10; dataRows[i] *= 10;
dataRows[i] += row - '0'; dataRows[i] += row - '0';
} }
// Serial.print(dataRows[i]); Serial.print(dataRows[i]);
} }
int clockRow = 0; int clockRow = 0;
@ -579,13 +596,17 @@ skipinput:
} }
int row = Serial.read(); int row = Serial.read();
if (isDigit(row) == false) {
clockRow = row - '0'; } else {
if (Serial.available() > 0 && Serial.peek() != '\n') {
row = Serial.read();
clockRow *= 10; clockRow = row - '0';
clockRow += row - '0'; if (Serial.available() > 0 && Serial.peek() != '\n') {
row = Serial.read();
clockRow *= 10;
clockRow += row - '0';
}
} }
Serial.print("\n\n\n\n\r"); Serial.print("\n\n\n\n\r");
@ -629,15 +650,16 @@ skipinput:
// Serial.println(addressRows[addressCount], BIN); // Serial.println(addressRows[addressCount], BIN);
// Serial.println(addressCount, BIN); // Serial.println(addressCount, BIN);
createSlots(netSlot, 0); // clears the netlist // createSlots(netSlot, 0); // clears the netlist
delay(100); // delay(100);
for (int i = 0; i < numberOfAddressBits; i++) { for (int i = 0; i < numberOfAddressBits; i++) {
// Serial.print(addressCount & (1 << i) ? "1" : "0"); // Serial.print(addressCount & (1 << i) ? "1" : "0");
addressBits[i] = addressCount & (1 << i); addressBits[i] = addressCount & (1 << i);
Serial.print(addressBits[i] == true ? "1" : "0"); Serial.print(addressBits[i] == true ? "1" : "0");
removeBridgeFromNodeFile(addressRows[i], -1, netSlot);
delay(1);
addBridgeToNodeFile(addressRows[i], addBridgeToNodeFile(addressRows[i],
addressBits[i] == true ? SUPPLY_5V : GND, netSlot); addressBits[i] == true ? SUPPLY_5V : GND, netSlot);
} }
@ -645,8 +667,8 @@ skipinput:
// TODO: add data bits or do something with them // TODO: add data bits or do something with them
// TODO: wiggle the clock line // TODO: wiggle the clock line
delay(100); delay(10);
printNodeFile(); // printNodeFile();
probeActive = 1; probeActive = 1;
clearAllNTCC(); clearAllNTCC();
@ -663,7 +685,7 @@ skipinput:
showLEDsCore2 = 1; showLEDsCore2 = 1;
probeActive = 0; probeActive = 0;
delay(400); delay(200);
} }
break; break;