Ejemplo n.º 1
0
void cliRx(uint8_t c)
{
  // read out the data in the buffer and echo it back to the host.
  switch (c)
  {
    case '\r':
      #if CFG_BSP_INTERFACE_DROPCR == 1
      break;
      #endif
    case '\n':
        // terminate the cli_buffer and reset the cli_buffer ptr. then send
        // it to the handler for processing.
        *cli_buffer_ptr = '\0';
        #if CFG_BSP_INTERFACE_SILENTMODE == 0
        printf("\n");
        #endif
        cliParse((char *)cli_buffer);
        cli_buffer_ptr = cli_buffer;
        break;

    case '\b':
        #if CFG_BSP_INTERFACE_SILENTMODE == 0
        printf("%c",c);
        #endif
        if (cli_buffer_ptr == cli_buffer)
        {
            // Send bell alert and space (to maintain position)
            printf("\a ");
        }
        else if (cli_buffer_ptr > cli_buffer)
        {
            cli_buffer_ptr--;
        }
        break;

    default:
        #if CFG_BSP_INTERFACE_SILENTMODE == 0
        printf("%c",c);
        #endif
        *cli_buffer_ptr++ = c;
        break;
  }
}
Ejemplo n.º 2
0
void cliRx(uint8_t c)
{
  // read out the data in the buffer and echo it back to the host.
  switch (c)
  {
    case '\r':
      #if CFG_INTERFACE_DROPCR == 1
      break;
      #endif
    case '\n':
        // terminate the msg and reset the msg ptr. then send
        // it to the handler for processing.
        *msg_ptr = '\0';
        #if CFG_INTERFACE_SILENTMODE == 0
        printf("%s", CFG_PRINTF_NEWLINE);
        #endif
        cliParse((char *)msg);
        msg_ptr = msg;
        break;

    case '\b':
        #if CFG_INTERFACE_SILENTMODE == 0
        printf("%c",c);
        #endif
        if (msg_ptr == msg)
        {
            // Send bell alert and space (to maintain position)
            printf("\a ");
        }
        else if (msg_ptr > msg)
        {
            msg_ptr--;
        }
        break;

    default:
        #if CFG_INTERFACE_SILENTMODE == 0
        printf("%c",c);
        #endif
        *msg_ptr++ = c;
        break;
  }
}