예제 #1
0
파일: atmega_serial.c 프로젝트: a1ien/nuttx
int up_putc(int ch)
{
#ifdef HAVE_SERIAL_CONSOLE
  uint8_t imr;

#if defined(CONFIG_USART0_SERIAL_CONSOLE)
  usart0_disableusartint(&imr);
#else
  usart1_disableusartint(&imr);
#endif

  /* Check for LF */

  if (ch == '\n')
    {
      /* Add CR */

      up_lowputc('\r');
    }

  up_lowputc(ch);

#if defined(CONFIG_USART0_SERIAL_CONSOLE)
  usart0_restoreusartint(imr);
#else
  usart1_restoreusartint(imr);
#endif
#endif

  return ch;
}
예제 #2
0
int up_putc(int ch)
{
#ifdef HAVE_SERIAL_CONSOLE
  uint8_t imr;

  usart1_disableusartint(&imr);

  /* Check for LF */

  if (ch == '\n')
    {
      /* Add CR */

      up_lowputc('\r');
    }

  up_lowputc(ch);
  usart1_restoreusartint(imr);
#endif
  return ch;
}