Cleanups to pins debugging

This commit is contained in:
Scott Lahteine 2017-04-30 18:36:56 -05:00
parent 42824b0e1f
commit 819df5e06d

View file

@ -278,8 +278,7 @@ void com_print(uint8_t N, uint8_t Z) {
} }
} }
void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - WGM bit layout
void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm n - WGM bit layout
char buffer[20]; // for the sprintf statements char buffer[20]; // for the sprintf statements
uint8_t *TCCRB = (uint8_t*)TCCR_B(T); uint8_t *TCCRB = (uint8_t*)TCCR_B(T);
uint8_t *TCCRA = (uint8_t*)TCCR_A(T); uint8_t *TCCRA = (uint8_t*)TCCR_A(T);
@ -327,76 +326,43 @@ static void pwm_details(uint8_t pin) {
switch(digitalPinToTimer(pin)) { switch(digitalPinToTimer(pin)) {
#if defined(TCCR0A) && defined(COM0A1) #if defined(TCCR0A) && defined(COM0A1)
#ifdef TIMER0A #ifdef TIMER0A
case TIMER0A: case TIMER0A: timer_prefix(0, 'A', 3); break;
timer_prefix(0,'A',3);
break;
#endif #endif
case TIMER0B: case TIMER0B: timer_prefix(0, 'B', 3); break;
timer_prefix(0,'B',3);
break;
#endif #endif
#if defined(TCCR1A) && defined(COM1A1) #if defined(TCCR1A) && defined(COM1A1)
case TIMER1A: case TIMER1A: timer_prefix(1, 'A', 4); break;
timer_prefix(1,'A',4); case TIMER1B: timer_prefix(1, 'B', 4); break;
break;
case TIMER1B:
timer_prefix(1,'B',4);
break;
#if defined(COM1C1) && defined(TIMER1C) #if defined(COM1C1) && defined(TIMER1C)
case TIMER1C: case TIMER1C: timer_prefix(1, 'C', 4); break;
timer_prefix(1,'C',4);
break;
#endif #endif
#endif #endif
#if defined(TCCR2A) && defined(COM2A1) #if defined(TCCR2A) && defined(COM2A1)
case TIMER2A: case TIMER2A: timer_prefix(2, 'A', 3); break;
timer_prefix(2,'A',3); case TIMER2B: timer_prefix(2, 'B', 3); break;
break;
case TIMER2B:
timer_prefix(2,'B',3);
break;
#endif #endif
#if defined(TCCR3A) && defined(COM3A1) #if defined(TCCR3A) && defined(COM3A1)
case TIMER3A: case TIMER3A: timer_prefix(3, 'A', 4); break;
timer_prefix(3,'A',4); case TIMER3B: timer_prefix(3, 'B', 4); break;
break;
case TIMER3B:
timer_prefix(3,'B',4);
break;
#ifdef COM3C1 #ifdef COM3C1
case TIMER3C: case TIMER3C: timer_prefix(3, 'C', 4); break;
timer_prefix(3,'C',4);
break;
#endif #endif
#endif #endif
#ifdef TCCR4A #ifdef TCCR4A
case TIMER4A: case TIMER4A: timer_prefix(4, 'A', 4); break;
timer_prefix(4,'A',4); case TIMER4B: timer_prefix(4, 'B', 4); break;
break; case TIMER4C: timer_prefix(4, 'C', 4); break;
case TIMER4B:
timer_prefix(4,'B',4);
break;
case TIMER4C:
timer_prefix(4,'C',4);
break;
#endif #endif
#if defined(TCCR5A) && defined(COM5A1) #if defined(TCCR5A) && defined(COM5A1)
case TIMER5A: case TIMER5A: timer_prefix(5, 'A', 4); break;
timer_prefix(5,'A',4); case TIMER5B: timer_prefix(5, 'B', 4); break;
break; case TIMER5C: timer_prefix(5, 'C', 4); break;
case TIMER5B:
timer_prefix(5,'B',4);
break;
case TIMER5C:
timer_prefix(5,'C',4);
break;
#endif #endif
case NOT_ON_TIMER: break; case NOT_ON_TIMER: break;
@ -472,7 +438,6 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = t
SERIAL_CHAR('.'); SERIAL_CHAR('.');
SERIAL_ECHO_SP(25); // add padding if not the first instance found SERIAL_ECHO_SP(25); // add padding if not the first instance found
} }
else SERIAL_ECHOPGM(". "); // add padding if not the first instance found
name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]); name_mem_pointer = (char*)pgm_read_word(&pin_array[x][0]);
for (uint8_t y = 0; y < 28; y++) { // always print pin name for (uint8_t y = 0; y < 28; y++) { // always print pin name
temp_char = pgm_read_byte(name_mem_pointer + y); temp_char = pgm_read_byte(name_mem_pointer + y);