Browse Source

Cleanups to pins debugging

Scott Lahteine 7 years ago
parent
commit
819df5e06d
1 changed files with 29 additions and 64 deletions
  1. 29
    64
      Marlin/pinsDebug.h

+ 29
- 64
Marlin/pinsDebug.h View File

@@ -72,7 +72,7 @@ bool endstop_monitor_flag = false;
72 72
 #undef REPORT_NAME_DIGITAL
73 73
 #undef REPORT_NAME_ANALOG
74 74
 
75
-#define _ADD_PIN_2( ENTRY_NAME, NAME, IS_DIGITAL) {(const char*) ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL},
75
+#define _ADD_PIN_2( ENTRY_NAME, NAME, IS_DIGITAL) {(const char*)ENTRY_NAME, (const char*)NAME, (const char*)IS_DIGITAL},
76 76
 #define _ADD_PIN( NAME, COUNTER, IS_DIGITAL)  _ADD_PIN_2( entry_NAME_##COUNTER, NAME, IS_DIGITAL)
77 77
 #define REPORT_NAME_DIGITAL(NAME, COUNTER)  _ADD_PIN( NAME, COUNTER, (uint8_t)1)
78 78
 #define REPORT_NAME_ANALOG(NAME, COUNTER)  _ADD_PIN( analogInputToDigitalPin(NAME), COUNTER, 0)
@@ -208,9 +208,9 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
208 208
   #endif
209 209
 
210 210
   #if defined(COM1C1) && defined(TIMER1C)
211
-   { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B, (const uint8_t*) &OCR1C},
211
+   { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B, (const uint8_t*)&OCR1C},
212 212
   #else
213
-   { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B,0},
213
+   { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B,0},
214 214
   #endif
215 215
 
216 216
   #if defined(TCCR2A) && defined(COM2A1)
@@ -219,18 +219,18 @@ const volatile uint8_t* const PWM_OCR[][3] PROGMEM = {
219 219
 
220 220
   #if defined(TCCR3A) && defined(COM3A1)
221 221
     #ifdef COM3C1
222
-      { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B, (const uint8_t*) &OCR3C},
222
+      { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B, (const uint8_t*)&OCR3C},
223 223
     #else
224
-      { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B,0},
224
+      { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B,0},
225 225
     #endif
226 226
   #endif
227 227
 
228 228
   #ifdef TCCR4A
229
-    { (const uint8_t*) &OCR4A, (const uint8_t*) &OCR4B, (const uint8_t*) &OCR4C},
229
+    { (const uint8_t*)&OCR4A, (const uint8_t*)&OCR4B, (const uint8_t*)&OCR4C},
230 230
   #endif
231 231
 
232 232
   #if defined(TCCR5A) && defined(COM5A1)
233
-    { (const uint8_t*) &OCR5A, (const uint8_t*) &OCR5B, (const uint8_t*) &OCR5C},
233
+    { (const uint8_t*)&OCR5A, (const uint8_t*)&OCR5B, (const uint8_t*)&OCR5C},
234 234
   #endif
235 235
 };
236 236
 
@@ -262,7 +262,7 @@ static void err_prob_interrupt() {
262 262
 }
263 263
 
