Skip to content

Commit a4b5b22

Browse files
committed
Don't wait for serial port! WE won't have a serial port in prod...
1 parent 86cb8b8 commit a4b5b22

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

xr22-950-splint/xr22-950-splint.ino

+9-7
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ const int outputEnabledPin = 2;
3636
void setup() {
3737
Serial.begin(9600);
3838

39-
while (!Serial) {
40-
; // wait for serial port to connect. Needed for native USB port only
41-
}
4239
Serial.println("Hello xr22-950-splint for ProMicro");
4340

4441
pinMode(outputEnabledPin, INPUT);
@@ -83,11 +80,12 @@ void setupSplintPins() {
8380
// Delay 1.4 microseconds. One nop = 62.5ns, so we use 22 nops (1.375 us)
8481
#define DELAY_1_4US "nop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop\n\t"
8582

86-
#define DEBUG 1
83+
#undef DEBUG
8784

8885
#ifdef DEBUG
89-
#define DBG_COUNT 1000
86+
#define DBG_COUNT 10000
9087
long printed = 0; // debugging
88+
long iterations = 0;
9189
#endif
9290

9391
void intHandler() {
@@ -103,9 +101,13 @@ void intHandler() {
103101
d = (inputPins & B00001000) >> 3;
104102
// Debugging
105103
Serial.print("DCBA="); Serial.print(d); Serial.print(c); Serial.print(b); Serial.println(a);
106-
Serial.print("sending blip on 0B"); Serial.println(outputPins, BIN);
104+
if (outputPins != 0) {
105+
Serial.print("sending blip on 0B"); Serial.println(outputPins, BIN);
106+
}
107+
iterations++;
107108
printed = 0;
108109
} else {
110+
iterations++;
109111
printed++;
110112
}
111113
#endif
@@ -117,7 +119,7 @@ void intHandler() {
117119
PORTB = outputPins;
118120
// The hardware sends a 1.4 microsecond pulse. However we don't necessarily start the pulse
119121
// at the same time as the hardware would have. This can be as long as 4us.
120-
__asm__(DELAY_4US);
122+
__asm__(DELAY_2US);
121123
PORTB = B00000000;
122124
}
123125
}

0 commit comments

Comments
 (0)