void __attribute__ ((interrupt)) USART2_handler(void) { char c = USART2_recv(); // Always immediately read the input switch (mode_state) { case CONFIGURE_S: // In configure mode, pass it along to the WiFly USART3_send(c); break; default: // Other modes just echo back input USART2_send(c); break; } }
/* * The USART2 Interrupt Service Routine */ void __attribute__ ((interrupt)) USART2_handler(void) { /* This code receives input from the USART2 * interface and repeats it back to the user * on the same interface. */ uint8_t c = USART2_recv(); USART2_send(c); //Check if the input was one of our commands: //h - history if(c == 'h'){ //Print the history } if(c == 'a'){ //Print the average of the history } }