264 264
 void com_print(uint8_t N, uint8_t Z) {
265
-  uint8_t *TCCRA = (uint8_t*) TCCR_A(N);
265
+  uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
266 266
   SERIAL_PROTOCOLPGM("    COM");
267 267
   SERIAL_PROTOCOLCHAR(N + '0');
268 268
   switch(Z) {
@@ -278,8 +278,7 @@ void com_print(uint8_t N, uint8_t Z) {
278 278
   }
279 279
 }
280 280
 
281
-
282
-void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  n - WGM bit layout
281
+void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  N - WGM bit layout
283 282
   char buffer[20];   // for the sprintf statements
284 283
   uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
285 284
   uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
@@ -292,11 +291,11 @@ void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  n -
292 291
   SERIAL_PROTOCOLPGM("   ");
293 292
 
294 293
   if (N == 3) {
295
-    uint8_t *OCRVAL8 = (uint8_t*) OCR_VAL(T, L - 'A');
294
+    uint8_t *OCRVAL8 = (uint8_t*)OCR_VAL(T, L - 'A');
296 295
     PWM_PRINT(*OCRVAL8);
297 296
   }
298 297
   else {
299
-    uint16_t *OCRVAL16 = (uint16_t*) OCR_VAL(T, L - 'A');
298
+    uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A');
300 299
     PWM_PRINT(*OCRVAL16);
301 300
   }
302 301
   SERIAL_PROTOCOLPAIR("    WGM: ", WGM);
@@ -311,7 +310,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) {  // T - timer    L - pwm  n -
311 310
   SERIAL_PROTOCOLCHAR(T + '0');
312 311
   SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
313 312
 
314
-  uint8_t *TMSK = (uint8_t*) TIMSK(T);
313
+  uint8_t *TMSK = (uint8_t*)TIMSK(T);
315 314
   SERIAL_PROTOCOLPGM("    TIMSK");
316 315
   SERIAL_PROTOCOLCHAR(T + '0');
317 316
   SERIAL_PROTOCOLPAIR(": ", *TMSK);
@@ -327,76 +326,43 @@ static void pwm_details(uint8_t pin) {
327 326
   switch(digitalPinToTimer(pin)) {
328 327
 
329 328
     #if defined(TCCR0A) && defined(COM0A1)
330
-
331 329
       #ifdef TIMER0A
332
-        case TIMER0A:
333
-          timer_prefix(0,'A',3);
334
-          break;
330
+        case TIMER0A: timer_prefix(0, 'A', 3); break;
335 331
       #endif
336
-      case TIMER0B:
337
-        timer_prefix(0,'B',3);
338
-        break;
332
+      case TIMER0B: timer_prefix(0, 'B', 3); break;
339 333
     #endif
340 334
 
341 335
     #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;
336
+      case TIMER1A: timer_prefix(1, 'A', 4); break;
337
+      case TIMER1B: timer_prefix(1, 'B', 4); break;
348 338
       #if defined(COM1C1) && defined(TIMER1C)
349
-        case TIMER1C:
350
-          timer_prefix(1,'C',4);
351
-          break;
339
+        case TIMER1C: timer_prefix(1, 'C', 4); break;
352 340
       #endif
353 341
     #endif
354 342
 
355 343
     #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;
344
+      case TIMER2A: timer_prefix(2, 'A', 3); break;
345
+      case TIMER2B: timer_prefix(2, 'B', 3); break;
362 346
     #endif
363 347
 
364 348
     #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;
349
+      case TIMER3A: timer_prefix(3, 'A', 4); break;
350
+      case TIMER3B: timer_prefix(3, 'B', 4); break;
371 351
       #ifdef COM3C1
372
-        case TIMER3C:
373
-          timer_prefix(3,'C',4);
374
-          break;
352
+        case TIMER3C: timer_prefix(3, 'C', 4); break;
375 353
       #endif
376 354
     #endif
377 355
 
378 356
     #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;
357
+      case TIMER4A: timer_prefix(4, 'A', 4); break;
358
+      case TIMER4B: timer_prefix(4, 'B', 4); break;
359
+      case TIMER4C: timer_prefix(4, 'C', 4); break;
388 360
     #endif
389 361
 
390 362
     #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;
363
+      case TIMER5A: timer_prefix(5, 'A', 4); break;
364
+      case TIMER5B: timer_prefix(5, 'B', 4); break;
365
+      case TIMER5C: timer_prefix(5, 'C', 4); break;
400 366
     #endif
401 367
 
402 368
     case NOT_ON_TIMER: break;
@@ -472,8 +438,7 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
472 438
         SERIAL_CHAR('.');
473 439
         SERIAL_ECHO_SP(25);  // add padding if not the first instance found
474 440
       }
475
-      else SERIAL_ECHOPGM(".                         ");  // add padding if not the first instance found
476
-      name_mem_pointer = (char*) pgm_read_word(&pin_array[x][0]);
441
+      name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]);
477 442
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
478 443
         temp_char = pgm_read_byte(name_mem_pointer + y);
479 444
         if (temp_char != 0) MYSERIAL.write(temp_char);

Loading…
Cancel
Save