File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,6 @@ const int outputEnabledPin = 2;
36
36
void setup () {
37
37
Serial.begin (9600 );
38
38
39
- while (!Serial) {
40
- ; // wait for serial port to connect. Needed for native USB port only
41
- }
42
39
Serial.println (" Hello xr22-950-splint for ProMicro" );
43
40
44
41
pinMode (outputEnabledPin, INPUT);
@@ -83,11 +80,12 @@ void setupSplintPins() {
83
80
// Delay 1.4 microseconds. One nop = 62.5ns, so we use 22 nops (1.375 us)
84
81
#define DELAY_1_4US " nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t nop\n\t "
85
82
86
- #define DEBUG 1
83
+ #undef DEBUG
87
84
88
85
#ifdef DEBUG
89
- #define DBG_COUNT 1000
86
+ #define DBG_COUNT 10000
90
87
long printed = 0 ; // debugging
88
+ long iterations = 0 ;
91
89
#endif
92
90
93
91
void intHandler () {
@@ -103,9 +101,13 @@ void intHandler() {
103
101
d = (inputPins & B00001000) >> 3 ;
104
102
// Debugging
105
103
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++;
107
108
printed = 0 ;
108
109
} else {
110
+ iterations++;
109
111
printed++;
110
112
}
111
113
#endif
@@ -117,7 +119,7 @@ void intHandler() {
117
119
PORTB = outputPins;
118
120
// The hardware sends a 1.4 microsecond pulse. However we don't necessarily start the pulse
119
121
// at the same time as the hardware would have. This can be as long as 4us.
120
- __asm__ (DELAY_4US );
122
+ __asm__ (DELAY_2US );
121
123
PORTB = B00000000;
122
124
}
123
125
}
You can’t perform that action at this time.
0 commit comments