Accept both CR and LF to denote newline.
[uccvend-snackrom.git] / ROM2 / main_basic.c
index 3e88648..888932e 100644 (file)
@@ -123,18 +123,14 @@ void ping_pong() {
        /* make sure it's really a ping */
        if (sci_rx_buf[1] != 'I' ||
                sci_rx_buf[2] != 'N' ||
-               sci_rx_buf[3] != 'G') {
+               sci_rx_buf[3] != 'G' ||
+               sci_rx_buf[4] != '\0') {
                send_nack();
                return;
        }
        /* respond with ack & pong */
        wait_for_tx_free();
-       sci_tx_buf[0] = 'P';
-       sci_tx_buf[1] = 'O';
-       sci_tx_buf[2] = 'N';
-       sci_tx_buf[3] = 'G';
-       sci_tx_buf[4] = '\n';
-       sci_tx_buf[5] = 0;
+       my_strncpy(sci_tx_buf, "PONG\n", BUFFER_LEN);
        send_packet();
 }
 

UCC git Repository :: git.ucc.asn.au