⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdk7a404_peg_lcd_driver.hpp

📁 含t h r e a d x,u c o s 的b s p
💻 HPP
字号:
/*--------------------------------------------------------------------------*
 * $Workfile:   sdk7a404_peg_lcd_driver.hpp  $
 * $Revision:   1.1  $
 * $Author:   WellsK  $
 * $Date:   Oct 28 2003 11:15:58  $
 *
 * LCD display driver for the Logic PD SDK7A404 EVB
 *
 * Notes:
 *     Uncomment only one of the LCD types below. This driver assumes all
 *     configurations are 16-bit and unpalletized. Be sure to make the
 *     necessary changes in the pconfig.hpp (such as setting PEG_NUM_COLORS
 *     to 65535 colors). Also, the RGB_USE_555 defines should be used in
 *     pegtypes.hpp to define RGB555 color.
 *
 * Revision History:
 * $Log:   //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a404/bsps/sdk7a404/ports/peg/sdk7a404_peg_lcd_driver.hpp-arc  $
 * 
 *    Rev 1.1   Oct 28 2003 11:15:58   WellsK
 * Updated to use common LCD drivers.
 * 
 *    Rev 1.0   Sep 25 2003 09:29:18   WellsK
 * Initial revision.
 *
 *--------------------------------------------------------------------------*/

#ifndef SDK7A404_PEG_DISP_DRIVER
#define SDK7A404_PEG_DISP_DRIVER

// The pconfig file is pulled in to get the display type
#include "pconfig.hpp"

// Pick only one of the following LPD display kits
//#define lq035q7db02
//#define lq039q2ds53
//#define lq057q3dc02
//#define lq064d343
//#define lq104v1dg31
#define lq121s1dg31

/*--------------------------------------------------------------------------*/
// Default resolution based on panel type
/*--------------------------------------------------------------------------*/
#ifdef lq035q7db02
#define PEG_VIRTUAL_XSIZE 240
#define PEG_VIRTUAL_YSIZE 320
#define LCDPANEL sharp_lq035
#endif

#ifdef lq039q2ds53
#define PEG_VIRTUAL_XSIZE 320
#define PEG_VIRTUAL_YSIZE 240
#define LCDPANEL sharp_lq039
#endif

#ifdef lq057q3dc02
#define PEG_VIRTUAL_XSIZE 320
#define PEG_VIRTUAL_YSIZE 240
#define LCDPANEL sharp_lq057
#endif

#ifdef lq064d343
#define PEG_VIRTUAL_XSIZE 640
#define PEG_VIRTUAL_YSIZE 480
#define LCDPANEL sharp_lq064
#endif

#ifdef lq104v1dg31
#define PEG_VIRTUAL_XSIZE 640
#define PEG_VIRTUAL_YSIZE 480
#define LCDPANEL sharp_lq104
#endif

#ifdef lq121s1dg31
#define PEG_VIRTUAL_XSIZE 800
#define PEG_VIRTUAL_YSIZE 600
#define LCDPANEL sharp_lq121
#endif

#ifndef LCDPANEL
#error ERROR - Display type not configured in sdk7a404_peg_lcd_driver.hpp
#endif

/*--------------------------------------------------------------------------*/
#define PlotPointView(x, y, c) \
        *(mpScanPointers[y] + x) = (COLORVAL) c;

/*--------------------------------------------------------------------------*/
// Class description
/*--------------------------------------------------------------------------*/
class SDK7A400_LCD : public PegScreen
{
    public:
        // Constructor - inits display, sets up class data
        SDK7A400_LCD(PegRect &);

        // Deletes dynamics allocated in constructor, display stays active
        virtual ~SDK7A400_LCD();

