|
@@ -46,21 +46,18 @@ bool endstop_monitor_flag = false;
|
46
|
46
|
|
47
|
47
|
// first pass - put the name strings into FLASH
|
48
|
48
|
|
49
|
|
-#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const unsigned char ENTRY_NAME[] PROGMEM = {PIN_NAME};
|
50
|
|
-#define _ADD_PIN(PIN_NAME, COUNTER) _ADD_PIN_2(PIN_NAME, entry_NAME_##COUNTER)
|
51
|
|
-#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
|
52
|
|
-#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
|
53
|
|
-
|
54
|
|
-#line 0 // set __LINE__ to a known value for the first pass
|
|
49
|
+#define _ADD_PIN_2(PIN_NAME, ENTRY_NAME) static const unsigned char ENTRY_NAME[] PROGMEM = { PIN_NAME };
|
|
50
|
+#define _ADD_PIN(PIN_NAME, COUNTER) _ADD_PIN_2(PIN_NAME, entry_NAME_##COUNTER)
|
|
51
|
+#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
|
|
52
|
+#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(#NAME, COUNTER)
|
55
|
53
|
|
56
|
54
|
#include "pinsDebug_list.h"
|
57
|
|
-
|
58
|
|
-#line 59 // set __LINE__ to the correct line number or else compiler error messages don't make sense
|
|
55
|
+#line 56
|
59
|
56
|
|
60
|
57
|
// manually add pins that have names that are macros which don't play well with these macros
|
61
|
58
|
#if SERIAL_PORT == 0 && (AVR_ATmega2560_FAMILY || AVR_ATmega1284_FAMILY)
|
62
|
|
- static const char RXD_NAME[] PROGMEM = {"RXD"};
|
63
|
|
- static const char TXD_NAME[] PROGMEM = {"TXD"};
|
|
59
|
+ static const char RXD_NAME[] PROGMEM = { "RXD" };
|
|
60
|
+ static const char TXD_NAME[] PROGMEM = { "TXD" };
|
64
|
61
|
#endif
|
65
|
62
|
|
66
|
63
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -72,11 +69,10 @@ bool endstop_monitor_flag = false;
|
72
|
69
|
#undef REPORT_NAME_DIGITAL
|
73
|
70
|
#undef REPORT_NAME_ANALOG
|
74
|
71
|
|
75
|
|
-#define _ADD_PIN_2( ENTRY_NAME, NAME, IS_DIGITAL) {(const char*) ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL},
|
76
|
|
-#define _ADD_PIN( NAME, COUNTER, IS_DIGITAL) _ADD_PIN_2( entry_NAME_##COUNTER, NAME, IS_DIGITAL)
|
77
|
|
-#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN( NAME, COUNTER, (uint8_t)1)
|
78
|
|
-#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN( analogInputToDigitalPin(NAME), COUNTER, 0)
|
79
|
|
-
|
|
72
|
+#define _ADD_PIN_2(ENTRY_NAME, NAME, IS_DIGITAL) { (const char*)ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL },
|
|
73
|
+#define _ADD_PIN(NAME, COUNTER, IS_DIGITAL) _ADD_PIN_2(entry_NAME_##COUNTER, NAME, IS_DIGITAL)
|
|
74
|
+#define REPORT_NAME_DIGITAL(NAME, COUNTER) _ADD_PIN(NAME, COUNTER, (uint8_t)1)
|
|
75
|
+#define REPORT_NAME_ANALOG(NAME, COUNTER) _ADD_PIN(analogInputToDigitalPin(NAME), COUNTER, 0)
|
80
|
76
|
|
81
|
77
|
const char* const pin_array[][3] PROGMEM = {
|
82
|
78
|
|
|
@@ -92,35 +88,32 @@ const char* const pin_array[][3] PROGMEM = {
|
92
|
88
|
// manually add pins ...
|
93
|
89
|
#if SERIAL_PORT == 0
|
94
|
90
|
#if AVR_ATmega2560_FAMILY
|
95
|
|
- {RXD_NAME, "0", "1"},
|
96
|
|
- {TXD_NAME, "1", "1"},
|
|
91
|
+ { RXD_NAME, "0", "1" },
|
|
92
|
+ { TXD_NAME, "1", "1" },
|
97
|
93
|
#elif AVR_ATmega1284_FAMILY
|
98
|
|
- {RXD_NAME, "8", "1"},
|
99
|
|
- {TXD_NAME, "9", "1"},
|
|
94
|
+ { RXD_NAME, "8", "1" },
|
|
95
|
+ { TXD_NAME, "9", "1" },
|
100
|
96
|
#endif
|
101
|
97
|
#endif
|
102
|
98
|
|
103
|
|
- #line 0 // set __LINE__ to the SAME known value for the second pass
|
104
|
99
|
#include "pinsDebug_list.h"
|
|
100
|
+ #line 101
|
105
|
101
|
|
106
|
|
-}; // done populating the array
|
107
|
|
-
|
108
|
|
-#line 109 // set __LINE__ to the correct line number or else compiler error messages don't make sense
|
|
102
|
+};
|
109
|
103
|
|
110
|
|
-#define n_array (sizeof (pin_array) / sizeof (const char *))/3
|
|
104
|
+#define n_array (sizeof(pin_array) / sizeof(char*)) / 3
|
111
|
105
|
|
112
|
106
|
#ifndef TIMER1B
|
113
|
107
|
// working with Teensyduino extension so need to re-define some things
|
114
|
108
|
#include "pinsDebug_Teensyduino.h"
|
115
|
109
|
#endif
|
116
|
110
|
|
117
|
|
-
|
118
|
111
|
#define PWM_PRINT(V) do{ sprintf(buffer, "PWM: %4d", V); SERIAL_ECHO(buffer); }while(0)
|
119
|
|
-#define PWM_CASE(N,Z) \
|
120
|
|
- case TIMER##N##Z: \
|
|
112
|
+#define PWM_CASE(N,Z) \
|
|
113
|
+ case TIMER##N##Z: \
|
121
|
114
|
if (TCCR##N##A & (_BV(COM##N##Z##1) | _BV(COM##N##Z##0))) { \
|
122
|
|
- PWM_PRINT(OCR##N##Z); \
|
123
|
|
- return true; \
|
|
115
|
+ PWM_PRINT(OCR##N##Z); \
|
|
116
|
+ return true; \
|
124
|
117
|
} else return false
|
125
|
118
|
|
126
|
119
|
/**
|
|
@@ -130,71 +123,70 @@ const char* const pin_array[][3] PROGMEM = {
|
130
|
123
|
static bool pwm_status(uint8_t pin) {
|
131
|
124
|
char buffer[20]; // for the sprintf statements
|
132
|
125
|
|
133
|
|
- switch(digitalPinToTimer(pin)) {
|
|
126
|
+ switch (digitalPinToTimer(pin)) {
|
134
|
127
|
|
135
|
128
|
#if defined(TCCR0A) && defined(COM0A1)
|
136
|
129
|
#ifdef TIMER0A
|
137
|
|
- PWM_CASE(0,A);
|
|
130
|
+ PWM_CASE(0, A);
|
138
|
131
|
#endif
|
139
|
|
- PWM_CASE(0,B);
|
|
132
|
+ PWM_CASE(0, B);
|
140
|
133
|
#endif
|
141
|
134
|
|
142
|
135
|
#if defined(TCCR1A) && defined(COM1A1)
|
143
|
|
- PWM_CASE(1,A);
|
144
|
|
- PWM_CASE(1,B);
|
|
136
|
+ PWM_CASE(1, A);
|
|
137
|
+ PWM_CASE(1, B);
|
145
|
138
|
#if defined(COM1C1) && defined(TIMER1C)
|
146
|
|
- PWM_CASE(1,C);
|
|
139
|
+ PWM_CASE(1, C);
|
147
|
140
|
#endif
|
148
|
141
|
#endif
|
149
|
142
|
|
150
|
143
|
#if defined(TCCR2A) && defined(COM2A1)
|
151
|
|
- PWM_CASE(2,A);
|
152
|
|
- PWM_CASE(2,B);
|
|
144
|
+ PWM_CASE(2, A);
|
|
145
|
+ PWM_CASE(2, B);
|
153
|
146
|
#endif
|
154
|
147
|
|
155
|
148
|
#if defined(TCCR3A) && defined(COM3A1)
|
156
|
|
- PWM_CASE(3,A);
|
157
|
|
- PWM_CASE(3,B);
|
|
149
|
+ PWM_CASE(3, A);
|
|
150
|
+ PWM_CASE(3, B);
|
158
|
151
|
#ifdef COM3C1
|
159
|
|
- PWM_CASE(3,C);
|
|
152
|
+ PWM_CASE(3, C);
|
160
|
153
|
#endif
|
161
|
154
|
#endif
|
162
|
155
|
|
163
|
156
|
#ifdef TCCR4A
|
164
|
|
- PWM_CASE(4,A);
|
165
|
|
- PWM_CASE(4,B);
|
166
|
|
- PWM_CASE(4,C);
|
|
157
|
+ PWM_CASE(4, A);
|
|
158
|
+ PWM_CASE(4, B);
|
|
159
|
+ PWM_CASE(4, C);
|
167
|
160
|
#endif
|
168
|
161
|
|
169
|
162
|
#if defined(TCCR5A) && defined(COM5A1)
|
170
|
|
- PWM_CASE(5,A);
|
171
|
|
- PWM_CASE(5,B);
|
172
|
|
- PWM_CASE(5,C);
|
|
163
|
+ PWM_CASE(5, A);
|
|
164
|
+ PWM_CASE(5, B);
|
|
165
|
+ PWM_CASE(5, C);
|
173
|
166
|
#endif
|
174
|
167
|
|
175
|
168
|
case NOT_ON_TIMER:
|
176
|
169
|
default:
|
177
|
170
|
return false;
|
178
|
171
|
}
|
179
|
|
- SERIAL_PROTOCOLPGM(" ");
|
|
172
|
+ SERIAL_PROTOCOL_SP(2);
|
180
|
173
|
} // pwm_status
|
181
|
174
|
|
182
|
175
|
|
183
|
|
-
|
184
|
176
|
const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
185
|
|
- {&TCCR0A, &TCCR0B, &TIMSK0},
|
186
|
|
- {&TCCR1A, &TCCR1B, &TIMSK1},
|
|
177
|
+ { &TCCR0A, &TCCR0B, &TIMSK0 },
|
|
178
|
+ { &TCCR1A, &TCCR1B, &TIMSK1 },
|
187
|
179
|
#if defined(TCCR2A) && defined(COM2A1)
|
188
|
|
- {&TCCR2A, &TCCR2B, &TIMSK2},
|
|
180
|
+ { &TCCR2A, &TCCR2B, &TIMSK2 },
|
189
|
181
|
#endif
|
190
|
182
|
#if defined(TCCR3A) && defined(COM3A1)
|
191
|
|
- {&TCCR3A, &TCCR3B, &TIMSK3},
|
|
183
|
+ { &TCCR3A, &TCCR3B, &TIMSK3 },
|
192
|
184
|
#endif
|
193
|
185
|
#ifdef TCCR4A
|
194
|
|
- {&TCCR4A, &TCCR4B, &TIMSK4},
|
|
186
|
+ { &TCCR4A, &TCCR4B, &TIMSK4 },
|
195
|
187
|
#endif
|
196
|
188
|
#if defined(TCCR5A) && defined(COM5A1)
|
197
|
|
- {&TCCR5A, &TCCR5B, &TIMSK5},
|
|
189
|
+ { &TCCR5A, &TCCR5B, &TIMSK5 },
|
198
|
190
|
#endif
|
199
|
191
|
};
|
200
|
192
|
|
|
@@ -202,35 +194,35 @@ const volatile uint8_t* const PWM_other[][3] PROGMEM = {
|
202
|
194
|
const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
203
|
195
|
|
204
|
196
|
#ifdef TIMER0A
|
205
|
|
- {&OCR0A,&OCR0B,0},
|
|
197
|
+ { &OCR0A, &OCR0B, 0 },
|
206
|
198
|
#else
|
207
|
|
- {0,&OCR0B,0},
|
|
199
|
+ { 0, &OCR0B, 0 },
|
208
|
200
|
#endif
|
209
|
201
|
|
210
|
202
|
#if defined(COM1C1) && defined(TIMER1C)
|
211
|
|
- { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B, (const uint8_t*) &OCR1C},
|
|
203
|
+ { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, (const uint8_t*)&OCR1C },
|
212
|
204
|
#else
|
213
|
|
- { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B,0},
|
|
205
|
+ { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, 0 },
|
214
|
206
|
#endif
|
215
|
207
|
|
216
|
208
|
#if defined(TCCR2A) && defined(COM2A1)
|
217
|
|
- {&OCR2A,&OCR2B,0},
|
|
209
|
+ { &OCR2A, &OCR2B, 0 },
|
218
|
210
|
#endif
|
219
|
211
|
|
220
|
212
|
#if defined(TCCR3A) && defined(COM3A1)
|
221
|
213
|
#ifdef COM3C1
|
222
|
|
- { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B, (const uint8_t*) &OCR3C},
|
|
214
|
+ { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, (const uint8_t*)&OCR3C },
|
223
|
215
|
#else
|
224
|
|
- { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B,0},
|
|
216
|
+ { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, 0 },
|
225
|
217
|
#endif
|
226
|
218
|
#endif
|
227
|
219
|
|
228
|
220
|
#ifdef TCCR4A
|
229
|
|
- { (const uint8_t*) &OCR4A, (const uint8_t*) &OCR4B, (const uint8_t*) &OCR4C},
|
|
221
|
+ { (const uint8_t*)&OCR4A, (const uint8_t*)&OCR4B, (const uint8_t*)&OCR4C },
|
230
|
222
|
#endif
|
231
|
223
|
|
232
|
224
|
#if defined(TCCR5A) && defined(COM5A1)
|
233
|
|
- { (const uint8_t*) &OCR5A, (const uint8_t*) &OCR5B, (const uint8_t*) &OCR5C},
|
|
225
|
+ { (const uint8_t*)&OCR5A, (const uint8_t*)&OCR5B, (const uint8_t*)&OCR5C },
|
234
|
226
|
#endif
|
235
|
227
|
};
|
236
|
228
|
|
|
@@ -247,39 +239,30 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
|
247
|
239
|
#define WGM_3 4
|
248
|
240
|
#define TOIE 0
|
249
|
241
|
|
250
|
|
-
|
251
|
242
|
#define OCR_VAL(T, L) pgm_read_word(&PWM_OCR[T][L])
|
252
|
243
|
|
253
|
|
-
|
254
|
|
-static void err_is_counter() {
|
255
|
|
- SERIAL_PROTOCOLPGM(" non-standard PWM mode");
|
256
|
|
-}
|
257
|
|
-static void err_is_interrupt() {
|
258
|
|
- SERIAL_PROTOCOLPGM(" compare interrupt enabled");
|
259
|
|
-}
|
260
|
|
-static void err_prob_interrupt() {
|
261
|
|
- SERIAL_PROTOCOLPGM(" overflow interrupt enabled");
|
262
|
|
-}
|
|
244
|
+static void err_is_counter() { SERIAL_PROTOCOLPGM(" non-standard PWM mode"); }
|
|
245
|
+static void err_is_interrupt() { SERIAL_PROTOCOLPGM(" compare interrupt enabled"); }
|
|
246
|
+static void err_prob_interrupt() { SERIAL_PROTOCOLPGM(" overflow interrupt enabled"); }
|
263
|
247
|
|
264
|
248
|
void com_print(uint8_t N, uint8_t Z) {
|
265
|
|
- uint8_t *TCCRA = (uint8_t*) TCCR_A(N);
|
|
249
|
+ uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
|
266
|
250
|
SERIAL_PROTOCOLPGM(" COM");
|
267
|
251
|
SERIAL_PROTOCOLCHAR(N + '0');
|
268
|
|
- switch(Z) {
|
269
|
|
- case 'A' :
|
|
252
|
+ switch (Z) {
|
|
253
|
+ case 'A':
|
270
|
254
|
SERIAL_PROTOCOLPAIR("A: ", ((*TCCRA & (_BV(7) | _BV(6))) >> 6));
|
271
|
255
|
break;
|
272
|
|
- case 'B' :
|
|
256
|
+ case 'B':
|
273
|
257
|
SERIAL_PROTOCOLPAIR("B: ", ((*TCCRA & (_BV(5) | _BV(4))) >> 4));
|
274
|
258
|
break;
|
275
|
|
- case 'C' :
|
|
259
|
+ case 'C':
|
276
|
260
|
SERIAL_PROTOCOLPAIR("C: ", ((*TCCRA & (_BV(3) | _BV(2))) >> 2));
|
277
|
261
|
break;
|
278
|
262
|
}
|
279
|
263
|
}
|
280
|
264
|
|
281
|
|
-
|
282
|
|
-void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm n - WGM bit layout
|
|
265
|
+void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - WGM bit layout
|
283
|
266
|
char buffer[20]; // for the sprintf statements
|
284
|
267
|
uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
|
285
|
268
|
uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
|
|
@@ -289,14 +272,14 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm n -
|
289
|
272
|
SERIAL_PROTOCOLPGM(" TIMER");
|
290
|
273
|
SERIAL_PROTOCOLCHAR(T + '0');
|
291
|
274
|
SERIAL_PROTOCOLCHAR(L);
|
292
|
|
- SERIAL_PROTOCOLPGM(" ");
|
|
275
|
+ SERIAL_PROTOCOL_SP(3);
|
293
|
276
|
|
294
|
277
|
if (N == 3) {
|
295
|
|
- uint8_t *OCRVAL8 = (uint8_t*) OCR_VAL(T, L - 'A');
|
|
278
|
+ uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A');
|
296
|
279
|
PWM_PRINT(*OCRVAL8);
|
297
|
280
|
}
|
298
|
281
|
else {
|
299
|
|
- uint16_t *OCRVAL16 = (uint16_t*) OCR_VAL(T, L - 'A');
|
|
282
|
+ uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A');
|
300
|
283
|
PWM_PRINT(*OCRVAL16);
|
301
|
284
|
}
|
302
|
285
|
SERIAL_PROTOCOLPAIR(" WGM: ", WGM);
|
|
@@ -311,92 +294,59 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm n -
|
311
|
294
|
SERIAL_PROTOCOLCHAR(T + '0');
|
312
|
295
|
SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
|
313
|
296
|
|
314
|
|
- uint8_t *TMSK = (uint8_t*) TIMSK(T);
|
|
297
|
+ uint8_t *TMSK = (uint8_t*)TIMSK(T);
|
315
|
298
|
SERIAL_PROTOCOLPGM(" TIMSK");
|
316
|
299
|
SERIAL_PROTOCOLCHAR(T + '0');
|
317
|
300
|
SERIAL_PROTOCOLPAIR(": ", *TMSK);
|
318
|
301
|
|
319
|
302
|
uint8_t OCIE = L - 'A' + 1;
|
320
|
|
- if (N == 3) {if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter();}
|
321
|
|
- else {if (WGM == 0 || WGM == 4 || WGM == 12 || WGM == 13) err_is_counter();}
|
|
303
|
+ if (N == 3) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter(); }
|
|
304
|
+ else { if (WGM == 0 || WGM == 4 || WGM == 12 || WGM == 13) err_is_counter(); }
|
322
|
305
|
if (TEST(*TMSK, OCIE)) err_is_interrupt();
|
323
|
306
|
if (TEST(*TMSK, TOIE)) err_prob_interrupt();
|
324
|
307
|
}
|
325
|
308
|
|
326
|
309
|
static void pwm_details(uint8_t pin) {
|
327
|
|
- switch(digitalPinToTimer(pin)) {
|
|
310
|
+ switch (digitalPinToTimer(pin)) {
|
328
|
311
|
|
329
|
312
|
#if defined(TCCR0A) && defined(COM0A1)
|
330
|
|
-
|
331
|
313
|
#ifdef TIMER0A
|
332
|
|
- case TIMER0A:
|
333
|
|
- timer_prefix(0,'A',3);
|
334
|
|
- break;
|
|
314
|
+ case TIMER0A: timer_prefix(0, 'A', 3); break;
|
335
|
315
|
#endif
|
336
|
|
- case TIMER0B:
|
337
|
|
- timer_prefix(0,'B',3);
|
338
|
|
- break;
|
|
316
|
+ case TIMER0B: timer_prefix(0, 'B', 3); break;
|
339
|
317
|
#endif
|
340
|
318
|
|
341
|
319
|
#if defined(TCCR1A) && defined(COM1A1)
|
342
|
|
- case TIMER1A:
|
343
|
|
- timer_prefix(1,'A',4);
|
344
|
|
- break;
|
345
|
|
- case TIMER1B:
|
346
|
|
- timer_prefix(1,'B',4);
|
347
|
|
- break;
|
|
320
|
+ case TIMER1A: timer_prefix(1, 'A', 4); break;
|
|
321
|
+ case TIMER1B: timer_prefix(1, 'B', 4); break;
|
348
|
322
|
#if defined(COM1C1) && defined(TIMER1C)
|
349
|
|
- case TIMER1C:
|
350
|
|
- timer_prefix(1,'C',4);
|
351
|
|
- break;
|
|
323
|
+ case TIMER1C: timer_prefix(1, 'C', 4); break;
|
352
|
324
|
#endif
|
353
|
325
|
#endif
|
354
|
326
|
|
355
|
327
|
#if defined(TCCR2A) && defined(COM2A1)
|
356
|
|
- case TIMER2A:
|
357
|
|
- timer_prefix(2,'A',3);
|
358
|
|
- break;
|
359
|
|
- case TIMER2B:
|
360
|
|
- timer_prefix(2,'B',3);
|
361
|
|
- break;
|
|
328
|
+ case TIMER2A: timer_prefix(2, 'A', 3); break;
|
|
329
|
+ case TIMER2B: timer_prefix(2, 'B', 3); break;
|
362
|
330
|
#endif
|
363
|
331
|
|
364
|
332
|
#if defined(TCCR3A) && defined(COM3A1)
|
365
|
|
- case TIMER3A:
|
366
|
|
- timer_prefix(3,'A',4);
|
367
|
|
- break;
|
368
|
|
- case TIMER3B:
|
369
|
|
- timer_prefix(3,'B',4);
|
370
|
|
- break;
|
|
333
|
+ case TIMER3A: timer_prefix(3, 'A', 4); break;
|
|
334
|
+ case TIMER3B: timer_prefix(3, 'B', 4); break;
|
371
|
335
|
#ifdef COM3C1
|
372
|
|
- case TIMER3C:
|
373
|
|
- timer_prefix(3,'C',4);
|
374
|
|
- break;
|
|
336
|
+ case TIMER3C: timer_prefix(3, 'C', 4); break;
|
375
|
337
|
#endif
|
376
|
338
|
#endif
|
377
|
339
|
|
378
|
340
|
#ifdef TCCR4A
|
379
|
|
- case TIMER4A:
|
380
|
|
- timer_prefix(4,'A',4);
|
381
|
|
- break;
|
382
|
|
- case TIMER4B:
|
383
|
|
- timer_prefix(4,'B',4);
|
384
|
|
- break;
|
385
|
|
- case TIMER4C:
|
386
|
|
- timer_prefix(4,'C',4);
|
387
|
|
- break;
|
|
341
|
+ case TIMER4A: timer_prefix(4, 'A', 4); break;
|
|
342
|
+ case TIMER4B: timer_prefix(4, 'B', 4); break;
|
|
343
|
+ case TIMER4C: timer_prefix(4, 'C', 4); break;
|
388
|
344
|
#endif
|
389
|
345
|
|
390
|
346
|
#if defined(TCCR5A) && defined(COM5A1)
|
391
|
|
- case TIMER5A:
|
392
|
|
- timer_prefix(5,'A',4);
|
393
|
|
- break;
|
394
|
|
- case TIMER5B:
|
395
|
|
- timer_prefix(5,'B',4);
|
396
|
|
- break;
|
397
|
|
- case TIMER5C:
|
398
|
|
- timer_prefix(5,'C',4);
|
399
|
|
- break;
|
|
347
|
+ case TIMER5A: timer_prefix(5, 'A', 4); break;
|
|
348
|
+ case TIMER5B: timer_prefix(5, 'B', 4); break;
|
|
349
|
+ case TIMER5C: timer_prefix(5, 'C', 4); break;
|
400
|
350
|
#endif
|
401
|
351
|
|
402
|
352
|
case NOT_ON_TIMER: break;
|
|
@@ -409,11 +359,17 @@ static void pwm_details(uint8_t pin) {
|
409
|
359
|
// looking for port B7 - PWMs 0A and 1C
|
410
|
360
|
if ( ('B' == digitalPinToPort(pin) + 64) && (0x80 == digitalPinToBitMask(pin))) {
|
411
|
361
|
#ifndef TEENSYDUINO_IDE
|
412
|
|
- SERIAL_PROTOCOLPGM("\n . TIMER1C is also tied to this pin ");
|
413
|
|
- timer_prefix(1,'C',4);
|
|
362
|
+ SERIAL_PROTOCOLPGM("\n .");
|
|
363
|
+ SERIAL_PROTOCOL_SP(18);
|
|
364
|
+ SERIAL_PROTOCOLPGM("TIMER1C is also tied to this pin");
|
|
365
|
+ SERIAL_PROTOCOL_SP(13);
|
|
366
|
+ timer_prefix(1, 'C', 4);
|
414
|
367
|
#else
|
415
|
|
- SERIAL_PROTOCOLPGM("\n . TIMER0A is also tied to this pin ");
|
416
|
|
- timer_prefix(0,'A',3);
|
|
368
|
+ SERIAL_PROTOCOLPGM("\n .");
|
|
369
|
+ SERIAL_PROTOCOL_SP(18);
|
|
370
|
+ SERIAL_PROTOCOLPGM("TIMER0A is also tied to this pin");
|
|
371
|
+ SERIAL_PROTOCOL_SP(13);
|
|
372
|
+ timer_prefix(0, 'A', 3);
|
417
|
373
|
#endif
|
418
|
374
|
}
|
419
|
375
|
#endif
|
|
@@ -437,7 +393,7 @@ void print_port(int8_t pin) { // print port number
|
437
|
393
|
for (x = '0'; x < '9' && temp != 1; x++) temp >>= 1;
|
438
|
394
|
SERIAL_CHAR(x);
|
439
|
395
|
#else
|
440
|
|
- SERIAL_PROTOCOLPGM(" ");
|
|
396
|
+ SERIAL_PROTOCOL_SP(10);
|
441
|
397
|
#endif
|
442
|
398
|
}
|
443
|
399
|
|
|
@@ -460,10 +416,13 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
|
460
|
416
|
sprintf(buffer, " (A%2d) ", int(pin - analogInputToDigitalPin(0))); // analog pin number
|
461
|
417
|
SERIAL_ECHO(buffer);
|
462
|
418
|
}
|
463
|
|
- else SERIAL_ECHOPGM(" "); // add padding if not an analog pin
|
|
419
|
+ else SERIAL_ECHO_SP(8); // add padding if not an analog pin
|
464
|
420
|
}
|
465
|
|
- else SERIAL_ECHOPGM(". "); // add padding if not the first instance found
|
466
|
|
- name_mem_pointer = (char*) pgm_read_word(&pin_array[x][0]);
|
|
421
|
+ else {
|
|
422
|
+ SERIAL_CHAR('.');
|
|
423
|
+ SERIAL_ECHO_SP(25); // add padding if not the first instance found
|
|
424
|
+ }
|
|
425
|
+ name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]);
|
467
|
426
|
for (uint8_t y = 0; y < 28; y++) { // always print pin name
|
468
|
427
|
temp_char = pgm_read_byte(name_mem_pointer + y);
|
469
|
428
|
if (temp_char != 0) MYSERIAL.write(temp_char);
|
|
@@ -506,17 +465,19 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
|
506
|
465
|
SERIAL_ECHO(buffer);
|
507
|
466
|
}
|
508
|
467
|
else
|
509
|
|
- SERIAL_ECHOPGM(" "); // add padding if not an analog pin
|
|
468
|
+ SERIAL_ECHO_SP(8); // add padding if not an analog pin
|
510
|
469
|
SERIAL_ECHOPGM("<unused/unknown>");
|
511
|
|
- if (get_pinMode(pin))
|
512
|
|
- SERIAL_PROTOCOLPAIR(" Output = ", digitalRead_mod(pin));
|
|
470
|
+ if (get_pinMode(pin)) {
|
|
471
|
+ SERIAL_PROTOCOL_SP(12);
|
|
472
|
+ SERIAL_PROTOCOLPAIR("Output = ", digitalRead_mod(pin));
|
|
473
|
+ }
|
513
|
474
|
else {
|
514
|
475
|
if (IS_ANALOG(pin)) {
|
515
|
476
|
sprintf(buffer, " Analog in = %5d", analogRead(pin - analogInputToDigitalPin(0)));
|
516
|
477
|
SERIAL_ECHO(buffer);
|
517
|
478
|
}
|
518
|
479
|
else
|
519
|
|
- SERIAL_ECHOPGM(" "); // add padding if not an analog pin
|
|
480
|
+ SERIAL_ECHO_SP(9); // add padding if not an analog pin
|
520
|
481
|
|
521
|
482
|
SERIAL_PROTOCOLPAIR(" Input = ", digitalRead_mod(pin));
|
522
|
483
|
}
|