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:
Fri Mar 15 01:39:39 2019 +0000
Revision:
175:7be3a1fb7fc2
Parent:
167:8aa3fb2a5a31
Child:
179:c7fb7a4fb42f
Non-functional change to WriteCommand() based on register names, rather than hex values.

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 167:8aa3fb2a5a31 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 167:8aa3fb2a5a31 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 125:7a0b70f56550 55 /// Data type that manages locations, which is typically an x or y pixel location,
WiredHome 167:8aa3fb2a5a31 56 /// which can range from -N to +N (even as the screen is always defined in the
WiredHome 167:8aa3fb2a5a31 57 /// range of 0 to +n). See also @ref textloc_t.
WiredHome 167:8aa3fb2a5a31 58 ///
WiredHome 37:f19b7e7449dc 59 typedef int16_t loc_t;
WiredHome 37:f19b7e7449dc 60
WiredHome 125:7a0b70f56550 61 /// Data type that manages text locations, which are row or column values in
WiredHome 167:8aa3fb2a5a31 62 /// units of character, not pixel. See also @ref loc_t.
WiredHome 167:8aa3fb2a5a31 63 ///
WiredHome 37:f19b7e7449dc 64 typedef uint16_t textloc_t;
WiredHome 37:f19b7e7449dc 65
WiredHome 37:f19b7e7449dc 66 /// type that manages dimensions of width or height, which range from 0 to N.
WiredHome 167:8aa3fb2a5a31 67 ///
WiredHome 167:8aa3fb2a5a31 68 /// @note that a dimension cannot be negative.
WiredHome 167:8aa3fb2a5a31 69 ///
WiredHome 37:f19b7e7449dc 70 typedef uint16_t dim_t;
WiredHome 37:f19b7e7449dc 71
WiredHome 32:0e4f2ae512e2 72 /// type that manages x,y pairs
WiredHome 167:8aa3fb2a5a31 73 ///
WiredHome 32:0e4f2ae512e2 74 typedef struct
WiredHome 32:0e4f2ae512e2 75 {
WiredHome 37:f19b7e7449dc 76 loc_t x; ///< x value in the point
WiredHome 37:f19b7e7449dc 77 loc_t y; ///< y value in the point
WiredHome 32:0e4f2ae512e2 78 } point_t;
WiredHome 32:0e4f2ae512e2 79
WiredHome 167:8aa3fb2a5a31 80 /// Data type that manages rectangles, which are pairs of points.
WiredHome 167:8aa3fb2a5a31 81 ///
WiredHome 167:8aa3fb2a5a31 82 /// @note It is recommended that p1 contains the top-left point and p2 contains
WiredHome 167:8aa3fb2a5a31 83 /// the bottom-right point, even though it should not matter.
WiredHome 167:8aa3fb2a5a31 84 ///
WiredHome 81:01da2e34283d 85 typedef struct
WiredHome 81:01da2e34283d 86 {
WiredHome 81:01da2e34283d 87 point_t p1; ///< p1 defines one point on the rectangle
WiredHome 81:01da2e34283d 88 point_t p2; ///< p2 defines the opposite point on the rectangle
WiredHome 81:01da2e34283d 89 } rect_t;
WiredHome 81:01da2e34283d 90
WiredHome 125:7a0b70f56550 91 /// Data type that manages the calibration matrix for the resistive touch panel.
WiredHome 125:7a0b70f56550 92 ///
WiredHome 125:7a0b70f56550 93 /// This object, when instantiated, may be passed back and forth, stored
WiredHome 125:7a0b70f56550 94 /// and loaded, but the internals are generally of little interest.
WiredHome 167:8aa3fb2a5a31 95 ///
WiredHome 77:9206c13aa527 96 typedef struct
WiredHome 77:9206c13aa527 97 {
WiredHome 125:7a0b70f56550 98 int32_t An; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 99 int32_t Bn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 100 int32_t Cn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 101 int32_t Dn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 102 int32_t En; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 103 int32_t Fn; ///< calibration factor, see source for details
WiredHome 125:7a0b70f56550 104 int32_t Divider; ///< calibration factor, see source for details
WiredHome 77:9206c13aa527 105 } tpMatrix_t;
WiredHome 77:9206c13aa527 106
WiredHome 167:8aa3fb2a5a31 107 /// color type definition to let the compiler type-check parameters that
WiredHome 167:8aa3fb2a5a31 108 /// are passed to or returned from APIs that use color.
WiredHome 32:0e4f2ae512e2 109 ///
WiredHome 167:8aa3fb2a5a31 110 /// colors can be easily defined with the @ref RGB(r,g,b) macro, or from
WiredHome 167:8aa3fb2a5a31 111 /// the @ref PredefinedColors.
WiredHome 32:0e4f2ae512e2 112 ///
WiredHome 32:0e4f2ae512e2 113 typedef uint16_t color_t;
WiredHome 32:0e4f2ae512e2 114
WiredHome 32:0e4f2ae512e2 115 /// background fill info for drawing Text, Rectangles, RoundedRectanges, Circles, Ellipses and Triangles.
WiredHome 32:0e4f2ae512e2 116 typedef enum
WiredHome 32:0e4f2ae512e2 117 {
WiredHome 32:0e4f2ae512e2 118 NOFILL, ///< do not fill the object with the background color
WiredHome 32:0e4f2ae512e2 119 FILL ///< fill the object space with the background color
WiredHome 32:0e4f2ae512e2 120 } fill_t;
WiredHome 32:0e4f2ae512e2 121
WiredHome 31:c72e12cd5c67 122 #endif // DISPLAYDEFS_H