🎨 Fewer serial macros
This commit is contained in:
committed by
Scott Lahteine
parent
6d96c221bd
commit
b661795ae5
@ -267,11 +267,11 @@ uint16_t set_pwm_frequency_hz(const_float_t hz, const float dca, const float dcb
|
||||
SET_WGM(5, FAST_PWM_ICRn); // Fast PWM with ICR5 as TOP
|
||||
|
||||
//SERIAL_ECHOLNPGM("Timer 5 Settings:");
|
||||
//SERIAL_ECHOLNPAIR(" Prescaler=", prescaler);
|
||||
//SERIAL_ECHOLNPAIR(" TOP=", ICR5);
|
||||
//SERIAL_ECHOLNPAIR(" OCR5A=", OCR5A);
|
||||
//SERIAL_ECHOLNPAIR(" OCR5B=", OCR5B);
|
||||
//SERIAL_ECHOLNPAIR(" OCR5C=", OCR5C);
|
||||
//SERIAL_ECHOLNPGM(" Prescaler=", prescaler);
|
||||
//SERIAL_ECHOLNPGM(" TOP=", ICR5);
|
||||
//SERIAL_ECHOLNPGM(" OCR5A=", OCR5A);
|
||||
//SERIAL_ECHOLNPGM(" OCR5B=", OCR5B);
|
||||
//SERIAL_ECHOLNPGM(" OCR5C=", OCR5C);
|
||||
}
|
||||
else {
|
||||
// Restore the default for Timer 5
|
||||
|
@ -235,9 +235,9 @@ static void print_is_also_tied() { SERIAL_ECHOPGM(" is also tied to this pin");
|
||||
|
||||
inline void com_print(const uint8_t N, const uint8_t Z) {
|
||||
const uint8_t *TCCRA = (uint8_t*)TCCR_A(N);
|
||||
SERIAL_ECHOPAIR(" COM", AS_DIGIT(N));
|
||||
SERIAL_ECHOPGM(" COM", AS_DIGIT(N));
|
||||
SERIAL_CHAR(Z);
|
||||
SERIAL_ECHOPAIR(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03));
|
||||
SERIAL_ECHOPGM(": ", int((*TCCRA >> (6 - Z * 2)) & 0x03));
|
||||
}
|
||||
|
||||
void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N - WGM bit layout
|
||||
@ -247,7 +247,7 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
|
||||
uint8_t WGM = (((*TCCRB & _BV(WGM_2)) >> 1) | (*TCCRA & (_BV(WGM_0) | _BV(WGM_1))));
|
||||
if (N == 4) WGM |= ((*TCCRB & _BV(WGM_3)) >> 1);
|
||||
|
||||
SERIAL_ECHOPAIR(" TIMER", AS_DIGIT(T));
|
||||
SERIAL_ECHOPGM(" TIMER", AS_DIGIT(T));
|
||||
SERIAL_CHAR(L);
|
||||
SERIAL_ECHO_SP(3);
|
||||
|
||||
@ -259,14 +259,14 @@ void timer_prefix(uint8_t T, char L, uint8_t N) { // T - timer L - pwm N -
|
||||
const uint16_t *OCRVAL16 = (uint16_t*)OCR_VAL(T, L - 'A');
|
||||
PWM_PRINT(*OCRVAL16);
|
||||
}
|
||||
SERIAL_ECHOPAIR(" WGM: ", WGM);
|
||||
SERIAL_ECHOPGM(" WGM: ", WGM);
|
||||
com_print(T,L);
|
||||
SERIAL_ECHOPAIR(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
|
||||
SERIAL_ECHOPAIR(" TCCR", AS_DIGIT(T), "A: ", *TCCRA);
|
||||
SERIAL_ECHOPAIR(" TCCR", AS_DIGIT(T), "B: ", *TCCRB);
|
||||
SERIAL_ECHOPGM(" CS: ", (*TCCRB & (_BV(CS_0) | _BV(CS_1) | _BV(CS_2)) ));
|
||||
SERIAL_ECHOPGM(" TCCR", AS_DIGIT(T), "A: ", *TCCRA);
|
||||
SERIAL_ECHOPGM(" TCCR", AS_DIGIT(T), "B: ", *TCCRB);
|
||||
|
||||
const uint8_t *TMSK = (uint8_t*)TIMSK(T);
|
||||
SERIAL_ECHOPAIR(" TIMSK", AS_DIGIT(T), ": ", *TMSK);
|
||||
SERIAL_ECHOPGM(" TIMSK", AS_DIGIT(T), ": ", *TMSK);
|
||||
|
||||
const uint8_t OCIE = L - 'A' + 1;
|
||||
if (N == 3) { if (WGM == 0 || WGM == 2 || WGM == 4 || WGM == 6) err_is_counter(); }
|
||||
|
Reference in New Issue
Block a user