I have ported my old project “pNesX” game console emulator to the nucleo.

Dependencies:   SDFileSystem mbed

Intro

I have ported my old project “pNesX” to the STM32 Nucleo. The pNesX is a NES emulator for the PlayStation that I have created 16 years ago!

Emulation part was almost without change, the sound part was newly added.

Parts

STM32 Nucleo F446RE
QVGA 2.2 TFT SPI (with the SD card slot)
Audio jack(TS or TRS)
USB Connector
Register 100k, 10k, 4.7k, 100
Capacitor 0.01uF, 2.2uF
Breadboard
Wires
Computer Speakers
USB GamePad

Wiring diagram

/media/uploads/beaglescout007/nucleo_ex06_emu.png

TFT J2Nucleo
VCC3V3
GNDGND
CSPB_5(D4)
ResetPA_10(D2) Pull Up(100k)
D/CPA_8(D7)
MOSIPA_7(D11)
SCKPA_5(D13)
LEDLED-100ohm-3V3
MISOPA_6(D12)
TFT J4Nucleo
SD_CSPA_9
SD_MOSIPB_15
SD_MISOPB_14
SD_SCKPB_13
AudioNucleo
TIPPA_4(A2)
USB con.Nucleo
GNDGND
+PA_12
-PA_11
5V5V

https://youtu.be/jL24IjT6LnI

Limitations

  • Since the rest of the RAM is about 50kbyte, maximum capacity of the game ROM is about 50kbyte.
  • The length of the file name up to 32 characters.
  • The number of files in the folder is up to 100.

Used Library

