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

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Committer:
WiredHome
Date:
Sun Mar 29 18:12:24 2020 +0000
Revision:
201:0b25d24d9bda
Parent:
198:9b6851107426
Correct a defect in JPEG Rendering that came in when window() changed to SetWindow();

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 31:c72e12cd5c67 1 #ifndef DISPLAYDEFS_H
WiredHome 31:c72e12cd5c67 2 #define DISPLAYDEFS_H
WiredHome 31:c72e12cd5c67 3
WiredHome 167:8aa3fb2a5a31 4 /// A Macro to define a @ref color_t value from independent values of Red, Green, and Blue.
WiredHome 167:8aa3fb2a5a31 5 ///
WiredHome 167:8aa3fb2a5a31 6 /// This macro accepts 3 parameters, each with a range of 0 to 0xFF.
WiredHome 167:8aa3fb2a5a31 7 /// Not all of the bits are used as it creates a 16-bit color from from 24-bits
WiredHome 167:8aa3fb2a5a31 8 /// of information.
WiredHome 167:8aa3fb2a5a31 9 ///
WiredHome 167:8aa3fb2a5a31 10 /// @param r is the Red component, ranging from 0 no-Red to 0xFF maximum-Red
WiredHome 167:8aa3fb2a5a31 11 /// @param g is the Green component, ranging from 0 no-Red to 0xFF maximum-Green
WiredHome 167:8aa3fb2a5a31 12 /// @param b is the Blue component, ranging from 0 no-Red to 0xFF maximum-Blue
WiredHome 167:8aa3fb2a5a31 13 ///
WiredHome 32:0e4f2ae512e2 14 #define RGB(r,g,b) ( ((r<<8)&0xF800) | ((g<<3)&0x07E0) | (b>>3) )
WiredHome 32:0e4f2ae512e2 15
WiredHome 167:8aa3fb2a5a31 16 /// Return values from numerous APIs.
WiredHome 167:8aa3fb2a5a31 17 ///
WiredHome 167:8aa3fb2a5a31 18 /// This is the return value from various functions. Compare the return value
WiredHome 197:853d08e2fb53 19 /// to the possibilities in this definition, or use the @ref RA8875::GetErrorMessage()
WiredHome 167:8aa3fb2a5a31 20 /// function to translate a @ref RetCode_t value into a text string.
WiredHome 79:544eb4964795 21 ///
WiredHome 31:c72e12cd5c67 22 typedef enum
WiredHome 31:c72e12cd5c67 23 {
WiredHome 31:c72e12cd5c67 24 noerror, ///< no errors, command completed successfully
WiredHome 31:c72e12cd5c67 25 bad_parameter, ///< one or more parameters are invalid
WiredHome 31:c72e12cd5c67 26 file_not_found, ///< specified file could not be found
WiredHome 42:7cbdfd2bbfc5 27 not_bmp_format, ///< file is not a .bmp file
WiredHome 42:7cbdfd2bbfc5 28 not_ico_format, ///< file is not a .ico file
WiredHome 112:325ca91bc03d 29 not_supported_format, ///< file format is not yet supported (e.g. bits per pixel, compression)
WiredHome 31:c72e12cd5c67 30 image_too_big, ///< image is too large for the screen
WiredHome 31:c72e12cd5c67 31 not_enough_ram, ///< could not allocate ram for scanline
WiredHome 122:79e431f98fa9 32 touch_cal_timeout, ///< timeout while trying to calibrate touchscreen, perhaps it is not installed.
WiredHome 115:c9862fd0c689 33 external_abort, ///< an external process caused an abort
WiredHome 79:544eb4964795 34 LastErrCode, // Private marker.
WiredHome 31:c72e12cd5c67 35 } RetCode_t;
WiredHome 31:c72e12cd5c67 36
WiredHome 167:8aa3fb2a5a31 37 /// Touch API Return values.
WiredHome 167:8aa3fb2a5a31 38 ///
WiredHome 167:8aa3fb2a5a31 39 /// This is the return value from various functions:
WiredHome 167:8aa3fb2a5a31 40 /// * @ref RA8875::TouchCode()
WiredHome 167:8aa3fb2a5a31 41 /// * @ref RA8875::TouchPanelReadable()
WiredHome 167:8aa3fb2a5a31 42 /// * @ref RA8875::TouchPanelA2DRaw()
WiredHome 167:8aa3fb2a5a31 43 /// * @ref RA8875::TouchPanelA2DFiltered()
WiredHome 197:853d08e2fb53 44 /// * @ref RA8875::TouchPanelGet()
WiredHome 167:8aa3fb2a5a31 45 ///
WiredHome 83:7bad0068cca0 46 typedef enum
WiredHome 83:7bad0068cca0 47 {
WiredHome 83:7bad0068cca0 48 no_touch, ///< no touch is detected
WiredHome 83:7bad0068cca0 49 touch, ///< touch is detected
WiredHome 83:7bad0068cca0 50 held, ///< held after touch
WiredHome 83:7bad0068cca0 51 release, ///< release is detected
WiredHome 83:7bad0068cca0 52 no_cal, ///< no calibration matrix is available
WiredHome 83:7bad0068cca0 53 } TouchCode_t;
WiredHome 83:7bad0068cca0 54
WiredHome 198:9b6851107426 55 /// display orientation argument for @ref RA8875::SetGraphicsOrientation(), @ref RA8875::GetGraphicsOrientation()
WiredHome 198:9b6851107426 56 /// with landscape mode as the normal (0 degree) orientation.
WiredHome 198:9b6851107426 57 typedef enum
WiredHome 198:9b6851107426 58 {
WiredHome 198:9b6851107426 59 normal, ///< normal (landscape) orientation
WiredHome 198:9b6851107426 60 rotate_0 = normal, ///< alternate to 'normal'
WiredHome 198:9b6851107426 61 rotate_90, ///< rotated clockwise 90 degree
WiredHome 198:9b6851107426 62 rotate_180, ///< rotated (clockwise) 180 degree
WiredHome 198:9b6851107426 63 rotate_270, ///< rotated clockwise 270 degree
WiredHome 198:9b6851107426 64 invalid, ///< an invalid angle was detected
WiredHome 198:9b6851107426 65 } orientation_t;
WiredHome 198:9b6851107426 66
WiredHome 125:7a0b70f56550 67 /// Data type that manages locations, which is typically an x or y pixel location,
WiredHome 167:8aa3fb2a5a31 68 /// which can range from -N to +N (even as the screen is always defined in the
WiredHome 167:8aa3fb2a5a31 69 /// range of 0 to +n). See also @ref textloc_t.
WiredHome 167:8aa3fb2a5a31 70 ///
WiredHome 37:f19b7e7449dc 71 typedef int16_t loc_t;
WiredHome 37:f19b7e7449dc 72
WiredHome 125:7a0b70f56550 73 /// Data type that manages text locations, which are row or column values in
WiredHome 167:8aa3fb2a5a31 74 /// units of character, not pixel. See also @ref loc_t.
WiredHome 167:8aa3fb2a5a31 75 ///
WiredHome 37:f19b7e7449dc 76 typedef uint16_t textloc_t;
WiredHome 37:f19b7e7449dc 77
WiredHome 37:f19b7e7449dc 78 /// type that manages dimensions of width or height, which range from 0 to N.
WiredHome 167:8aa3fb2a5a31 79 ///
WiredHome 167:8aa3fb2a5a31 80 /// @note that a dimension cannot be negative.
WiredHome 167:8aa3fb2a5a31 81 ///
WiredHome 37:f19b7e7449dc 82 typedef uint16_t dim_t;
WiredHome 37:f19b7e7449dc 83
WiredHome 32:0e4f2ae512e2 84 /// type that manages x,y pairs
WiredHome 167:8aa3fb2a5a31 85 ///
WiredHome 180:d8abf2e70b88 86 typedef struct
WiredHome 32:0e4f2ae512e2 87 {
WiredHome 37:f19b7e7449dc 88 loc_t x; ///< x value in the point
WiredHome 37:f19b7e7449dc 89 loc_t y; ///< y value in the point
WiredHome 180:d8abf2e70b88 90 } point_t;
WiredHome 32:0e4f2ae512e2 91
WiredHome 197:853d08e2fb53 92 /// Data type that manages rectangles, which are pairs of points.
WiredHome 167:8aa3fb2a5a31 93 ///
WiredHome 197:853d08e2fb53 94 /// @note It is recommended that p1 contains the top-left point and p2 contains
WiredHome 167:8aa3fb2a5a31 95 /// the bottom-right point, even though it should not matter.
WiredHome 167:8aa3fb2a5a31 96 ///
WiredHome 180:d8abf2e70b88 97 typedef struct
WiredHome 81:01da2e34283d 98 {
WiredHome 81:01da2e34283d 99 point_t p1; ///< p1 defines one point on the rectangle
WiredHome 81:01da2e34283d 100 point_t p2; ///< p2 defines the opposite point on the rectangle
WiredHome 180:d8abf2e70b88 101 } rect_t;
WiredHome 81:01da2e34283d 102
WiredHome 125:7a0b70f56550 103 /// Data type that manages the calibration matrix for the resistive touch panel.
WiredHome 125:7a0b70f56550 104 ///
WiredHome 125:7a0b70f56550 105 /// This object, when instantiated, may be passed back and forth, stored
WiredHome 125:7a0b70f56550 106 /// and loaded, but the internals are generally of little interest.
WiredHome 167:8aa3fb2a5a31 107 ///
WiredHome 77:9206c13aa527 108 typedef struct
WiredHome 77:9206c13aa527 109 {
WiredHome 125:7a0b70f56550 110 int32_t An; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 111 int32_t Bn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 112 int32_t Cn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 113 int32_t Dn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 114 int32_t En; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 115 int32_t Fn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 116 int32_t Divider; ///< calibration factor, see source for details
WiredHome 77:9206c13aa527 117 } tpMatrix_t;
WiredHome 77:9206c13aa527 118
WiredHome 167:8aa3fb2a5a31 119 /// color type definition to let the compiler type-check parameters that
WiredHome 167:8aa3fb2a5a31 120 /// are passed to or returned from APIs that use color.
WiredHome 197:853d08e2fb53 121 ///
WiredHome 197:853d08e2fb53 122 /// colors can be easily defined with the @ref RGB(r,g,b) macro, or from
WiredHome 167:8aa3fb2a5a31 123 /// the @ref PredefinedColors.
WiredHome 32:0e4f2ae512e2 124 ///
WiredHome 197:853d08e2fb53 125 typedef uint16_t color_t;
WiredHome 32:0e4f2ae512e2 126
WiredHome 32:0e4f2ae512e2 127 /// background fill info for drawing Text, Rectangles, RoundedRectanges, Circles, Ellipses and Triangles.
WiredHome 32:0e4f2ae512e2 128 typedef enum
WiredHome 32:0e4f2ae512e2 129 {
WiredHome 32:0e4f2ae512e2 130 NOFILL, ///< do not fill the object with the background color
WiredHome 32:0e4f2ae512e2 131 FILL ///< fill the object space with the background color
WiredHome 32:0e4f2ae512e2 132 } fill_t;
WiredHome 32:0e4f2ae512e2 133
WiredHome 31:c72e12cd5c67 134 #endif // DISPLAYDEFS_H