Browse Source

Cleanups to pins debugging

Scott Lahteine 8 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
 #undef REPORT_NAME_DIGITAL
72
 #undef REPORT_NAME_DIGITAL
73
 #undef REPORT_NAME_ANALOG
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
 #define _ADD_PIN( NAME, COUNTER, IS_DIGITAL)  _ADD_PIN_2( entry_NAME_##COUNTER, NAME, 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)
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)
78
 #define REPORT_NAME_ANALOG(NAME, COUNTER)  _ADD_PIN( analogInputToDigitalPin(NAME), COUNTER, 0)
208
   #endif
208
   #endif
209
 
209
 
210
   #if defined(COM1C1) && defined(TIMER1C)
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
   #else
212
   #else
213
-   { (const uint8_t*) &OCR1A, (const uint8_t*) &OCR1B,0},
213
+   { (const uint8_t*)&OCR1A, (const uint8_t*)&OCR1B,0},
214
   #endif
214
   #endif
215
 
215
 
216
   #if defined(TCCR2A) && defined(COM2A1)
216
   #if defined(TCCR2A) && defined(COM2A1)
219
 
219
 
220
   #if defined(TCCR3A) && defined(COM3A1)
220
   #if defined(TCCR3A) && defined(COM3A1)
221
     #ifdef COM3C1
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
     #else
223
     #else
224
-      { (const uint8_t*) &OCR3A, (const uint8_t*) &OCR3B,0},
224
+      { (const uint8_t*)&OCR3A, (const uint8_t*)&OCR3B,0},
225
     #endif
225
     #endif
226
   #endif
226
   #endif
227
 
227
 
228
   #ifdef TCCR4A
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
   #endif
230
   #endif
231
 
231
 
232
   #if defined(TCCR5A) && defined(COM5A1)
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
   #endif
234
   #endif
235
 };
235
 };
236
 
236
 
262
 }
262
 }
263
 
263
 
264
 void com_print(uint8_t N, uint8_t Z) {
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
   SERIAL_PROTOCOLPGM("    COM");
266
   SERIAL_PROTOCOLPGM("    COM");
267
   SERIAL_PROTOCOLCHAR(N + '0');
267
   SERIAL_PROTOCOLCHAR(N + '0');
268
   switch(Z) {
268
   switch(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
   char buffer[20];   // for the sprintf statements
282
   char buffer[20];   // for the sprintf statements
284
   uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
283
   uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
285
   uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
284
   uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
292
   SERIAL_PROTOCOLPGM("   ");
291
   SERIAL_PROTOCOLPGM("   ");
293
 
292
 
294
   if (N == 3) {
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
     PWM_PRINT(*OCRVAL8);
295
     PWM_PRINT(*OCRVAL8);
297
   }
296
   }
298
   else {
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
     PWM_PRINT(*OCRVAL16);
299
     PWM_PRINT(*OCRVAL16);
301
   }
300
   }
302
   SERIAL_PROTOCOLPAIR("    WGM: ", WGM);
301
   SERIAL_PROTOCOLPAIR("    WGM: ", WGM);
311
   SERIAL_PROTOCOLCHAR(T + '0');
310
   SERIAL_PROTOCOLCHAR(T + '0');
312
   SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
311
   SERIAL_PROTOCOLPAIR("B: ", *TCCRB);
313
 
312
 
314
-  uint8_t *TMSK = (uint8_t*) TIMSK(T);
313
+  uint8_t *TMSK = (uint8_t*)TIMSK(T);
315
   SERIAL_PROTOCOLPGM("    TIMSK");
314
   SERIAL_PROTOCOLPGM("    TIMSK");
316
   SERIAL_PROTOCOLCHAR(T + '0');
315
   SERIAL_PROTOCOLCHAR(T + '0');
317
   SERIAL_PROTOCOLPAIR(": ", *TMSK);
316
   SERIAL_PROTOCOLPAIR(": ", *TMSK);
327
   switch(digitalPinToTimer(pin)) {
326
   switch(digitalPinToTimer(pin)) {
328
 
327
 
329
     #if defined(TCCR0A) && defined(COM0A1)
328
     #if defined(TCCR0A) && defined(COM0A1)
330
-
331
       #ifdef TIMER0A
329
       #ifdef TIMER0A
332
-        case TIMER0A:
333
-          timer_prefix(0,'A',3);
334
-          break;
330
+        case TIMER0A: timer_prefix(0, 'A', 3); break;
335
       #endif
331
       #endif
336
-      case TIMER0B:
337
-        timer_prefix(0,'B',3);
338
-        break;
332
+      case TIMER0B: timer_prefix(0, 'B', 3); break;
339
     #endif
333
     #endif
340
 
334
 
341
     #if defined(TCCR1A) && defined(COM1A1)
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
       #if defined(COM1C1) && defined(TIMER1C)
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
       #endif
340
       #endif
353
     #endif
341
     #endif
354
 
342
 
355
     #if defined(TCCR2A) && defined(COM2A1)
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
     #endif
346
     #endif
363
 
347
 
364
     #if defined(TCCR3A) && defined(COM3A1)
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
       #ifdef COM3C1
351
       #ifdef COM3C1
372
-        case TIMER3C:
373
-          timer_prefix(3,'C',4);
374
-          break;
352
+        case TIMER3C: timer_prefix(3, 'C', 4); break;
375
       #endif
353
       #endif
376
     #endif
354
     #endif
377
 
355
 
378
     #ifdef TCCR4A
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
     #endif
360
     #endif
389
 
361
 
390
     #if defined(TCCR5A) && defined(COM5A1)
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
     #endif
366
     #endif
401
 
367
 
402
     case NOT_ON_TIMER: break;
368
     case NOT_ON_TIMER: break;
472
         SERIAL_CHAR('.');
438
         SERIAL_CHAR('.');
473
         SERIAL_ECHO_SP(25);  // add padding if not the first instance found
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
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
442
       for (uint8_t y = 0; y < 28; y++) {                   // always print pin name
478
         temp_char = pgm_read_byte(name_mem_pointer + y);
443
         temp_char = pgm_read_byte(name_mem_pointer + y);
479
         if (temp_char != 0) MYSERIAL.write(temp_char);
444
         if (temp_char != 0) MYSERIAL.write(temp_char);

Loading…
Cancel
Save