Committer:
beaglescout007
Date:
Sun Apr 03 07:45:29 2016 +0000
Revision:
0:3dac1f1bc9e0
Release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
beaglescout007 0:3dac1f1bc9e0 1 /*===================================================================*/
beaglescout007 0:3dac1f1bc9e0 2 /* */
beaglescout007 0:3dac1f1bc9e0 3 /* tft.h : TFT(ILI9341) function header */
beaglescout007 0:3dac1f1bc9e0 4 /* */
beaglescout007 0:3dac1f1bc9e0 5 /* 2016/1/20 Racoon */
beaglescout007 0:3dac1f1bc9e0 6 /* */
beaglescout007 0:3dac1f1bc9e0 7 /*===================================================================*/
beaglescout007 0:3dac1f1bc9e0 8
beaglescout007 0:3dac1f1bc9e0 9 #ifndef TFT_H
beaglescout007 0:3dac1f1bc9e0 10 #define TFT_H
beaglescout007 0:3dac1f1bc9e0 11
beaglescout007 0:3dac1f1bc9e0 12 #include "stm32f4xx_hal.h"
beaglescout007 0:3dac1f1bc9e0 13 #include "spidma.h"
beaglescout007 0:3dac1f1bc9e0 14
beaglescout007 0:3dac1f1bc9e0 15 #define TFT_WIDTH 320
beaglescout007 0:3dac1f1bc9e0 16 #define TFT_HEIGHT 240
beaglescout007 0:3dac1f1bc9e0 17
beaglescout007 0:3dac1f1bc9e0 18 #define TFT_WHITE 0xFFFF
beaglescout007 0:3dac1f1bc9e0 19 #define TFT_WHITESMOKE 0xBFFF
beaglescout007 0:3dac1f1bc9e0 20 #define TFT_GHOSTWHITE 0xDFFF
beaglescout007 0:3dac1f1bc9e0 21 #define TFT_ALICEBLUE 0xDFF7
beaglescout007 0:3dac1f1bc9e0 22 #define TFT_LAVENDAR 0x5FEF
beaglescout007 0:3dac1f1bc9e0 23 #define TFT_AZURE 0xFFF7
beaglescout007 0:3dac1f1bc9e0 24 #define TFT_LIGHTCYAN 0xFFE7
beaglescout007 0:3dac1f1bc9e0 25 #define TFT_MINTCREAM 0xFFFF
beaglescout007 0:3dac1f1bc9e0 26 #define TFT_HONEYDEW 0xFEF7
beaglescout007 0:3dac1f1bc9e0 27 #define TFT_IVORY 0xFEFF
beaglescout007 0:3dac1f1bc9e0 28 #define TFT_BEIGE 0xBCFF
beaglescout007 0:3dac1f1bc9e0 29 #define TFT_LIGHTYELLOW 0xFCFF
beaglescout007 0:3dac1f1bc9e0 30 #define TFT_LIGHTGOLDENRODYELLOW 0xFAFF
beaglescout007 0:3dac1f1bc9e0 31 #define TFT_LEMONCHIFFON 0xFAFF
beaglescout007 0:3dac1f1bc9e0 32 #define TFT_FLORALWHITE 0xFEFF
beaglescout007 0:3dac1f1bc9e0 33 #define TFT_OLDLACE 0xBDFF
beaglescout007 0:3dac1f1bc9e0 34 #define TFT_CORNSILK 0xDCFF
beaglescout007 0:3dac1f1bc9e0 35 #define TFT_PAPAYAWHITE 0x9BFF
beaglescout007 0:3dac1f1bc9e0 36 #define TFT_BLANCHEDALMOND 0x7AFF
beaglescout007 0:3dac1f1bc9e0 37 #define TFT_BISQUE 0x39FF
beaglescout007 0:3dac1f1bc9e0 38 #define TFT_SNOW 0xFFFF
beaglescout007 0:3dac1f1bc9e0 39 #define TFT_LINEN 0x9DFF
beaglescout007 0:3dac1f1bc9e0 40 #define TFT_ANTIQUEWHITE 0x7BFF
beaglescout007 0:3dac1f1bc9e0 41 #define TFT_SEASHELL 0xBEFF
beaglescout007 0:3dac1f1bc9e0 42 #define TFT_LAVENDERBLUSH 0x9FFF
beaglescout007 0:3dac1f1bc9e0 43 #define TFT_MISTYROSE 0x3CFF
beaglescout007 0:3dac1f1bc9e0 44 #define TFT_GAINSBORO 0xFCE6
beaglescout007 0:3dac1f1bc9e0 45 #define TFT_LIGHTGRAY 0xBAD6
beaglescout007 0:3dac1f1bc9e0 46 #define TFT_LIGHTSTEELBLUE 0x3CB6
beaglescout007 0:3dac1f1bc9e0 47 #define TFT_LIGHTBLUE 0xDDB6
beaglescout007 0:3dac1f1bc9e0 48 #define TFT_LIGHTSKYBLUE 0x9F8E
beaglescout007 0:3dac1f1bc9e0 49 #define TFT_POWDERBLUE 0x1DB7
beaglescout007 0:3dac1f1bc9e0 50 #define TFT_PALETURQUOISE 0x9EB7
beaglescout007 0:3dac1f1bc9e0 51 #define TFT_SKYBLUE 0x9D8E
beaglescout007 0:3dac1f1bc9e0 52 #define TFT_MEDIUMAQUAMARINE 0x756E
beaglescout007 0:3dac1f1bc9e0 53 #define TFT_AQUAMARINE 0xFB87
beaglescout007 0:3dac1f1bc9e0 54 #define TFT_PALEGREEN 0xF39F
beaglescout007 0:3dac1f1bc9e0 55 #define TFT_LIGHTGREEN 0x9297
beaglescout007 0:3dac1f1bc9e0 56 #define TFT_KHAKI 0x52F7
beaglescout007 0:3dac1f1bc9e0 57 #define TFT_PALEGOLDENROD 0x55F7
beaglescout007 0:3dac1f1bc9e0 58 #define TFT_MOCCASIN 0x37FF
beaglescout007 0:3dac1f1bc9e0 59 #define TFT_NAVAJOWHITE 0x16FF
beaglescout007 0:3dac1f1bc9e0 60 #define TFT_PEACHPUFF 0xF7FE
beaglescout007 0:3dac1f1bc9e0 61 #define TFT_WHEAT 0x16FF
beaglescout007 0:3dac1f1bc9e0 62 #define TFT_PINK 0x19FE
beaglescout007 0:3dac1f1bc9e0 63 #define TFT_LIGHTPINK 0xD8FD
beaglescout007 0:3dac1f1bc9e0 64 #define TFT_THISTLE 0x1BDE
beaglescout007 0:3dac1f1bc9e0 65 #define TFT_PLUM 0x1CE5
beaglescout007 0:3dac1f1bc9e0 66 #define TFT_SILVER 0x18C6
beaglescout007 0:3dac1f1bc9e0 67 #define TFT_DARKGRAY 0x55AD
beaglescout007 0:3dac1f1bc9e0 68 #define TFT_LIGHTSLATEGRAY 0x537C
beaglescout007 0:3dac1f1bc9e0 69 #define TFT_SLATEGRAY 0x1274
beaglescout007 0:3dac1f1bc9e0 70 #define TFT_SLATEBLUE 0xFA6A
beaglescout007 0:3dac1f1bc9e0 71 #define TFT_STEELBLUE 0x374C
beaglescout007 0:3dac1f1bc9e0 72 #define TFT_MEDIUMSLATEBLUE 0x5E7B
beaglescout007 0:3dac1f1bc9e0 73 #define TFT_ROYALBLUE 0x5C43
beaglescout007 0:3dac1f1bc9e0 74 #define TFT_BLUE 0x1F00
beaglescout007 0:3dac1f1bc9e0 75 #define TFT_DODGERBLUE 0x9F24
beaglescout007 0:3dac1f1bc9e0 76 #define TFT_CORNFLOWERBLUE 0xBE6C
beaglescout007 0:3dac1f1bc9e0 77 #define TFT_DEEPSKYBLUE 0x1F06
beaglescout007 0:3dac1f1bc9e0 78 #define TFT_CYAN 0xFF07
beaglescout007 0:3dac1f1bc9e0 79 #define TFT_AQUA 0xFF07
beaglescout007 0:3dac1f1bc9e0 80 #define TFT_TURQUOISE 0x1A47
beaglescout007 0:3dac1f1bc9e0 81 #define TFT_MEDIUMTURQUOISE 0x9A4E
beaglescout007 0:3dac1f1bc9e0 82 #define TFT_DARKTURQUOISE 0x9A06
beaglescout007 0:3dac1f1bc9e0 83 #define TFT_LIGHTSEAGREEN 0xB525
beaglescout007 0:3dac1f1bc9e0 84 #define TFT_MEDIUMSPRINGGREEN 0xF307
beaglescout007 0:3dac1f1bc9e0 85 #define TFT_SPRINGGREEN 0xF007
beaglescout007 0:3dac1f1bc9e0 86 #define TFT_LIME 0xE007
beaglescout007 0:3dac1f1bc9e0 87 #define TFT_LIMEGREEN 0x6636
beaglescout007 0:3dac1f1bc9e0 88 #define TFT_YELLOWGREEN 0x669E
beaglescout007 0:3dac1f1bc9e0 89 #define TFT_LAWNGREEN 0xE087
beaglescout007 0:3dac1f1bc9e0 90 #define TFT_CHARTREUSE 0xE087
beaglescout007 0:3dac1f1bc9e0 91 #define TFT_GREENYELLOW 0xE6B7
beaglescout007 0:3dac1f1bc9e0 92 #define TFT_YELLOW 0xE0FF
beaglescout007 0:3dac1f1bc9e0 93 #define TFT_GOLD 0xC0FE
beaglescout007 0:3dac1f1bc9e0 94 #define TFT_ORANGE 0x20FD
beaglescout007 0:3dac1f1bc9e0 95 #define TFT_DARKORANGE 0x60FC
beaglescout007 0:3dac1f1bc9e0 96 #define TFT_GOLDENROD 0x24DD
beaglescout007 0:3dac1f1bc9e0 97 #define TFT_BURLYWOOD 0xD1E5
beaglescout007 0:3dac1f1bc9e0 98 #define TFT_TAN 0xB2D5
beaglescout007 0:3dac1f1bc9e0 99 #define TFT_SANDYBROWN 0x2CFD
beaglescout007 0:3dac1f1bc9e0 100 #define TFT_DARKSALMON 0xCFEC
beaglescout007 0:3dac1f1bc9e0 101 #define TFT_LIGHTCORAL 0x10F4
beaglescout007 0:3dac1f1bc9e0 102 #define TFT_SALMON 0xEFC
beaglescout007 0:3dac1f1bc9e0 103 #define TFT_LIGHTSALMON 0xFFD
beaglescout007 0:3dac1f1bc9e0 104 #define TFT_CORAL 0xAFC
beaglescout007 0:3dac1f1bc9e0 105 #define TFT_TOMATO 0x29FB
beaglescout007 0:3dac1f1bc9e0 106 #define TFT_ORANGERED 0x20FA
beaglescout007 0:3dac1f1bc9e0 107 #define TFT_RED 0xF8
beaglescout007 0:3dac1f1bc9e0 108 #define TFT_DEEPPINK 0xB2F8
beaglescout007 0:3dac1f1bc9e0 109 #define TFT_HOTPINK 0x57FB
beaglescout007 0:3dac1f1bc9e0 110 #define TFT_PALEVIOLETRED 0x92DB
beaglescout007 0:3dac1f1bc9e0 111 #define TFT_VIOLET 0x3EF4
beaglescout007 0:3dac1f1bc9e0 112 #define TFT_ORCHID 0x9BDB
beaglescout007 0:3dac1f1bc9e0 113 #define TFT_MAGENTA 0x1FF8
beaglescout007 0:3dac1f1bc9e0 114 #define TFT_FUCHSIA 0x1FF8
beaglescout007 0:3dac1f1bc9e0 115 #define TFT_MEDIUMORCHID 0xBABA
beaglescout007 0:3dac1f1bc9e0 116 #define TFT_DARKORCHID 0xBA99
beaglescout007 0:3dac1f1bc9e0 117 #define TFT_DARKVIOLET 0x1A98
beaglescout007 0:3dac1f1bc9e0 118 #define TFT_BLUEVIOLET 0x7C89
beaglescout007 0:3dac1f1bc9e0 119 #define TFT_MEDIUMPURPLE 0x9B93
beaglescout007 0:3dac1f1bc9e0 120 #define TFT_GRAY 0x1084
beaglescout007 0:3dac1f1bc9e0 121 #define TFT_MEDIUMBLUE 0x1A00
beaglescout007 0:3dac1f1bc9e0 122 #define TFT_DARKCYAN 0x7104
beaglescout007 0:3dac1f1bc9e0 123 #define TFT_CADETBLUE 0x1465
beaglescout007 0:3dac1f1bc9e0 124 #define TFT_DARKSEAGREEN 0xF295
beaglescout007 0:3dac1f1bc9e0 125 #define TFT_MEDIUMSEAGREEN 0xAE45
beaglescout007 0:3dac1f1bc9e0 126 #define TFT_TEAL 0x1004
beaglescout007 0:3dac1f1bc9e0 127 #define TFT_FORESTGREEN 0x6424
beaglescout007 0:3dac1f1bc9e0 128 #define TFT_SEAGREEN 0x6B34
beaglescout007 0:3dac1f1bc9e0 129 #define TFT_DARKKHAKI 0xCDC5
beaglescout007 0:3dac1f1bc9e0 130 #define TFT_PERU 0x28D4
beaglescout007 0:3dac1f1bc9e0 131 #define TFT_CRIMSON 0xA8E0
beaglescout007 0:3dac1f1bc9e0 132 #define TFT_INDIANRED 0xECD2
beaglescout007 0:3dac1f1bc9e0 133 #define TFT_ROSYBROWN 0x92C4
beaglescout007 0:3dac1f1bc9e0 134 #define TFT_MEDIUMVIOLETRED 0xB1C8
beaglescout007 0:3dac1f1bc9e0 135 #define TFT_DIMGRAY 0x4D6B
beaglescout007 0:3dac1f1bc9e0 136 #define TFT_BLACK 0x0
beaglescout007 0:3dac1f1bc9e0 137 #define TFT_MIDNIGHTBLUE 0xCE18
beaglescout007 0:3dac1f1bc9e0 138 #define TFT_DARKSLATEBLUE 0xF149
beaglescout007 0:3dac1f1bc9e0 139 #define TFT_DARKBLUE 0x1100
beaglescout007 0:3dac1f1bc9e0 140 #define TFT_NAVY 0x1000
beaglescout007 0:3dac1f1bc9e0 141 #define TFT_DARKSLATEGRAY 0x8A32
beaglescout007 0:3dac1f1bc9e0 142 #define TFT_GREEN 0x4
beaglescout007 0:3dac1f1bc9e0 143 #define TFT_DARKGREEN 0x2003
beaglescout007 0:3dac1f1bc9e0 144 #define TFT_DARKOLIVEGREEN 0x665B
beaglescout007 0:3dac1f1bc9e0 145 #define TFT_OLIVEDRAB 0x846C
beaglescout007 0:3dac1f1bc9e0 146 #define TFT_OLIVE 0x84
beaglescout007 0:3dac1f1bc9e0 147 #define TFT_DARKGOLDENROD 0x41BC
beaglescout007 0:3dac1f1bc9e0 148 #define TFT_CHOCOLATE 0x44D3
beaglescout007 0:3dac1f1bc9e0 149 #define TFT_SIENNA 0xA6A2
beaglescout007 0:3dac1f1bc9e0 150 #define TFT_SADDLEBROWN 0x228A
beaglescout007 0:3dac1f1bc9e0 151 #define TFT_FIREBRICK 0x24B1
beaglescout007 0:3dac1f1bc9e0 152 #define TFT_BROWN 0x65A9
beaglescout007 0:3dac1f1bc9e0 153 #define TFT_MAROON 0x80
beaglescout007 0:3dac1f1bc9e0 154 #define TFT_DARKRED 0x88
beaglescout007 0:3dac1f1bc9e0 155 #define TFT_DARKMAGENTA 0x1188
beaglescout007 0:3dac1f1bc9e0 156 #define TFT_PURPLE 0x1080
beaglescout007 0:3dac1f1bc9e0 157 #define TFT_INDIGO 0x1048
beaglescout007 0:3dac1f1bc9e0 158
beaglescout007 0:3dac1f1bc9e0 159 const unsigned char chrimg[][7] =
beaglescout007 0:3dac1f1bc9e0 160 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 20h SP
beaglescout007 0:3dac1f1bc9e0 161 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, // 21h !
beaglescout007 0:3dac1f1bc9e0 162 0x00, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, // 22h "
beaglescout007 0:3dac1f1bc9e0 163 0x00, 0x28, 0x7c, 0x28, 0x7c, 0x28, 0x00, // 23h #
beaglescout007 0:3dac1f1bc9e0 164 0x10, 0x3c, 0x50, 0x38, 0x14, 0x78, 0x10, // 24h $
beaglescout007 0:3dac1f1bc9e0 165 0x00, 0x32, 0x54, 0x68, 0x16, 0x2a, 0x4c, // 25h %
beaglescout007 0:3dac1f1bc9e0 166 0x18, 0x24, 0x14, 0x38, 0x4e, 0x44, 0x3a, // 26h &
beaglescout007 0:3dac1f1bc9e0 167 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, // 27h '
beaglescout007 0:3dac1f1bc9e0 168 0x04, 0x08, 0x10, 0x10, 0x10, 0x08, 0x04, // 28h (
beaglescout007 0:3dac1f1bc9e0 169 0x40, 0x20, 0x10, 0x10, 0x10, 0x20, 0x40, // 29h )
beaglescout007 0:3dac1f1bc9e0 170 0x10, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x10, // 2Ah *
beaglescout007 0:3dac1f1bc9e0 171 0x10, 0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, // 2Bh +
beaglescout007 0:3dac1f1bc9e0 172 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, // 2Ch ,
beaglescout007 0:3dac1f1bc9e0 173 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, // 2Dh -
beaglescout007 0:3dac1f1bc9e0 174 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, // 2Eh .
beaglescout007 0:3dac1f1bc9e0 175 0x00, 0x08, 0x08, 0x10, 0x20, 0x20, 0x00, // 2Fh /
beaglescout007 0:3dac1f1bc9e0 176
beaglescout007 0:3dac1f1bc9e0 177 0x38, 0x44, 0x4c, 0x54, 0x64, 0x44, 0x38, // 30h 0
beaglescout007 0:3dac1f1bc9e0 178 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, // 31h 1
beaglescout007 0:3dac1f1bc9e0 179 0x38, 0x44, 0x04, 0x18, 0x20, 0x40, 0x7c, // 32h 2
beaglescout007 0:3dac1f1bc9e0 180 0x38, 0x44, 0x04, 0x18, 0x04, 0x44, 0x38, // 33h 3
beaglescout007 0:3dac1f1bc9e0 181 0x08, 0x18, 0x28, 0x48, 0x7c, 0x08, 0x08, // 34h 4
beaglescout007 0:3dac1f1bc9e0 182 0x7c, 0x40, 0x78, 0x04, 0x04, 0x44, 0x38, // 35h 5
beaglescout007 0:3dac1f1bc9e0 183 0x38, 0x44, 0x40, 0x78, 0x44, 0x44, 0x38, // 36h 6
beaglescout007 0:3dac1f1bc9e0 184 0x7c, 0x44, 0x04, 0x08, 0x08, 0x10, 0x10, // 37h 7
beaglescout007 0:3dac1f1bc9e0 185 0x38, 0x44, 0x44, 0x38, 0x44, 0x44, 0x38, // 38h 8
beaglescout007 0:3dac1f1bc9e0 186 0x38, 0x44, 0x44, 0x3c, 0x04, 0x44, 0x38, // 39h 9
beaglescout007 0:3dac1f1bc9e0 187 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, // 3Ah :
beaglescout007 0:3dac1f1bc9e0 188 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x20, // 3Bh ;
beaglescout007 0:3dac1f1bc9e0 189 0x08, 0x10, 0x20, 0x40, 0x20, 0x10, 0x08, // 3Ch <
beaglescout007 0:3dac1f1bc9e0 190 0x00, 0x00, 0x7c, 0x00, 0x7c, 0x00, 0x00, // 3Dh =
beaglescout007 0:3dac1f1bc9e0 191 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, // 3Eh >
beaglescout007 0:3dac1f1bc9e0 192 0x38, 0x44, 0x44, 0x08, 0x10, 0x00, 0x10, // 3Fh >
beaglescout007 0:3dac1f1bc9e0 193
beaglescout007 0:3dac1f1bc9e0 194 0x7c, 0x82, 0xba, 0xa6, 0xbc, 0x80, 0x7c, // 40h @
beaglescout007 0:3dac1f1bc9e0 195 0x38, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, // 41h A
beaglescout007 0:3dac1f1bc9e0 196 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x78, // 42h B
beaglescout007 0:3dac1f1bc9e0 197 0x38, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, // 43h C
beaglescout007 0:3dac1f1bc9e0 198 0x70, 0x48, 0x44, 0x44, 0x44, 0x48, 0x70, // 44h D
beaglescout007 0:3dac1f1bc9e0 199 0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x7c, // 45h E
beaglescout007 0:3dac1f1bc9e0 200 0x7c, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, // 46h F
beaglescout007 0:3dac1f1bc9e0 201 0x38, 0x44, 0x40, 0x4c, 0x44, 0x44, 0x38, // 47h G
beaglescout007 0:3dac1f1bc9e0 202 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, // 48h H
beaglescout007 0:3dac1f1bc9e0 203 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, // 49h I
beaglescout007 0:3dac1f1bc9e0 204 0x3c, 0x08, 0x08, 0x08, 0x08, 0x48, 0x30, // 4Ah J
beaglescout007 0:3dac1f1bc9e0 205 0x44, 0x48, 0x50, 0x60, 0x50, 0x48, 0x44, // 4Bh K
beaglescout007 0:3dac1f1bc9e0 206 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7c, // 4CH L
beaglescout007 0:3dac1f1bc9e0 207 0x44, 0x6c, 0x54, 0x54, 0x44, 0x44, 0x44, // 4DH M
beaglescout007 0:3dac1f1bc9e0 208 0x44, 0x64, 0x54, 0x54, 0x4c, 0x44, 0x44, // 4EH N
beaglescout007 0:3dac1f1bc9e0 209 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, // 4FH O
beaglescout007 0:3dac1f1bc9e0 210
beaglescout007 0:3dac1f1bc9e0 211 0x78, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40, // 50h P
beaglescout007 0:3dac1f1bc9e0 212 0x38, 0x44, 0x44, 0x44, 0x54, 0x48, 0x34, // 51h Q
beaglescout007 0:3dac1f1bc9e0 213 0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, // 52h R
beaglescout007 0:3dac1f1bc9e0 214 0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x38, // 53h S
beaglescout007 0:3dac1f1bc9e0 215 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // 54h T
beaglescout007 0:3dac1f1bc9e0 216 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, // 55h U
beaglescout007 0:3dac1f1bc9e0 217 0x44, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, // 56h V
beaglescout007 0:3dac1f1bc9e0 218 0x44, 0x44, 0x54, 0x54, 0x54, 0x54, 0x28, // 57h W
beaglescout007 0:3dac1f1bc9e0 219 0x44, 0x44, 0x28, 0x10, 0x28, 0x44, 0x44, // 58h X
beaglescout007 0:3dac1f1bc9e0 220 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, // 59h Y
beaglescout007 0:3dac1f1bc9e0 221 0x7c, 0x04, 0x08, 0x10, 0x20, 0x40, 0x7c, // 5Ah Z
beaglescout007 0:3dac1f1bc9e0 222 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c, // 5Bh [
beaglescout007 0:3dac1f1bc9e0 223 0x00, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, // 5Ch back slash
beaglescout007 0:3dac1f1bc9e0 224 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, // 5Dh ]
beaglescout007 0:3dac1f1bc9e0 225 0x00, 0x10, 0x28, 0x00, 0x00, 0x00, 0x00, // 5Eh ^
beaglescout007 0:3dac1f1bc9e0 226 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c // 5Fh _
beaglescout007 0:3dac1f1bc9e0 227 };
beaglescout007 0:3dac1f1bc9e0 228
beaglescout007 0:3dac1f1bc9e0 229 #pragma pack(2)
beaglescout007 0:3dac1f1bc9e0 230 typedef struct tagBITMAPFILEHEADER {
beaglescout007 0:3dac1f1bc9e0 231 unsigned short bfType;
beaglescout007 0:3dac1f1bc9e0 232 unsigned long bfSize;
beaglescout007 0:3dac1f1bc9e0 233 unsigned short bfReserved1;
beaglescout007 0:3dac1f1bc9e0 234 unsigned short bfReserved2;
beaglescout007 0:3dac1f1bc9e0 235 unsigned long bfOffBits;
beaglescout007 0:3dac1f1bc9e0 236 } BITMAPFILEHEADER;
beaglescout007 0:3dac1f1bc9e0 237
beaglescout007 0:3dac1f1bc9e0 238 typedef struct tagBITMAPINFOHEADER{
beaglescout007 0:3dac1f1bc9e0 239 unsigned long biSize;
beaglescout007 0:3dac1f1bc9e0 240 long biWidth;
beaglescout007 0:3dac1f1bc9e0 241 long biHeight;
beaglescout007 0:3dac1f1bc9e0 242 unsigned short biPlanes;
beaglescout007 0:3dac1f1bc9e0 243 unsigned short biBitCount;
beaglescout007 0:3dac1f1bc9e0 244 unsigned long biCompression;
beaglescout007 0:3dac1f1bc9e0 245 unsigned long biSizeImage;
beaglescout007 0:3dac1f1bc9e0 246 long biXPixPerMeter;
beaglescout007 0:3dac1f1bc9e0 247 long biYPixPerMeter;
beaglescout007 0:3dac1f1bc9e0 248 unsigned long biClrUsed;
beaglescout007 0:3dac1f1bc9e0 249 unsigned long biClrImporant;
beaglescout007 0:3dac1f1bc9e0 250 } BITMAPINFOHEADER;
beaglescout007 0:3dac1f1bc9e0 251 #pragma pack()
beaglescout007 0:3dac1f1bc9e0 252
beaglescout007 0:3dac1f1bc9e0 253 #pragma pack(1)
beaglescout007 0:3dac1f1bc9e0 254 typedef struct tagBMP24{
beaglescout007 0:3dac1f1bc9e0 255 unsigned char B;
beaglescout007 0:3dac1f1bc9e0 256 unsigned char G;
beaglescout007 0:3dac1f1bc9e0 257 unsigned char R;
beaglescout007 0:3dac1f1bc9e0 258 } BMP24;
beaglescout007 0:3dac1f1bc9e0 259 #pragma pack()
beaglescout007 0:3dac1f1bc9e0 260
beaglescout007 0:3dac1f1bc9e0 261 void tft_init();
beaglescout007 0:3dac1f1bc9e0 262 void tft_set_window(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);
beaglescout007 0:3dac1f1bc9e0 263 void tft_clear(uint16_t color);
beaglescout007 0:3dac1f1bc9e0 264 void tft_put_char(int x, int y, char chr, uint16_t color, uint16_t bgcolor);
beaglescout007 0:3dac1f1bc9e0 265 void tft_text(int x, int y, char *text, uint16_t color, uint16_t bgcolor);
beaglescout007 0:3dac1f1bc9e0 266 void tft_hline(int x1, int y, int x2, uint16_t color);
beaglescout007 0:3dac1f1bc9e0 267 void tft_vline(int x, int y1, int y2, uint16_t color);
beaglescout007 0:3dac1f1bc9e0 268 void tft_box(int x1, int y1, int x2, int y2, uint16_t color);
beaglescout007 0:3dac1f1bc9e0 269 void tft_boxfill(int x1, int y1, int x2, int y2, uint16_t color);
beaglescout007 0:3dac1f1bc9e0 270 bool draw_bmp_4bpp(const unsigned char *imgdata, int x, int y);
beaglescout007 0:3dac1f1bc9e0 271
beaglescout007 0:3dac1f1bc9e0 272 #endif
beaglescout007 0:3dac1f1bc9e0 273