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:
Sat Sep 21 17:30:00 2019 +0000
Revision:
190:3132b7dfad82
Parent:
163:17526689a3ed
Child:
197:853d08e2fb53
Fonts Add & mods; Add methods; - get dimensions of image file; - round or square cap for thicklines; - word-wrap for puts; - align one rect to another; - independently set the text font fill; - get the width of a character, or a string

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WiredHome 31:c72e12cd5c67 1 //
WiredHome 31:c72e12cd5c67 2 // Windows BMP file definitions.
WiredHome 31:c72e12cd5c67 3 //
WiredHome 31:c72e12cd5c67 4 // Adapted from code written by Michael Sweet from Paul Bourke's
WiredHome 31:c72e12cd5c67 5 // web site: http://paulbourke.net/dataformats/bmp/
WiredHome 31:c72e12cd5c67 6 //
WiredHome 31:c72e12cd5c67 7
WiredHome 31:c72e12cd5c67 8 #ifndef _BITMAP_H_
WiredHome 31:c72e12cd5c67 9 #define _BITMAP_H_
WiredHome 31:c72e12cd5c67 10
WiredHome 31:c72e12cd5c67 11 #include <mbed.h>
WiredHome 31:c72e12cd5c67 12
WiredHome 31:c72e12cd5c67 13 // BITMAPFILEHEADER
WiredHome 31:c72e12cd5c67 14 // BITMAPINFOHEADER
WiredHome 31:c72e12cd5c67 15 // Optional Palette
WiredHome 31:c72e12cd5c67 16 // Raw Data
WiredHome 31:c72e12cd5c67 17
WiredHome 31:c72e12cd5c67 18 //
WiredHome 31:c72e12cd5c67 19 // Bitmap file data structures
WiredHome 31:c72e12cd5c67 20 //
WiredHome 32:0e4f2ae512e2 21 // must align to 2-byte boundaries so it doesn't alter the memory image when
WiredHome 32:0e4f2ae512e2 22 // bytes are read from the file system into this footprint.
WiredHome 190:3132b7dfad82 23 #ifdef __GNUC__
WiredHome 190:3132b7dfad82 24 #pragma pack(push, 1)
WiredHome 190:3132b7dfad82 25 #define ALIGNMENT
WiredHome 190:3132b7dfad82 26 #else
WiredHome 190:3132b7dfad82 27 #define ALIGNMENT
WiredHome 31:c72e12cd5c67 28 #pragma push
WiredHome 31:c72e12cd5c67 29 #pragma pack(2)
WiredHome 190:3132b7dfad82 30 #endif
WiredHome 31:c72e12cd5c67 31
WiredHome 125:7a0b70f56550 32 /// Bitmap file header
WiredHome 42:7cbdfd2bbfc5 33 typedef struct /**** BMP file header structure ****/
WiredHome 31:c72e12cd5c67 34 {
WiredHome 125:7a0b70f56550 35 uint16_t bfType; ///< Magic number for file
WiredHome 125:7a0b70f56550 36 uint32_t bfSize; ///< Size of file
WiredHome 125:7a0b70f56550 37 uint16_t bfReserved1; ///< reserved placeholder for the structure footprint
WiredHome 125:7a0b70f56550 38 uint16_t bfReserved2; ///< reserved placeholder for the structure footprint
WiredHome 125:7a0b70f56550 39 uint32_t bfOffBits; ///< Offset to bitmap data
WiredHome 190:3132b7dfad82 40 } BITMAPFILEHEADER ALIGNMENT; // Size: 14B
WiredHome 190:3132b7dfad82 41 #ifdef WIN32
WiredHome 190:3132b7dfad82 42 static_assert(sizeof(BITMAPFILEHEADER) == 14, "Alignment Error");
WiredHome 190:3132b7dfad82 43 #endif
WiredHome 31:c72e12cd5c67 44
WiredHome 125:7a0b70f56550 45 /// Bitmap information header
WiredHome 31:c72e12cd5c67 46 typedef struct /**** BMP file info structure ****/
WiredHome 31:c72e12cd5c67 47 {
WiredHome 125:7a0b70f56550 48 uint32_t biSize; ///< Size of info header
WiredHome 125:7a0b70f56550 49 uint32_t biWidth; ///< Width of image
WiredHome 125:7a0b70f56550 50 uint32_t biHeight; ///< Height of image
WiredHome 125:7a0b70f56550 51 uint16_t biPlanes; ///< Number of color planes
WiredHome 125:7a0b70f56550 52 uint16_t biBitCount; ///< Number of bits per pixel
WiredHome 125:7a0b70f56550 53 uint32_t biCompression; ///< Type of compression to use
WiredHome 125:7a0b70f56550 54 uint32_t biSizeImage; ///< Size of image data
WiredHome 125:7a0b70f56550 55 int32_t biXPelsPerMeter; ///< X pixels per meter
WiredHome 125:7a0b70f56550 56 int32_t biYPelsPerMeter; ///< Y pixels per meter
WiredHome 125:7a0b70f56550 57 uint32_t biClrUsed; ///< Number of colors used
WiredHome 125:7a0b70f56550 58 uint32_t biClrImportant; ///< Number of important colors
WiredHome 190:3132b7dfad82 59 } BITMAPINFOHEADER ALIGNMENT; // Size: 40B
WiredHome 190:3132b7dfad82 60 #ifdef __GNUC__
WiredHome 190:3132b7dfad82 61 #pragma pack(pop)
WiredHome 190:3132b7dfad82 62 #undef ALIGNMENT
WiredHome 190:3132b7dfad82 63 #else
WiredHome 31:c72e12cd5c67 64 #pragma pop
WiredHome 190:3132b7dfad82 65 #endif
WiredHome 31:c72e12cd5c67 66
WiredHome 32:0e4f2ae512e2 67 #define BF_TYPE 0x4D42 /* "MB" */
WiredHome 32:0e4f2ae512e2 68
WiredHome 31:c72e12cd5c67 69 /*
WiredHome 31:c72e12cd5c67 70 * Constants for the biCompression field...
WiredHome 31:c72e12cd5c67 71 */
WiredHome 31:c72e12cd5c67 72
WiredHome 31:c72e12cd5c67 73 # define BI_RGB 0 /* No compression - straight BGR data */
WiredHome 31:c72e12cd5c67 74 # define BI_RLE8 1 /* 8-bit run-length compression */
WiredHome 31:c72e12cd5c67 75 # define BI_RLE4 2 /* 4-bit run-length compression */
WiredHome 31:c72e12cd5c67 76 # define BI_BITFIELDS 3 /* RGB bitmap with RGB masks */
WiredHome 31:c72e12cd5c67 77
WiredHome 125:7a0b70f56550 78 /// An RGB Quad data type used by the bitmap driver.
WiredHome 31:c72e12cd5c67 79 typedef struct /**** Colormap entry structure ****/
WiredHome 31:c72e12cd5c67 80 {
WiredHome 125:7a0b70f56550 81 uint8_t rgbBlue; ///< Blue value
WiredHome 125:7a0b70f56550 82 uint8_t rgbGreen; ///< Green value
WiredHome 125:7a0b70f56550 83 uint8_t rgbRed; ///< Red value
WiredHome 125:7a0b70f56550 84 uint8_t rgbReserved; ///< Reserved
WiredHome 31:c72e12cd5c67 85 } RGBQUAD;
WiredHome 31:c72e12cd5c67 86
WiredHome 32:0e4f2ae512e2 87 //typedef struct /**** Bitmap information structure ****/
WiredHome 32:0e4f2ae512e2 88 // {
WiredHome 32:0e4f2ae512e2 89 // BITMAPINFOHEADER bmiHeader; /* Image header */
WiredHome 32:0e4f2ae512e2 90 // RGBQUAD bmiColors[256]; /* Image colormap */
WiredHome 32:0e4f2ae512e2 91 // } BITMAPINFO;
WiredHome 31:c72e12cd5c67 92
WiredHome 190:3132b7dfad82 93 #ifdef __GNUC__
WiredHome 190:3132b7dfad82 94 #pragma pack(push, 1)
WiredHome 190:3132b7dfad82 95 #define ALIGNMENT
WiredHome 190:3132b7dfad82 96 #else
WiredHome 42:7cbdfd2bbfc5 97 #pragma push
WiredHome 42:7cbdfd2bbfc5 98 #pragma pack(2)
WiredHome 190:3132b7dfad82 99 #endif
WiredHome 42:7cbdfd2bbfc5 100
WiredHome 125:7a0b70f56550 101 /// Icon file type file header.
WiredHome 42:7cbdfd2bbfc5 102 typedef struct /**** ICO file header structure ****/
WiredHome 42:7cbdfd2bbfc5 103 {
WiredHome 125:7a0b70f56550 104 uint16_t Reserved_zero; ///< Always zero
WiredHome 125:7a0b70f56550 105 uint16_t icType; ///< 1 for .ico, 2 for .cur
WiredHome 125:7a0b70f56550 106 uint16_t icImageCount; ///< number of images in the file
WiredHome 42:7cbdfd2bbfc5 107 } ICOFILEHEADER;
WiredHome 125:7a0b70f56550 108
WiredHome 125:7a0b70f56550 109 /// Icon file type directory entry structure
WiredHome 42:7cbdfd2bbfc5 110 typedef struct /**** ICO file Directory Entry structure (1 or more) ****/
WiredHome 42:7cbdfd2bbfc5 111 {
WiredHome 125:7a0b70f56550 112 uint8_t biWidth; ///< Width of image
WiredHome 125:7a0b70f56550 113 uint8_t biHeight; ///< Height of image
WiredHome 125:7a0b70f56550 114 uint8_t biClrUsed; ///< Number of colors used
WiredHome 125:7a0b70f56550 115 uint8_t Reserved_zero; ///< reserved placeholder for the structure footprint
WiredHome 125:7a0b70f56550 116 uint16_t biPlanes; ///< Number of color planes (ICO should be 0 or 1, CUR horz hotspot
WiredHome 125:7a0b70f56550 117 uint16_t biBitCount; ///< Number of bits per pixel (ICO bits per pixel, CUR vert hotspot
WiredHome 125:7a0b70f56550 118 uint32_t biSizeImage; ///< Size of image data
WiredHome 125:7a0b70f56550 119 uint32_t bfOffBits; ///< Offset into file for the bitmap data
WiredHome 42:7cbdfd2bbfc5 120 } ICODIRENTRY;
WiredHome 190:3132b7dfad82 121 #ifdef __GNUC__
WiredHome 190:3132b7dfad82 122 #pragma pack(pop)
WiredHome 190:3132b7dfad82 123 #undef ALIGNMENT
WiredHome 190:3132b7dfad82 124 #else
WiredHome 42:7cbdfd2bbfc5 125 #pragma pop
WiredHome 190:3132b7dfad82 126 #endif
WiredHome 42:7cbdfd2bbfc5 127
WiredHome 42:7cbdfd2bbfc5 128 #define IC_TYPE 0x0001 /* 1 = ICO (icon), 2 = CUR (cursor) */
WiredHome 42:7cbdfd2bbfc5 129
WiredHome 31:c72e12cd5c67 130 #endif // _BITMAP_H_