Increased SPI frequency from 5Mhz to 10MHz
Fork of RA8875 by
Bitmap.h@150:13745364dba0, 2017-08-21 (annotated)
- Committer:
- ItsJustZi
- Date:
- Mon Aug 21 22:00:31 2017 +0000
- Revision:
- 150:13745364dba0
- Parent:
- 125:7a0b70f56550
Turned SPI frequency back down to 5MHz for lower susceptibility to noise
Who changed what in which revision?
User | Revision | Line number | New 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 | 31:c72e12cd5c67 | 23 | #pragma push |
WiredHome | 31:c72e12cd5c67 | 24 | #pragma pack(2) |
WiredHome | 31:c72e12cd5c67 | 25 | |
WiredHome | 125:7a0b70f56550 | 26 | /// Bitmap file header |
WiredHome | 42:7cbdfd2bbfc5 | 27 | typedef struct /**** BMP file header structure ****/ |
WiredHome | 31:c72e12cd5c67 | 28 | { |
WiredHome | 125:7a0b70f56550 | 29 | uint16_t bfType; ///< Magic number for file |
WiredHome | 125:7a0b70f56550 | 30 | uint32_t bfSize; ///< Size of file |
WiredHome | 125:7a0b70f56550 | 31 | uint16_t bfReserved1; ///< reserved placeholder for the structure footprint |
WiredHome | 125:7a0b70f56550 | 32 | uint16_t bfReserved2; ///< reserved placeholder for the structure footprint |
WiredHome | 125:7a0b70f56550 | 33 | uint32_t bfOffBits; ///< Offset to bitmap data |
WiredHome | 31:c72e12cd5c67 | 34 | } BITMAPFILEHEADER; |
WiredHome | 31:c72e12cd5c67 | 35 | |
WiredHome | 125:7a0b70f56550 | 36 | /// Bitmap information header |
WiredHome | 31:c72e12cd5c67 | 37 | typedef struct /**** BMP file info structure ****/ |
WiredHome | 31:c72e12cd5c67 | 38 | { |
WiredHome | 125:7a0b70f56550 | 39 | uint32_t biSize; ///< Size of info header |
WiredHome | 125:7a0b70f56550 | 40 | uint32_t biWidth; ///< Width of image |
WiredHome | 125:7a0b70f56550 | 41 | uint32_t biHeight; ///< Height of image |
WiredHome | 125:7a0b70f56550 | 42 | uint16_t biPlanes; ///< Number of color planes |
WiredHome | 125:7a0b70f56550 | 43 | uint16_t biBitCount; ///< Number of bits per pixel |
WiredHome | 125:7a0b70f56550 | 44 | uint32_t biCompression; ///< Type of compression to use |
WiredHome | 125:7a0b70f56550 | 45 | uint32_t biSizeImage; ///< Size of image data |
WiredHome | 125:7a0b70f56550 | 46 | int32_t biXPelsPerMeter; ///< X pixels per meter |
WiredHome | 125:7a0b70f56550 | 47 | int32_t biYPelsPerMeter; ///< Y pixels per meter |
WiredHome | 125:7a0b70f56550 | 48 | uint32_t biClrUsed; ///< Number of colors used |
WiredHome | 125:7a0b70f56550 | 49 | uint32_t biClrImportant; ///< Number of important colors |
WiredHome | 31:c72e12cd5c67 | 50 | } BITMAPINFOHEADER; |
WiredHome | 31:c72e12cd5c67 | 51 | #pragma pop |
WiredHome | 31:c72e12cd5c67 | 52 | |
WiredHome | 32:0e4f2ae512e2 | 53 | #define BF_TYPE 0x4D42 /* "MB" */ |
WiredHome | 32:0e4f2ae512e2 | 54 | |
WiredHome | 31:c72e12cd5c67 | 55 | /* |
WiredHome | 31:c72e12cd5c67 | 56 | * Constants for the biCompression field... |
WiredHome | 31:c72e12cd5c67 | 57 | */ |
WiredHome | 31:c72e12cd5c67 | 58 | |
WiredHome | 31:c72e12cd5c67 | 59 | # define BI_RGB 0 /* No compression - straight BGR data */ |
WiredHome | 31:c72e12cd5c67 | 60 | # define BI_RLE8 1 /* 8-bit run-length compression */ |
WiredHome | 31:c72e12cd5c67 | 61 | # define BI_RLE4 2 /* 4-bit run-length compression */ |
WiredHome | 31:c72e12cd5c67 | 62 | # define BI_BITFIELDS 3 /* RGB bitmap with RGB masks */ |
WiredHome | 31:c72e12cd5c67 | 63 | |
WiredHome | 125:7a0b70f56550 | 64 | /// An RGB Quad data type used by the bitmap driver. |
WiredHome | 31:c72e12cd5c67 | 65 | typedef struct /**** Colormap entry structure ****/ |
WiredHome | 31:c72e12cd5c67 | 66 | { |
WiredHome | 125:7a0b70f56550 | 67 | uint8_t rgbBlue; ///< Blue value |
WiredHome | 125:7a0b70f56550 | 68 | uint8_t rgbGreen; ///< Green value |
WiredHome | 125:7a0b70f56550 | 69 | uint8_t rgbRed; ///< Red value |
WiredHome | 125:7a0b70f56550 | 70 | uint8_t rgbReserved; ///< Reserved |
WiredHome | 31:c72e12cd5c67 | 71 | } RGBQUAD; |
WiredHome | 31:c72e12cd5c67 | 72 | |
WiredHome | 32:0e4f2ae512e2 | 73 | //typedef struct /**** Bitmap information structure ****/ |
WiredHome | 32:0e4f2ae512e2 | 74 | // { |
WiredHome | 32:0e4f2ae512e2 | 75 | // BITMAPINFOHEADER bmiHeader; /* Image header */ |
WiredHome | 32:0e4f2ae512e2 | 76 | // RGBQUAD bmiColors[256]; /* Image colormap */ |
WiredHome | 32:0e4f2ae512e2 | 77 | // } BITMAPINFO; |
WiredHome | 31:c72e12cd5c67 | 78 | |
WiredHome | 42:7cbdfd2bbfc5 | 79 | |
WiredHome | 42:7cbdfd2bbfc5 | 80 | #pragma push |
WiredHome | 42:7cbdfd2bbfc5 | 81 | #pragma pack(2) |
WiredHome | 42:7cbdfd2bbfc5 | 82 | |
WiredHome | 125:7a0b70f56550 | 83 | /// Icon file type file header. |
WiredHome | 42:7cbdfd2bbfc5 | 84 | typedef struct /**** ICO file header structure ****/ |
WiredHome | 42:7cbdfd2bbfc5 | 85 | { |
WiredHome | 125:7a0b70f56550 | 86 | uint16_t Reserved_zero; ///< Always zero |
WiredHome | 125:7a0b70f56550 | 87 | uint16_t icType; ///< 1 for .ico, 2 for .cur |
WiredHome | 125:7a0b70f56550 | 88 | uint16_t icImageCount; ///< number of images in the file |
WiredHome | 42:7cbdfd2bbfc5 | 89 | } ICOFILEHEADER; |
WiredHome | 125:7a0b70f56550 | 90 | |
WiredHome | 125:7a0b70f56550 | 91 | /// Icon file type directory entry structure |
WiredHome | 42:7cbdfd2bbfc5 | 92 | typedef struct /**** ICO file Directory Entry structure (1 or more) ****/ |
WiredHome | 42:7cbdfd2bbfc5 | 93 | { |
WiredHome | 125:7a0b70f56550 | 94 | uint8_t biWidth; ///< Width of image |
WiredHome | 125:7a0b70f56550 | 95 | uint8_t biHeight; ///< Height of image |
WiredHome | 125:7a0b70f56550 | 96 | uint8_t biClrUsed; ///< Number of colors used |
WiredHome | 125:7a0b70f56550 | 97 | uint8_t Reserved_zero; ///< reserved placeholder for the structure footprint |
WiredHome | 125:7a0b70f56550 | 98 | uint16_t biPlanes; ///< Number of color planes (ICO should be 0 or 1, CUR horz hotspot |
WiredHome | 125:7a0b70f56550 | 99 | uint16_t biBitCount; ///< Number of bits per pixel (ICO bits per pixel, CUR vert hotspot |
WiredHome | 125:7a0b70f56550 | 100 | uint32_t biSizeImage; ///< Size of image data |
WiredHome | 125:7a0b70f56550 | 101 | uint32_t bfOffBits; ///< Offset into file for the bitmap data |
WiredHome | 42:7cbdfd2bbfc5 | 102 | } ICODIRENTRY; |
WiredHome | 42:7cbdfd2bbfc5 | 103 | #pragma pop |
WiredHome | 42:7cbdfd2bbfc5 | 104 | |
WiredHome | 42:7cbdfd2bbfc5 | 105 | #define IC_TYPE 0x0001 /* 1 = ICO (icon), 2 = CUR (cursor) */ |
WiredHome | 42:7cbdfd2bbfc5 | 106 | |
WiredHome | 31:c72e12cd5c67 | 107 | #endif // _BITMAP_H_ |