printer: avr: Extend test mode

This commit is contained in:
Markus Koch 2019-11-10 20:12:20 +01:00
parent d3997d6049
commit 9a896c3314

View File

@ -13,6 +13,7 @@ inline void spi_process_data();
enum TIMERS{TIM_CARRIAGE, enum TIMERS{TIM_CARRIAGE,
TIM_WHEEL, TIM_WHEEL,
TIM_LINEFEED, TIM_LINEFEED,
TIM_SYSTEM,
TIMS}; TIMS};
#define TIMESCALE 4 #define TIMESCALE 4
@ -753,15 +754,18 @@ void initialize_paperfeed()
// } // }
//} //}
//void systick_test() void systick_test()
//{ {
// debug_write("[tmr] System timer test\r\n"); debug_write("[tmr] System timer test\r\n");
// while (1) { while (1) {
// if (block_for(0, 1000 * TIMESCALE)) { if (block_for(TIM_SYSTEM, 1000 * TIMESCALE)) {
// debug_write("hello\n"); debug_write("tick.\r\n");
// } }
// } if (UCSRA & (1 << RXC)) {
//} break;
}
}
}
void hardfault() { void hardfault() {
@ -769,6 +773,12 @@ void hardfault() {
STEPPER_STOP(WHEEL); STEPPER_STOP(WHEEL);
STEPPER_STOP(CARRIAGE); STEPPER_STOP(CARRIAGE);
STEPPER_STOP(LINEFEED); STEPPER_STOP(LINEFEED);
DDRB = 0;
DDRC = 0;
DDRD = 0;
PORTB = 0;
PORTC = 0;
PORTD = 0;
while(1); while(1);
} }
@ -1156,6 +1166,26 @@ int system_test_auto()
default: default:
break; break;
} }
/* System control */
switch (c) {
case 'i':
sei();
debug_write("Interrupts enabled.\r\n");
break;
case 'I':
cli();
debug_write("Interrupts disabled.\r\n");
break;
case 't':
systick_test();
break;
case 'f':
hardfault();
break;
default:
break;
}
} }
} }