Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

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 /// display orientation argument for @ref RA8875::SetGraphicsOrientation(), @ref RA8875::GetGraphicsOrientation()
00056 /// with landscape mode as the normal (0 degree) orientation.
00057 typedef enum
00058 {
00059     normal,         ///< normal (landscape) orientation
00060     rotate_0 = normal,  ///< alternate to 'normal'
00061     rotate_90,      ///< rotated clockwise 90 degree
00062     rotate_180,     ///< rotated (clockwise) 180 degree
00063     rotate_270,     ///< rotated clockwise 270 degree
00064     invalid,        ///< an invalid angle was detected
00065 } orientation_t;
00066 
00067 /// Data type that manages locations, which is typically an x or y pixel location,
00068 /// which can range from -N to +N (even as the screen is always defined in the
00069 /// range of 0 to +n). See also @ref textloc_t.
00070 ///
00071 typedef int16_t loc_t;
00072 
00073 /// Data type that manages text locations, which are row or column values in
00074 /// units of character, not pixel. See also @ref loc_t.
00075 ///
00076 typedef uint16_t textloc_t;
00077 
00078 /// type that manages dimensions of width or height, which range from 0 to N.
00079 ///
00080 /// @note that a dimension cannot be negative.
00081 ///
00082 typedef uint16_t dim_t;
00083 
00084 /// type that manages x,y pairs
00085 ///
00086 typedef struct
00087 {
00088     loc_t x;             ///< x value in the point
00089     loc_t y;             ///< y value in the point
00090 } point_t;
00091 
00092 /// Data type that manages rectangles, which are pairs of points.
00093 ///
00094 /// @note It is recommended that p1 contains the top-left point and p2 contains
00095 /// the bottom-right point, even though it should not matter.
00096 ///
00097 typedef struct
00098 {
00099     point_t p1;         ///< p1 defines one point on the rectangle
00100     point_t p2;         ///< p2 defines the opposite point on the rectangle
00101 } rect_t;
00102 
00103 /// Data type that manages the calibration matrix for the resistive touch panel.
00104 ///
00105 /// This object, when instantiated, may be passed back and forth, stored
00106 /// and loaded, but the internals are generally of little interest.
00107 ///
00108 typedef struct
00109 {
00110     int32_t An;         ///< calibration factor, see source for details
00111     int32_t Bn;         ///< calibration factor, see source for details
00112     int32_t Cn;         ///< calibration factor, see source for details
00113     int32_t Dn;         ///< calibration factor, see source for details
00114     int32_t En;         ///< calibration factor, see source for details
00115     int32_t Fn;         ///< calibration factor, see source for details
00116     int32_t Divider;    ///< calibration factor, see source for details
00117 } tpMatrix_t;
00118 
00119 /// color type definition to let the compiler type-check parameters that
00120 /// are passed to or returned from APIs that use color.
00121 ///
00122 /// colors can be easily defined with the @ref RGB(r,g,b) macro, or from
00123 /// the @ref PredefinedColors.
00124 ///
00125 typedef uint16_t color_t;
00126 
00127 /// background fill info for drawing Text, Rectangles, RoundedRectanges, Circles, Ellipses and Triangles.
00128 typedef enum
00129 {
00130     NOFILL,     ///< do not fill the object with the background color
00131     FILL        ///< fill the object space with the background color
00132 } fill_t;
00133 
00134 #endif // DISPLAYDEFS_H