The tcGuiDspDisplay class allows the user to draw, erase, write text and bitmaps on a simple memory mapped display interface. Support is provided for multiple display screens, including virtual screens that are not mapped directly to the hardware. Any of the hardware-mapped pages may be made visible. ScreenXOR, ScreenOR, and ScreenAND functions are provided to combine screens.
The constructor for the tcGuiDspDisplay class takes as arguments the width, height, and bit depth of the screens, and a number of "screens" of the specified size are created at the provided memory addresses. A default font for text display is also required.
The tcGuiDspDisplay class is a re-implementation of the MityDSP::tcDspDisplay class (included in the core library), which has been deprecated. This class provides additional methods and slightly different interfaces in order to support integration with the ggui Graphical User Interface library, a view/widget based graphics library supported by the MityDSP CPU engine.
While raw use of this class is possible, typically this class will be used with a MityDSP::tcGuiFramework class in order to support ggui based human machine interface.
This is a simple example of tcGuiDspDisplay creation and usage:
#define NUM_LCD_SCREENS 2 #define LCD_COMMAND_ADDR 0xA0000800 #define SCR1_ADDR 0xA0000000 #define SCR2_ADDR 0xA0000400 #define SCR_WIDTH 128 #define SCR_HEIGHT 64 #define SCR_DEPTH 16 { unsigned char *lcd_screens[NUM_LCD_SCREENS] = { (unsigned char *)SCR1_ADDR, (unsigned char *)SCR2_ADDR }; tcDspFont *lpNarrowFont; tcGuiDspDisplay *lpLCD; // create fonts to use on display lpNarrowFont = new tcDspFont(/* see tcDspFont for details */); // create the display interface lpLCD = new tcGuiDspDisplay(SCR_WIDTH, SCR_HEIGHT, SCR_DEPTH, NUM_LCD_SCREENS, (void *)LCD_COMMAND_ADDR, (void **)lcd_screens, lpNarrowFont); tcGuiDspDisplay::screenCoords_t new_pos; // make screen_1 visible while we draw on screen_2 mpLCD->setActiveScreen(tcGuiDspDisplay::screen_1); mpLCD->clearScreen(NULL,NULL); mpLCD->setVisibleScreen(tcGuiDspDisplay::screen_1); mpLCD->setActiveScreen(tcGuiDspDisplay::screen_2); mpLCD->clearScreen(NULL,NULL); // say hi! new_pos = mpLCD->drawText(7,0,"Hello World!"); new_pos = mpLCD->drawText(new_pos," MityDSP here!"); // draw a logo bitmap tcBitmap bmp (LOGO_WIDTH, LOGO_HEIGHT, 1, Logo); mpLCD->drawBitmap(16, 11, bmp); // make screen_2 visible, and now draw on screen_1 mpLCD->setVisibleScreen(screen_2); ... }