KSM edits to RA8875

Dependents:   Liz_Test_Code

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 /// A Macro to define a @ref color_t value from independent values of Red, Green, and Blue.
00005 ///
00006 /// This macro accepts 3 parameters, each with a range of 0 to 0xFF.
00007 /// Not all of the bits are used as it creates a 16-bit color from from 24-bits
00008 /// of information.
00009 ///
00010 /// @param r is the Red component, ranging from 0 no-Red to 0xFF maximum-Red
00011 /// @param g is the Green component, ranging from 0 no-Red to 0xFF maximum-Green
00012 /// @param b is the Blue component, ranging from 0 no-Red to 0xFF maximum-Blue
00013 ///
00014 #define RGB(r,g,b) ( ((r<<8)&0xF800) | ((g<<3)&0x07E0) | (b>>3) )
00015 
00016 /// Return values from numerous APIs.
00017 ///
00018 /// This is the return value from various functions. Compare the return value
00019 /// to the possibilities in this definition, or use the @ref RA8875::GetErrorMessage() 
00020 /// function to translate a @ref RetCode_t value into a text string.
00021 ///
00022 typedef enum
00023 {
00024     noerror,                ///< no errors, command completed successfully
00025     bad_parameter,          ///< one or more parameters are invalid
00026     file_not_found,         ///< specified file could not be found
00027     not_bmp_format,         ///< file is not a .bmp file
00028     not_ico_format,         ///< file is not a .ico file
00029     not_supported_format,   ///< file format is not yet supported (e.g. bits per pixel, compression)
00030     image_too_big,          ///< image is too large for the screen
00031     not_enough_ram,         ///< could not allocate ram for scanline
00032     touch_cal_timeout,      ///< timeout while trying to calibrate touchscreen, perhaps it is not installed.
00033     external_abort,         ///< an external process caused an abort
00034     LastErrCode,            // Private marker.
00035 } RetCode_t;
00036 
00037 /// Touch API Return values.
00038 ///
00039 /// This is the return value from various functions:
00040 /// * @ref RA8875::TouchCode()
00041 /// * @ref RA8875::TouchPanelReadable()
00042 /// * @ref RA8875::TouchPanelA2DRaw()
00043 /// * @ref RA8875::TouchPanelA2DFiltered()
00044 /// * @ref RA8875::TouchPanelGet() 
00045 ///
00046 typedef enum
00047 {
00048     no_touch,               ///< no touch is detected
00049     touch,                  ///< touch is detected
00050     held,                   ///< held after touch
00051     release,                ///< release is detected
00052     no_cal,                 ///< no calibration matrix is available
00053 } TouchCode_t;
00054 
00055 /// Data type that manages locations, which is typically an x or y pixel location,
00056 /// which can range from -N to +N (even as the screen is always defined in the
00057 /// range of 0 to +n). See also @ref textloc_t.
00058 ///
00059 typedef int16_t loc_t;
00060 
00061 /// Data type that manages text locations, which are row or column values in
00062 /// units of character, not pixel. See also @ref loc_t.
00063 ///
00064 typedef uint16_t textloc_t;
00065 
00066 /// type that manages dimensions of width or height, which range from 0 to N.
00067 ///
00068 /// @note that a dimension cannot be negative.
00069 ///
00070 typedef uint16_t dim_t;
00071 
00072 /// type that manages x,y pairs
00073 ///
00074 typedef struct
00075 {
00076     loc_t x;             ///< x value in the point
00077     loc_t y;             ///< y value in the point
00078 } point_t;
00079 
00080 /// Data type that manages rectangles, which are pairs of points. 
00081 ///
00082 /// @note It is recommended that p1 contains the top-left point and p2 contains 
00083 /// the bottom-right point, even though it should not matter.
00084 ///
00085 typedef struct
00086 {
00087     point_t p1;         ///< p1 defines one point on the rectangle
00088     point_t p2;         ///< p2 defines the opposite point on the rectangle
00089 } rect_t;
00090 
00091 /// Data type that manages the calibration matrix for the resistive touch panel.
00092 ///
00093 /// This object, when instantiated, may be passed back and forth, stored
00094 /// and loaded, but the internals are generally of little interest.
00095 ///
00096 typedef struct
00097 {
00098     int32_t An;         ///< calibration factor, see source for details
00099     int32_t Bn;         ///< calibration factor, see source for details
00100     int32_t Cn;         ///< calibration factor, see source for details
00101     int32_t Dn;         ///< calibration factor, see source for details
00102     int32_t En;         ///< calibration factor, see source for details
00103     int32_t Fn;         ///< calibration factor, see source for details
00104     int32_t Divider;    ///< calibration factor, see source for details
00105 } tpMatrix_t;
00106 
00107 /// color type definition to let the compiler type-check parameters that
00108 /// are passed to or returned from APIs that use color.
00109 /// 
00110 /// colors can be easily defined with the @ref RGB(r,g,b) macro, or from 
00111 /// the @ref PredefinedColors.
00112 ///
00113 typedef uint16_t color_t;   
00114 
00115 /// background fill info for drawing Text, Rectangles, RoundedRectanges, Circles, Ellipses and Triangles.
00116 typedef enum
00117 {
00118     NOFILL,     ///< do not fill the object with the background color
00119     FILL        ///< fill the object space with the background color
00120 } fill_t;
00121 
00122 #endif // DISPLAYDEFS_H