364 CHAPTER 13 RTT
J-Link / J-Trace (UM08001) ©
2004-2017 SEGGER Microcontroller GmbH & Co. KG
(2) Supported flags:
• -: Left justify within the field width
• +: Always print sign extension for signed conversions
• 0: Pad with 0 instead of spaces. Ignored when using '-'-flag or precision
(3) Supported conversion specifiers:
• c: Print the argument as one char
• d: Print the argument as a signed integer
• u: Print the argument as an unsigned integer
• x: Print the argument as an hexadecimal integer
• s: Print the string pointed to by the argument
• p: Print the argument as an 8-digit hexadecimal integer. (Argument shall be a
pointer to void.)
13.4.1.7 SEGGER_RTT_Read()
Description
Read characters from any RTT down channel which have been previously stored by
the host.
Prototype
int SEGGER_RTT_Read (unsigned BufferIndex, char* pBuffer, unsigned
BufferSize);
Parameters
Return value
Example
char acIn[4];
int NumBytes = sizeof(acIn);
NumBytes = SEGGER_RTT_Read(0, &acIn[0], NumBytes);
if (NumBytes) {
AnalyzeInput(acIn);
}
13.4.1.8 SEGGER_RTT_SetTerminal()
Description
Set the "virtual" terminal to send following data on channel 0.
Prototype
void SEGGER_RTT_SetTerminal(char TerminalId);
Parameter Meaning
BufferIndex
Index of the down channel to read from.
pBuffer Pointer to a character buffer to store the read characters.
BufferSize Number of bytes available in the buffer.
Table 13.4: SEGGER_RTT_Read() parameter list
>= 0 Number of bytes that have been read.