display.h

Go to the documentation of this file.
00001 /**************************************************************************/
00018 #ifndef _DISPLAY_H_
00019 #define _DISPLAY_H_
00020 
00021 #include <stdbool.h>
00022 #include <stdint.h>
00023 #include "emstatus.h"
00024 #include "displayconfigall.h"
00025 
00026 /***************************************************************************/
00031 /***************************************************************************/
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041 
00042 /*******************************************************************************
00043  ********************************  DEFINES  ************************************
00044  ******************************************************************************/
00045 
00047 #define DISPLAY_EMSTATUS_OK                                        (0) 
00048 #define DISPLAY_EMSTATUS_NOT_ENOUGH_MEMORY (DISPLAY_EMSTATUS_BASE | 1) 
00049 #define DISPLAY_EMSTATUS_OUT_OF_RANGE      (DISPLAY_EMSTATUS_BASE | 2) 
00050 #define DISPLAY_EMSTATUS_INVALID_PARAMETER (DISPLAY_EMSTATUS_BASE | 3) 
00051 #define DISPLAY_EMSTATUS_NOT_SUPPORTED     (DISPLAY_EMSTATUS_BASE | 4) 
00052 #define DISPLAY_EMSTATUS_NOT_INITIALIZED   (DISPLAY_EMSTATUS_BASE | 5) 
00055 /*******************************************************************************
00056  ********************************   ENUMS   ************************************
00057  ******************************************************************************/
00058 
00060 typedef enum DISPLAY_ColourMode_t
00061 {
00062   DISPLAY_COLOUR_MODE_MONOCHROME,         
00064   DISPLAY_COLOUR_MODE_MONOCHROME_INVERSE, 
00066 } DISPLAY_ColourMode_t;
00067 
00068 
00070 typedef enum DISPLAY_AddressMode_t
00071 {
00072   DISPLAY_ADDRESSING_BY_ROWS_ONLY,        
00076   DISPLAY_ADDRESSING_BY_ROWS_AND_COLUMNS  
00079 } DISPLAY_AddressMode_t;
00080 
00081 
00083 typedef void* DISPLAY_PixelMatrix_t;
00084 
00085 
00086 /*******************************************************************************
00087  *******************************   STRUCTS   ***********************************
00088  ******************************************************************************/
00089 
00091 typedef struct DISPLAY_Geometry_t
00092 {
00093   unsigned int   width;   
00094   unsigned int   stride;  
00096   unsigned int   height;  
00097 } DISPLAY_Geometry_t;
00098 
00099 
00100 /* Forward declaration of struct DISPLAY_Device_t in order to reference it
00101    inside the typdef. */
00102 struct DISPLAY_Device_t;
00103 
00108 typedef struct DISPLAY_Device_t
00109 {
00110   char*                 name;        
00111   DISPLAY_Geometry_t    geometry;    
00112   DISPLAY_ColourMode_t  colourMode;  
00113   DISPLAY_AddressMode_t addressMode; 
00116   EMSTATUS (*pDisplayPowerOn) (struct DISPLAY_Device_t* device,
00117                                bool                     on);
00118 
00121   EMSTATUS (*pPixelMatrixAllocate) (struct DISPLAY_Device_t* device,
00122                                     unsigned int  width,
00123 #ifdef EMWIN_WORKAROUND
00124                                     unsigned int  userStride,
00125 #endif
00126                                     unsigned int  height,
00127                                     DISPLAY_PixelMatrix_t  *pixelMatrix
00128                                     );
00129   
00131   EMSTATUS (*pPixelMatrixFree) (struct DISPLAY_Device_t* device,
00132                                 DISPLAY_PixelMatrix_t pixelMatrix);
00133   
00136   EMSTATUS (*pPixelMatrixDraw) (struct DISPLAY_Device_t* device,
00137                                 DISPLAY_PixelMatrix_t pixelMatrix,
00138                                 unsigned int startColumn,
00139                                 unsigned int width,
00140 #ifdef EMWIN_WORKAROUND
00141                                 unsigned int userStride,
00142 #endif
00143                                 unsigned int startRow,
00144                                 unsigned int height);
00145   
00147   EMSTATUS (*pPixelMatrixClear) (struct DISPLAY_Device_t* device,
00148                                  DISPLAY_PixelMatrix_t pixelMatrix,
00149                                  unsigned int width,
00150                                  unsigned int height
00151                                  );
00152   
00155   EMSTATUS (*pDriverRefresh) (struct DISPLAY_Device_t* device);
00156   
00157 } DISPLAY_Device_t;
00158 
00159 
00165 typedef EMSTATUS (*pDisplayDeviceDriverInitFunction_t) (void);
00166 
00167 
00168 /*******************************************************************************
00169  **************************    FUNCTION PROTOTYPES    **************************
00170  ******************************************************************************/
00171 
00172 EMSTATUS DISPLAY_Init          (void);
00173 EMSTATUS DISPLAY_DriverRefresh (void);
00174 EMSTATUS DISPLAY_DeviceGet     (int               displayDeviceNo,
00175                                 DISPLAY_Device_t* device);
00176 
00177 #ifdef __cplusplus
00178 }
00179 #endif
00180 
00184 #endif  /*  _DISPLAY_H_  */