This is a FileHandle interface implementation and retarget registration of the stdio interface to the Segger Real-Time Terminal (RTT) instead of the default serial port. Retargeting will automatically take place if this library is added to the project.

Dependents:   3_Test_AFE 1_Test_Flash_ADC_RTT

Embed: (wiki syntax)

« Back to documentation index

SeggerRTT Class Reference

SeggerRTT Class Reference

Class SeggerRTT. More...

#include <retarget_segger_rtt.h>

Public Member Functions

virtual ssize_t write (const void *buffer, size_t size)
 Write the contents of a buffer to the terminal.
virtual ssize_t read (void *buffer, size_t size)
 Read the contents from the terminal into a buffer (blocking access)
virtual off_t seek (off_t offset, int whence=SEEK_SET)
 Move the file position to a given offset from a given location (this operation is not supported by SeggerRTT)
virtual off_t size ()
 Get the size of the file (this operation is not supported by SeggerRTT)
virtual int isatty ()
 Check if the file in an interactive terminal device.
virtual int close ()
 Close the file to the terminal.
virtual short poll (short events) const
 Check for poll event flags Call is non-blocking - returns instantaneous state of events.

Detailed Description

Class SeggerRTT.

An interface to perform file-like operations for Segger RTT. The "file" in this implementation is the Segger RTT terminal itself.

Definition at line 37 of file retarget_segger_rtt.h.


Member Function Documentation

virtual int close (  ) [virtual]

Close the file to the terminal.

Returns:
0 on success (no explicit open/close possible)

Definition at line 85 of file retarget_segger_rtt.h.

virtual int isatty (  ) [virtual]

Check if the file in an interactive terminal device.

Returns:
true (SeggerRTT is a terminal)

Definition at line 77 of file retarget_segger_rtt.h.

short poll ( short  events ) const [virtual]

Check for poll event flags Call is non-blocking - returns instantaneous state of events.

Parameters:
eventsbitmask of poll events we're interested in - POLLIN/POLLOUT etc.
Returns:
bitmask of poll events that have occurred.

Definition at line 52 of file retarget_segger_rtt.cpp.

ssize_t read ( void *  buffer,
size_t  size 
) [virtual]

Read the contents from the terminal into a buffer (blocking access)

Parameters:
bufferThe buffer to read in to
sizeThe number of bytes to read
Returns:
The number of bytes read, 0 at end of file, negative error on failure

Definition at line 44 of file retarget_segger_rtt.cpp.

virtual off_t seek ( off_t  offset,
int  whence = SEEK_SET 
) [virtual]

Move the file position to a given offset from a given location (this operation is not supported by SeggerRTT)

Returns:
-ESPIPE (illegal seek)

Definition at line 60 of file retarget_segger_rtt.h.

virtual off_t size (  ) [virtual]

Get the size of the file (this operation is not supported by SeggerRTT)

Returns:
-EINVAL (invalid argument)

Definition at line 69 of file retarget_segger_rtt.h.

ssize_t write ( const void *  buffer,
size_t  size 
) [virtual]

Write the contents of a buffer to the terminal.

Parameters:
bufferThe buffer to write from
sizeThe number of bytes to write
Returns:
The number of bytes written, negative error on failure

Definition at line 39 of file retarget_segger_rtt.cpp.