Some classes and macros to enable quick single line trace and watch facilities. Three macros DBUG_INIT, TRACE & WATCH are used to implement all functions. DBUG_INIT is used to allocate the maximum number of watch items that are to be displayed at any time. The remainder of the VT100 emulation screen will be dedicated to the scrolling trace function. The use of macros means that they will be ignored by the compiler when the debug declaration is removed. To assist in formatting the string output I have implemented a caret field that is interpreted as a screen attribute eg ^R reverse video on ^r reverse video off. Look at the VT100 class for further details. This was completed for a rush project about 10 minutes ago so expect a few issues to become apparent.

Dependencies:   mbed

Committer:
ChrisHatfield
Date:
Mon Jan 04 23:25:20 2010 +0000
Revision:
0:0c4137d26c2e

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ChrisHatfield 0:0c4137d26c2e 1 #pragma once
ChrisHatfield 0:0c4137d26c2e 2 #include <stdarg.h>
ChrisHatfield 0:0c4137d26c2e 3 #include "mbed.h"
ChrisHatfield 0:0c4137d26c2e 4
ChrisHatfield 0:0c4137d26c2e 5 class CVT100
ChrisHatfield 0:0c4137d26c2e 6 {
ChrisHatfield 0:0c4137d26c2e 7 public:
ChrisHatfield 0:0c4137d26c2e 8 CVT100(void);
ChrisHatfield 0:0c4137d26c2e 9 ~CVT100(void);
ChrisHatfield 0:0c4137d26c2e 10 enum {Rows = 24, Columns = 80};
ChrisHatfield 0:0c4137d26c2e 11 //Attributes
ChrisHatfield 0:0c4137d26c2e 12 Serial* m_pVT100;
ChrisHatfield 0:0c4137d26c2e 13
ChrisHatfield 0:0c4137d26c2e 14 //Interface
ChrisHatfield 0:0c4137d26c2e 15 void printf(const char *lpszFormat, ...);
ChrisHatfield 0:0c4137d26c2e 16 void printf(unsigned char nCol, unsigned char nRow, const char *lpszFormat, ...);
ChrisHatfield 0:0c4137d26c2e 17 void vprintf(const char *lpszFormat, va_list);
ChrisHatfield 0:0c4137d26c2e 18 void vprintf(unsigned char nCol, unsigned char nRow, const char *lpszFormat, va_list);
ChrisHatfield 0:0c4137d26c2e 19 void ClearScreen(void);
ChrisHatfield 0:0c4137d26c2e 20 void SaveCursor(void);
ChrisHatfield 0:0c4137d26c2e 21 void CursorOff(bool bOff = true);
ChrisHatfield 0:0c4137d26c2e 22 void RestoreCursor(void);
ChrisHatfield 0:0c4137d26c2e 23 void MoveXY(unsigned char nCol, unsigned char nRow);
ChrisHatfield 0:0c4137d26c2e 24 void SetScroll(unsigned char nStart, unsigned char nEnd);
ChrisHatfield 0:0c4137d26c2e 25 void PutString(const char *lpszOutput);
ChrisHatfield 0:0c4137d26c2e 26 char* FormatString(const char *lpszFormat);
ChrisHatfield 0:0c4137d26c2e 27 };