backspace works

This commit is contained in:
hugogogo
2025-03-07 17:58:11 +01:00
parent 3140b1a491
commit 91788897b1
3 changed files with 29 additions and 22 deletions

View File

@@ -142,7 +142,13 @@ void uart_tx(char c) {
ISR(USART_RX_vect) { // Table 12-7 : we select the code for USART Receive
// char received_char = uart_rx();
char received_char = UDR0; // Read received character
uart_tx(SWITCH_CASE(received_char)); // Toggle case and send back
if (received_char == '\b' || received_char == 127) { // If backspace is received
uart_tx('\b'); // Move cursor back
uart_tx(' '); // Erase the character on screen
uart_tx('\b'); // Move cursor back again
} else {
uart_tx(SWITCH_CASE(received_char)); // Toggle case and send back
}
}
// send back caracters received on serial port with case toggling, using interupt and empty infinite loop