        /*------------------------------------------------------------------*/
        // Mandatory overrided virtual functions in PegScreen
        /*------------------------------------------------------------------*/
        void BeginDraw(PegThing *pThing);
        void EndDraw();
        void BeginDraw(PegThing *Caller, PegBitmap *pMap);
        void EndDraw(PegBitmap *pMap);
        void SetPointerType(UCHAR bType);
        void HidePointer(void);
        void SetPointer(PegPoint Where);
        void Capture(PegCapture *Info, PegRect &Rect);
        void  SetPalette(SIGNED iFirst, SIGNED iNum, const UCHAR *pGet);
        UCHAR *GetPalette(DWORD *pPutSize);
        void ResetPalette(void);

#ifdef PEG_IMAGE_SCALING
        COLORVAL GetBitmapPixel(SIGNED x, SIGNED y, PegBitmap *pMap)
        {
            COLORVAL *_pGet = (COLORVAL *) pMap->pStart;
            _pGet += pMap->wWidth * y;
            _pGet += x;
            return *_pGet;
        }
        void PutBitmapPixel(SIGNED x, SIGNED y, PegBitmap *pMap, COLORVAL c)
        {
            COLORVAL *_pPut = (COLORVAL *) pMap->pStart;
            _pPut += pMap->wWidth * y;
            _pPut += x;
            *_pPut = c;
        }
#endif
        /*------------------------------------------------------------------*/
        // End mandatory virtual function overrides
        /*------------------------------------------------------------------*/

        /*------------------------------------------------------------------*/
        // Optional overrided virtual functions in PegScreen
        /*------------------------------------------------------------------*/
        PegBitmap *CreateBitmap(SIGNED wWidth, SIGNED wHeight);
        /*------------------------------------------------------------------*/
        // End optional virtual function overrides
        /*------------------------------------------------------------------*/

        // Updates the pixel clock from the system bus clock, should be
        // called whenever the CPU or bus speed is changed
        unsigned long UpdatePixelClock(void);

    protected:    
        // None

    private:
        /*------------------------------------------------------------------*/
        // Mandatory overridden protected virtual functions
        /*------------------------------------------------------------------*/
        void DrawTextView(PegPoint Put, const PEGCHAR *Text,
            PegColor &Color, PegFont *pFont, SIGNED iLen, PegRect &View);
        void LineView(SIGNED xStart, SIGNED yStart,
            SIGNED xEnd, SIGNED yEnd,  PegRect &View, PegColor Color,
            SIGNED iWidth);
        void BitmapView(const PegPoint Where,
            const PegBitmap *pMap, const PegRect &View);
        void RectMoveView(PegThing *Caller, const PegRect &View,
            const SIGNED xMove, const SIGNED yMove);
        void HorizontalLine(SIGNED xStart, SIGNED xEnd,
            SIGNED y, COLORVAL cColor, SIGNED iWidth);
        void VerticalLine(SIGNED yStart, SIGNED yEnd,
            SIGNED x, COLORVAL cColor, SIGNED iWidth);
        void HorizontalLineXOR(SIGNED xs, SIGNED xe, SIGNED y);
        void VerticalLineXOR(SIGNED ys, SIGNED ye, SIGNED x);
        COLORVAL GetPixelView(SIGNED x, SIGNED y)
        {
            return((COLORVAL) *(mpScanPointers[y] + x));
        }
        /*------------------------------------------------------------------*/
        // End mandatory protected virtual function overrides
        /*------------------------------------------------------------------*/

        // RLE map
        void DrawRleBitmap(const PegPoint Where, const PegRect View,
            const PegBitmap *Getmap);

        // Draw an 8-bit image to the window
        void Draw8BitBitmap(const PegPoint Where, const PegRect View,
            const PegBitmap *Getmap);

        // Local pointer maintainence data
        BOOL mbPointerHidden;
        PegCapture mCapture;
        PegPoint  mLastPointerPos;

        // 8-bit to 16-bit color conversion palette
        COLORVAL  mcHiPalette[256];

        // BLIT routine to dump shadowed frame buffer to active video
        // memory, only used in double buffering mode
        void MemoryToScreen (void);

        // Returns a pointer to the frame buffer used for the display
        UCHAR *GetVideoAddress(void);

        // Returns the optimal pixel clock divider for the LCD controller
        unsigned long lcd_get_divider (void);

        // Returns the speed in MHZ of the bus clock (HCLK)
        unsigned long csc_get_hclk (void);

        // Used by constructor to initialize the LCD controller
        void ConfigureController(void);
};

#endif // SDK7A404_PEG_DISP_DRIVER

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -