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