LCD LIB

Dependents:   HagridOS5

Fork of RA8875 by David Smart

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DisplayDefs.h Source File

DisplayDefs.h

00001 #ifndef DISPLAYDEFS_H
00002 #define DISPLAYDEFS_H
00003 
00004 #define RGB(r,g,b) ( ((r<<8)&0xF800) | ((g<<3)&0x07E0) | (b>>3) )
00005 
00006 
00007 /// Return values from functions. Use this number, or use the 
00008 /// lookup function to get a text string. @see GetErrorMessage.
00009 ///
00010 typedef enum
00011 {
00012     noerror,                ///< no errors, command completed successfully
00013     bad_parameter,          ///< one or more parameters are invalid
00014     file_not_found,         ///< specified file could not be found
00015     not_bmp_format,         ///< file is not a .bmp file
00016     not_ico_format,         ///< file is not a .ico file
00017     not_supported_format,   ///< file format is not yet supported (e.g. bits per pixel, compression)
00018     image_too_big,          ///< image is too large for the screen
00019     not_enough_ram,         ///< could not allocate ram for scanline
00020     touch_cal_timeout,      ///< timeout while trying to calibrate touchscreen, perhaps it is not installed.
00021     external_abort,         ///< an external process caused an abort
00022     LastErrCode,            // Private marker.
00023 } RetCode_t;
00024 
00025 /// return values from TouchPanelReadable, TouchPanelA2DRaw, TouchPanelA2DFiltered.
00026 /// @see TouchPanelReadable.
00027 typedef enum
00028 {
00029     no_touch,               ///< no touch is detected
00030     touch,                  ///< touch is detected
00031     held,                   ///< held after touch
00032     release,                ///< release is detected
00033     no_cal,                 ///< no calibration matrix is available
00034 } TouchCode_t;
00035 
00036 /// Data type that manages locations, which is typically an x or y pixel location,
00037 /// which can range from -N to +N (even if the screen is 0 to +n). @see textloc_t.
00038 typedef int16_t loc_t;
00039 
00040 /// Data type that manages text locations, which are row or column values in
00041 /// units of character, not pixel. @see loc_t.
00042 typedef uint16_t textloc_t;
00043 
00044 /// type that manages dimensions of width or height, which range from 0 to N.
00045 typedef uint16_t dim_t;
00046 
00047 /// type that manages x,y pairs
00048 typedef struct
00049 {
00050     loc_t x;             ///< x value in the point
00051     loc_t y;             ///< y value in the point
00052 } point_t;
00053 
00054 /// Data type that manages rectangles, which are pairs of points. It is recommended
00055 /// that p1 contains the top-left point and p2 contains the bottom-right point,
00056 /// even though eventually this should not matter.
00057 typedef struct
00058 {
00059     point_t p1;         ///< p1 defines one point on the rectangle
00060     point_t p2;         ///< p2 defines the opposite point on the rectangle
00061 } rect_t;
00062 
00063 /// Data type that manages the calibration matrix for the resistive touch panel.
00064 ///
00065 /// This object, when instantiated, may be passed back and forth, stored
00066 /// and loaded, but the internals are generally of little interest.
00067 typedef struct
00068 {
00069     int32_t An;         ///< calibration factor, see source for details
00070     int32_t Bn;         ///< calibration factor, see source for details
00071     int32_t Cn;         ///< calibration factor, see source for details
00072     int32_t Dn;         ///< calibration factor, see source for details
00073     int32_t En;         ///< calibration factor, see source for details
00074     int32_t Fn;         ///< calibration factor, see source for details
00075     int32_t Divider;    ///< calibration factor, see source for details
00076 } tpMatrix_t;
00077 
00078 /// color type definition to let the compiler help keep us honest.
00079 /// 
00080 /// colors can be defined with the RGB(r,g,b) macro, and there
00081 /// are a number of predefined colors:
00082 /// - Black,    Blue,       Green,       Cyan,
00083 /// - Red,      Magenta,    Brown,       Gray,
00084 /// - Charcoal, BrightBlue, BrightGreen, BrightCyan,
00085 /// - Orange,   Pink,       Yellow,      White
00086 ///
00087 typedef uint16_t color_t;   
00088 
00089 /// background fill info for drawing Text, Rectangles, RoundedRectanges, Circles, Ellipses and Triangles.
00090 typedef enum
00091 {
00092     NOFILL,     ///< do not fill the object with the background color
00093     FILL        ///< fill the object space with the background color
00094 } fill_t;
00095 
00096 #endif // DISPLAYDEFS_H