mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
ESP32: Add implementation of up_putc
This commit is contained in:
@@ -1231,4 +1231,37 @@ void xtensa_serial_initialize(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_putc
|
||||
*
|
||||
* Description:
|
||||
* Provide priority, low-level access to support OS debug writes
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
#ifdef HAVE_SERIAL_CONSOLE
|
||||
uint32_t intena;
|
||||
|
||||
esp32_disableallints(CONSOLE_DEV.priv, &intena);
|
||||
|
||||
/* Check for LF */
|
||||
|
||||
if (ch == '\n')
|
||||
{
|
||||
/* Add CR */
|
||||
|
||||
while(!esp32_txready(&CONSOLE_DEV));
|
||||
esp32_send(&CONSOLE_DEV, 'r');
|
||||
}
|
||||
|
||||
while(!esp32_txready(&CONSOLE_DEV));
|
||||
esp32_send(&CONSOLE_DEV, ch);
|
||||
|
||||
esp32_restoreuartint(CONSOLE_DEV.priv, intena);
|
||||
#endif
|
||||
|
||||
return ch;
|
||||
}
|
||||
#endif /* USE_SERIALDRIVER */
|
||||
|
||||
Reference in New Issue
Block a user