diff --git a/lab_2/lab_2.c b/lab_2/lab_2.c index adc70b6..a6e58df 100644 --- a/lab_2/lab_2.c +++ b/lab_2/lab_2.c @@ -1,8 +1,8 @@ /** * Lab 2 * This is configured with GPIO15 as a pseudo button with a pull up resistor - * Since the button is active low, the program will send '1' when the button is not pressed (high) - * and send 'A' to 'Z' when the button is pressed (low) + * Since the button is active low, the program will send '1' when the button + * is not pressed (high) and send 'A' to 'Z' when the button is pressed (low) */ #include @@ -31,7 +31,9 @@ static void uart_transmit(u_char *uart_input) { else { uart_putc(UART_ID, *uart_input); - *uart_input = (*uart_input - 'A' + 1) % 26 + 'A'; // Next character and wrap around back to A + + // Increment character and wrap around if necessary + *uart_input = (*uart_input - 'A' + 1) % 26 + 'A'; } } @@ -89,7 +91,6 @@ static void pin_init() { int main() { // Initialize stdio and pins first - stdio_init_all(); pin_init();