Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 12:01 29 Mar 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : ILI9488 drivers: MM2 and MM+

     Page 1 of 3    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 01:04pm 27 May 2019
Copy link to clipboard 
Print this post



The 3.5" ILI9488 display is 480x320 pixels and RGB666 and is shown against the 2.8" ILI9341 display for comparison. Drivers are attached for the MM2 and MM+. The pinout on the display is identical to the ILI9341 and it is available from here

The MM2 driver supports all the normal drawing commands. In addition the MM+ driver supports transparent text, image load and blit.

There is one very strange thing I found on my version of the display: Touch and the SDcard share the SPI port with the display. I found that the SDO(MISO) pin on the display (SPI input from the display to the Micromite) interfered with the SD_MISO and T_DO pins even though the display wasn't selected (CS high). This could be fixed by connecting SDO(MISO) to the Micromite through a 680ohm resistor - very strange.

SDO(MISO) should not be connected for the MM2 and is only needed for the MM+ if blit or transparent text are needed. Otherwise leave it disconnected.

The display isn't very fast as there is a lot of data to move over the SPI bus (480 * 320 * 3 = 460,800 bytes) for a full screen refresh but if you need a higher resolution display on the MM2 it works nicely.


MM2
Sub mm.startup
ILI9488 16,2,9, 1 ' landscape is natural orientation for display
End Sub
CSub ILI9488
000002A0
'spi_write_data
27BDFFE0 AFBF001C AFB10018 AFB00014 309100FF 3C109D00 8E030090 8E02001C
8064002C 0040F809 24050006 8E030090 8E02001C 8064002D 0040F809 24050005
3C02BF80 AC515820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C425820
3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 8FBF001C 8FB10018
8FB00014 03E00008 27BD0020
'spi_write_command
27BDFFE0 AFBF001C AFB10018 AFB00014 309100FF 3C109D00 8E030090 8E02001C
8064002C 0040F809 24050005 8E030090 8E02001C 8064002D 0040F809 24050005
3C02BF80 AC515820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C425820
3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 8FBF001C 8FB10018
8FB00014 03E00008 27BD0020
'spi_write_cd
27BDFFD8 AFBF0024 AFB10020 AFB0001C AFA60030 AFA70034 00A08821 27A20030
AFA20010 308400FF 0411FFD2 00000000 1A20000A 00008021 8FA20010 24430004
AFA30010 90440000 0411FFA7 00000000 26100001 1611FFF9 8FA20010 8FBF0024
8FB10020 8FB0001C 03E00008 27BD0028
'DefineRegion
27BDFFD8 AFBF0024 AFB40020 AFB3001C AFB20018 AFB10014 AFB00010 00808821
00A09821 00C09021 00E0A021 3C109D00 8E030090 8E02001C 8064002C 0040F809
24050005 8E030090 8E02001C 8064002D 0040F809 24050005 2403002A 3C02BF80
AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C10BF80 8E025820 3C029D00
8C430090 8C42001C 8064002C 0040F809 24050006 00111203 AE025820 3C03BF80
8C625810 30420080 1040FFFD 3C02BF80 8C435820 AC515820 3C03BF80 8C625810
30420080 1040FFFD 3C02BF80 8C435820 00121A03 AC435820 3C03BF80 8C625810
30420080 1040FFFD 3C02BF80 8C435820 AC525820 3C03BF80 8C625810 30420080
1040FFFD 3C10BF80 8E025820 3C029D00 8C430090 8C42001C 8064002C 0040F809
24050005 2402002B AE025820 3C03BF80 8C625810 30420080 1040FFFD 3C10BF80
8E025820 3C029D00 8C430090 8C42001C 8064002C 0040F809 24050006 00131203
AE025820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AC535820
3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 00141A03 AC435820
3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C435820 AC545820 3C03BF80
8C625810 30420080 1040FFFD 3C02BF80 8C425820 3C029D00 8C430090 8C42001C
8064002C 0040F809 24050005 8FA20038 1040000C 2403002E 2403002C 3C02BF80
AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C425820 1000000A
3C029D00 3C02BF80 AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80
8C425820 3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 8FBF0024
8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0028
'DrawBitmapSPI
27BDFFA8 AFBF0054 AFBE0050 AFB7004C AFB60048 AFB50044 AFB40040 AFB3003C
AFB20038 AFB10034 AFB00030 0080F021 AFA5005C 00C0B021 AFA70064 8FB2006C
8FB50070 3C029D00 8C420094 8C420000 0082102B 104000C4 8FB70074 3C029D00
8C420098 8C420000 00A2102B 104000BE 8FA20068 70461802 00643021 04C000BA
70471002 00451821 046000B7 8FA3005C 28A50000 0005180B 00602821 3C03BF80
8C645830 AFA40018 8C645800 AFA4001C 8C645840 AFA40020 AC605800 3C040001
34848260 AC645800 AC605830 24040C00 AC645840 7E503C00 7E513A00 325200FF
7EB33C00 7EB43A00 32B500FF 24A7FFFF 24030001 AFA30010 03C02021 24C6FFFF
00E23821 0411FF1F 00000000 3C029D00 8C430090 8C42001C 8064002C 0040F809
24050006 3C049D00 8C830090 8C82001C 8064002D 0040F809 24050005 00161023
AFA20024 8FA20064 70567802 25EFFFFF AFB60028 8FAE005C 00005821 0000C821
8FAD0068 3C069D00 240C0001 10000059 3C02BF80 25CE0001 25C3FFFF 0460004E
00000000 8CC30098 8C630000 006E182B 14600076 8FBF0054 1EC00037 01E04821
10000045 00000000 24630001 2464FFFF 0480002A 00000000 8CC40094 8C840000
0083202B 14800025 00000000 91040000 00872024 10800012 00000000 8C445810
30840002 1480FFFD 00000000 AC505820 8C445810 30840002 1480FFFD 00000000
AC515820 8C445810 30840002 1480FFFD 00000000 AC525820 10000010 00000000
8C445810 30840002 1480FFFD 00000000 AC535820 8C445810 30840002 1480FFFD
00000000 AC545820 8C445810 30840002 1480FFFD 00000000 AC555820 5465FFD3
24630001 254A0001 15560005 2529FFFF 10000011 00000000 03C01821 00005021
014B2021 24850007 28880000 00A8200B 000440C3 02E84021 000927C3 00042742
01243821 30E70007 00E43823 00EC3804 1000FFBD 006D2821 55D8FFAF 25CE0001
27390001 8FA30024 01E37821 8FA40028 01645821 8FA40064 0324182A 10600005
8FA30068 1C60FFA3 01C3C021 1000FFF5 27390001 3C02BF80 8C435810 30630080
1060FFFD 00000000 10000002 3C02BF80 8C435820 8C435810 30630020 1060FFFC
3C10BF80 AE005800 24030040 3C02BF80 AC435814 3C029D00 8C430090 8C42001C
8064002D 0040F809 24050006 AE005800 8FA40018 AE045830 8FA20020 AE025840
8FA3001C AE035800 8FBF0054 8FBE0050 8FB7004C 8FB60048 8FB50044 8FB40040
8FB3003C 8FB20038 8FB10034 8FB00030 03E00008 27BD0058
'DrawRectangleSPI
27BDFFB0 AFBF004C AFBE0048 AFB70044 AFB60040 AFB5003C AFB40038 AFB30034
AFB20030 AFB1002C AFB00028 8FB00060 3C02BF80 8C435830 AFA30018 8C435800
AFA3001C 8C435840 AFA30020 AC405800 3C030001 34638260 AC435800 AC405830
24030C00 AC435840 0086102A 14400005 00A7102A 00801021 00C02021 00403021
00A7102A 14400004 28940000 00A01021 00E02821 00403821 0014200B 0080A021
3C029D00 8C420094 8C420000 0082202B 2443FFFF 0064A00A 28D50000 0015300B
00C0A821 00C2182B 2442FFFF 0043A80A 28B60000 0016280B 00A0B021 3C029D00
8C420098 8C420000 00A2202B 2443FFFF 0064B00A 28F70000 0017380B 00E0B821
00E2182B 2442FFFF 0043B80A 7E123C00 7E113A00 321000FF 241E0001 AFBE0010
02802021 02C02821 02A03021 02E03821 0411FE2E 00000000 3C139D00 8E630090
8E62001C 8064002C 0040F809 24050006 8E630090 8E62001C 8064002D 0040F809
24050005 03D4A023 0295A821 03D62023 00972021 70952002 10800013 2484FFFF
3C02BF80 8C435810 30630002 1460FFFD 00000000 AC525820 8C435810 30630002
1460FFFD 00000000 AC515820 8C435810 30630002 1460FFFD 00000000 AC505820
1480FFF0 2484FFFF 3C03BF80 8C625810 30420080 1040FFFD 3C02BF80 8C425810
30420020 14400006 3C02BF80 8C435820 8C435810 30630020 1060FFFC 00000000
3C10BF80 AE005800 24030040 3C02BF80 AC435814 3C029D00 8C430090 8C42001C
8064002D 0040F809 24050006 AE005800 8FA20018 AE025830 8FA30020 AE035840
8FA2001C AE025800 8FBF004C 8FBE0048 8FB70044 8FB60040 8FB5003C 8FB40038
8FB30034 8FB20030 8FB1002C 8FB00028 03E00008 27BD0050
'getFPC
27BDFFF8 AFBF0004 00852023 03E42021 ACC40000 8FBF0004 03E00008 27BD0008
'pstring
27BDFFE0 AFBF001C AFB00018 00808021 00002021 3C059D00 24A50A5C 27A60010
0411FFEF 00000000 8FA40010 3C029D00 8C42002C 0040F809 02042021 8FBF001C
8FB00018 03E00008 27BD0020
'main
27BDFFC8 AFBF0034 AFB40030 AFB3002C AFB20028 AFB10024 AFB00020 00808821
00A08021 00C09021 00E09821 00002021 3C059D00 24A50AC4 27A60018 0411FFD5
00000000 3C029D00 8C430090 8E040000 A064002E 8C430090 8E240000 A064002C
8C430090 8E440000 A064002D 8C430090 92640000 24840002 A0640015 8C420090
80430015 28640004 5480000A 24030014 3C059D00 2463FFFC A0430015 8CA20090
80430015 28640004 5080FFFB 2463FFFC 24030014 A0430014 3C109D00 8E030090
8E020010 8064002E 24050008 0040F809 00003021 8E030090 8E020010 8064002E
24050065 0040F809 00003021 8E030090 8E02001C 8064002E 0040F809 24050006
8E030090 8E020010 8064002C 24050008 0040F809 00003021 8E030090 8E020010
8064002C 24050065 0040F809 00003021 8E030090 8E02001C 8064002C 0040F809
24050006 8E030090 8E020010 8064002D 24050008 0040F809 00003021 8E030090
8E020010 8064002D 24050065 0040F809 00003021 8E030090 8E02001C 8064002D
0040F809 24050006 3C02BF81 8C44F220 7C84D800 3C020661 3442A053 1082000B
24030050 3C02BF81 8C43F220 7C63D800 3C020660 3442A053 00621826 24020050
2404000C 0083100B 00401821 3C029D00 8C420088 00621821 8C640000 24030064
54830007 00008821 3C03BF80 8C715830 8C725800 8C745840 10000003 3C03BF81
00009021 3C03BF81 8C65F220 7CA5D800 3C040661 3484A053 10A4000B 24030050
3C03BF81 8C64F220 7C84D800 3C030660 3463A053 00831826 24040050 2405000C
00A3200B 00801821 00621021 8C430000 24020065 1062008E 3C029D00 8C420010
3C03BF81 8C65F220 7CA5D800 3C030661 3463A053 10A3000B 24040014 3C03BF81
8C64F220 7C84D800 3C030660 3463A053 00832026 24030014 24050003 00A4180B
00602021 24050008 0040F809 00003021 3C029D00 8C420010 3C03BF81 8C65F220
7CA5D800 3C030661 3463A053 10A3000B 24040014 3C03BF81 8C64F220 7C84D800
3C030660 3463A053 00832026 24030014 24050003 00A4180B 00602021 24050065
0040F809 00003021 3C029D00 8C420010 3C03BF81 8C65F220 7CA5D800 3C030661
3463A053 10A3000B 24040029 3C03BF81 8C64F220 7C84D800 3C030660 3463A053
00832026 24030029 2405000E 00A4180B 00602021 24050002 0040F809 00003021
3C029D00 8C420010 3C03BF81 8C65F220 7CA5D800 3C030661 3463A053 10A3000B
24040029 3C03BF81 8C64F220 7C84D800 3C030660 3463A053 00832026 24030029
2405000E 00A4180B 00602021 24050065 0040F809 00003021 3C029D00 8C420010
3C03BF81 8C65F220 7CA5D800 3C030661 3463A053 10A3000B 2404000E 3C03BF81
8C64F220 7C84D800 3C030660 3463A053 00832026 2403000E 24050019 00A4180B
00602021 24050008 0040F809 00003021 3C029D00 8C420010 3C03BF81 8C65F220
7CA5D800 3C030661 3463A053 10A3000B 2404000E 3C03BF81 8C64F220 7C84D800
3C030660 3463A053 00832026 2403000E 24050019 00A4180B 00602021 24050065
0040F809 00003021 3C02BF81 8C43FA84 24040001 7C831804 AC43FA84 3C02BF81
8C43FB04 24040003 7C831804 AC43FB04 3C02BF80 34038060 AC435800 24030003
AC435830 24030C00 AC435840 16200005 3C109D00 8C515830 8C525800 8C545840
3C109D00 8E030090 8E02001C 8064002E 0040F809 24050006 8E020004 0040F809
24042710 8E030090 8E02001C 8064002E 0040F809 24050005 8E020004 0040F809
24042710 8E030090 8E02001C 8064002E 0040F809 24050006 240400E0 0411FC3B
00000000 00002021 0411FC15 00000000 24040003 0411FC12 00000000 24040009
0411FC0F 00000000 24040008 0411FC0C 00000000 24040016 0411FC09 00000000
2404000A 0411FC06 00000000 2404003F 0411FC03 00000000 24040078 0411FC00
00000000 2404004C 0411FBFD 00000000 24040009 0411FBFA 00000000 2404000A
0411FBF7 00000000 24040008 0411FBF4 00000000 24040016 0411FBF1 00000000
2404001A 0411FBEE 00000000 2404000F 0411FBEB 00000000 240400E1 0411FC0B
00000000 00002021 0411FBE5 00000000 24040016 0411FBE2 00000000 24040019
0411FBDF 00000000 24040003 0411FBDC 00000000 2404000F 0411FBD9 00000000
24040005 0411FBD6 00000000 24040032 0411FBD3 00000000 24040045 0411FBD0
00000000 24040046 0411FBCD 00000000 24040004 0411FBCA 00000000 2404000E
0411FBC7 00000000 2404000D 0411FBC4 00000000 24040035 0411FBC1 00000000
24040037 0411FBBE 00000000 2404000F 0411FBBB 00000000 240400C0 0411FBDB
00000000 24040017 0411FBB5 00000000 24040015 0411FBB2 00000000 240400C1
0411FBD2 00000000 24040041 0411FBAC 00000000 240400C5 0411FBCC 00000000
00002021 0411FBA6 00000000 24040012 0411FBA3 00000000 24040080 0411FBA0
00000000 24040036 0411FBC0 00000000 24040048 0411FB9A 00000000 2404003A
0411FBBA 00000000 24040066 0411FB94 00000000 240400B0 0411FBB4 00000000
00002021 0411FB8E 00000000 240400B1 0411FBAE 00000000 240400A0 0411FB88
00000000 240400B4 0411FBA8 00000000 24040002 0411FB82 00000000 240400B6
0411FBA2 00000000 24040002 0411FB7C 00000000 24040002 0411FB79 00000000
2404003B 0411FB76 00000000 240400B7 0411FB96 00000000 240400C6 0411FB70
00000000 240400F7 0411FB90 00000000 240400A9 0411FB6A 00000000 24040051
0411FB67 00000000 2404002C 0411FB64 00000000 24040082 0411FB61 00000000
24040011 0411FB81 00000000 8E020004 3C040001 0040F809 3484D4C0 24040029
0411FB7A 00000000 8E020004 0040F809 240461A8 8E020090 80500015 2610FFFF
24040036 0411FB71 00000000 24020001 1202000D 2A020002 10400005 24020002
12000014 24040028 10000030 00000000 12020024 24020003 1602002C 24040088
10000016 00000000 24040048 0411FB3C 00000000 3C029D00 8C430094 24040140
AC640000 8C420098 240301E0 1000001F AC430000 0411FB32 00000000 3C029D00
8C430094 240401E0 AC640000 8C420098 24030140 10000015 AC430000 0411FB28
00000000 3C029D00 8C430094 24040140 AC640000 8C420098 240301E0 1000000B
AC430000 240400E8 0411FB1D 00000000 3C029D00 8C430094 240401E0 AC640000
8C420098 24030140 AC430000 8FA50018 3C029D00 8C430048 3C049D00 2484079C
00852021 AC640000 8FA50018 8C43004C 3C049D00 24840404 00852021 AC640000
8C430048 8C440094 8C860000 8C420098 8C470000 AFA00010 8C620000 00002021
00002821 24C6FFFF 0040F809 24E7FFFF 3C02BF80 AC515830 AC525800 AC545840
3C049D00 24841450 0411FD82 00000000 8FBF0034 8FB40030 8FB3002C 8FB20028
8FB10024 8FB00020 03E00008 27BD0038
'.rodata
'startup
39494C49 20383834 76697264 6C207265 6564616F 000A0D64
End CSub



MM+
Sub mm.startup
ILI9488 27,28,24, 1 ' landscape
End Sub
CSub ILI9488
0000041F
'spi_write_data
27BDFFE0 AFBF001C AFB10018 AFB00014 309100FF 3C109D00 8E030090 8E02001C
8064002C 0040F809 24050006 8E030090 8E02001C 8064002D 0040F809 24050005
3C02BF80 AC515A20 3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C425A20
3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 8FBF001C 8FB10018
8FB00014 03E00008 27BD0020
'spi_write_command
27BDFFE0 AFBF001C AFB10018 AFB00014 309100FF 3C109D00 8E030090 8E02001C
8064002C 0040F809 24050005 8E030090 8E02001C 8064002D 0040F809 24050005
3C02BF80 AC515A20 3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C425A20
3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 8FBF001C 8FB10018
8FB00014 03E00008 27BD0020
'spi_write_cd
27BDFFD8 AFBF0024 AFB10020 AFB0001C AFA60030 AFA70034 00A08821 27A20030
AFA20010 308400FF 0411FFD2 00000000 1A20000A 00008021 8FA20010 24430004
AFA30010 90440000 0411FFA7 00000000 26100001 1611FFF9 8FA20010 8FBF0024
8FB10020 8FB0001C 03E00008 27BD0028
'DefineRegion
27BDFFD8 AFBF0024 AFB40020 AFB3001C AFB20018 AFB10014 AFB00010 00808821
00A09821 00C09021 00E0A021 3C109D00 8E030090 8E02001C 8064002C 0040F809
24050005 8E030090 8E02001C 8064002D 0040F809 24050005 2403002A 3C02BF80
AC435A20 3C03BF80 8C625A10 30420080 1040FFFD 3C10BF80 8E025A20 3C029D00
8C430090 8C42001C 8064002C 0040F809 24050006 00111203 AE025A20 3C03BF80
8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 AC515A20 3C03BF80 8C625A10
30420080 1040FFFD 3C02BF80 8C435A20 00121A03 AC435A20 3C03BF80 8C625A10
30420080 1040FFFD 3C02BF80 8C435A20 AC525A20 3C03BF80 8C625A10 30420080
1040FFFD 3C10BF80 8E025A20 3C029D00 8C430090 8C42001C 8064002C 0040F809
24050005 2402002B AE025A20 3C03BF80 8C625A10 30420080 1040FFFD 3C10BF80
8E025A20 3C029D00 8C430090 8C42001C 8064002C 0040F809 24050006 00131203
AE025A20 3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 AC535A20
3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 00141A03 AC435A20
3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 AC545A20 3C03BF80
8C625A10 30420080 1040FFFD 3C02BF80 8C425A20 3C029D00 8C430090 8C42001C
8064002C 0040F809 24050005 8FA20038 1040000C 2403002E 2403002C 3C02BF80
AC435A20 3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C425A20 1000000A
3C029D00 3C02BF80 AC435A20 3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80
8C425A20 3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006 8FBF0024
8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0028
'DrawBitmapSPI
27BDFF98 AFBF0064 AFBE0060 AFB7005C AFB60058 AFB50054 AFB40050 AFB3004C
AFB20048 AFB10044 AFB00040 AFA40068 AFA5006C 00C0F021 AFA70074 8FB5007C
3C029D00 8C420094 8C430000 0083102B 10400113 8FB00080 3C029D00 8C420098
8C420000 00A2202B 1080010D 8FA40078 8FA60068 709E3802 00E62821 04A00108
8FA60074 70862002 8FA7006C 00873021 04C00103 28E60000 0006380B AFA70024
24A5FFFF AFA5001C 00A3902B 2463FFFF 0072280A 00A09021 24E3FFFF 00641821
AFA30020 0062982B 2442FFFF 0053180A 00609821 3C02BF80 8C435A30 AFA30028
8C445A00 AFA4002C 8C455A40 AFA50030 AC405A00 3C030001 34638260 AC435A00
AC405A30 24030C00 AC435A40 2402FFFF 16020018 0000A021 3C119D00 24040003
73C42002 8FA20074 70822002 8FA20078 70822002 8E22003C 8FA30078 0040F809
70832002 0040A021 8E2200E0 8FA50068 28A40000 AFB40010 8C420000 0004280B
00A02021 8FA50024 02403021 0040F809 02603821 7EB13C00 7EB23A00 32B300FF
7E153C00 7E163A00 321700FF 24020001 AFA20010 8FA40068 8FA50024 8FA6001C
8FA70020 0411FEF7 00000000 3C069D00 8CC30090 8CC2001C 8064002C 0040F809
24050006 3C079D00 8CE30090 8CE2001C 8064002D 0040F809 24050005 001E1023
AFA20034 8FA30074 707E1002 2442FFFF AFA20020 AFBE0038 8FB9006C 00007021
00003821 AFA00024 8FB80078 3C059D00 240F0001 3C02BF80 240CFFFF AFB90018
10000078 8FB90084 8FA40018 24840001 2483FFFF 04600066 AFA40018 8CA30098
8C630000 0064182B 14600096 8FBF0064 1FC0004F 8FAA0020 1000005E 8FA60018
24630001 2466FFFF 04C00042 00000000 8CA60094 8CC60000 00C3302B 14C0003D
00000000 91260000 00C83024 10C00012 00000000 8C465A10 30C60002 14C0FFFD
00000000 AC515A20 8C465A10 30C60002 14C0FFFD 00000000 AC525A20 8C465A10
30C60002 14C0FFFD 00000000 AC535A20 10000028 24E70003 160C0017 00000000
8C465A10 30C60002 14C0FFFD 00E06821 02873021 80C60002 AC465A20 8C465A10
30C60002 14C0FFFD 028D3021 80C60001 AC465A20 8C465A10 30C60002 14C0FFFD
00000000 028D6821 81A60000 AC465A20 10000010 24E70003 8C465A10 30C60002
14C0FFFD 00000000 AC555A20 8C465A10 30C60002 14C0FFFD 00000000 AC565A20
8C465A10 30C60002 14C0FFFD 00000000 AC575A20 5464FFBB 24630001 256B0001
157E0005 254AFFFF 10000012 8FA60018 8FA30068 00005821 016E2021 24860007
28890000 00C9200B 000448C3 03294821 000A27C3 00042742 01444021 31080007
01044023 010F4004 1000FFA5 00782021 8FA60018 8FA3001C 14C3FF94 8FA40018
8FA40024 24840001 AFA40024 8FA60020 8FA30034 00C33021 AFA60020 8FA40038
01C47021 8FA60024 8FA40074 00C4182A 10600006 8FA60078 18C0FFF1 8FA30018
00661821 1000FF80 AFA3001C 3C02BF80 8C435A10 30630080 1060FFFD 00000000
10000002 3C02BF80 8C435A20 8C435A10 30630020 1060FFFC 3C10BF80 AE005A00
24030040 3C02BF80 AC435A14 3C029D00 8C430090 8C42001C 8064002D 0040F809
24050006 AE005A00 8FA40028 AE045A30 8FA50030 AE055A40 8FA6002C AE065A00
8FBF0064 8FBE0060 8FB7005C 8FB60058 8FB50054 8FB40050 8FB3004C 8FB20048
8FB10044 8FB00040 03E00008 27BD0068
'DrawRectangleSPI
27BDFFB0 AFBF004C AFBE0048 AFB70044 AFB60040 AFB5003C AFB40038 AFB30034
AFB20030 AFB1002C AFB00028 8FB00060 3C02BF80 8C435A30 AFA30018 8C435A00
AFA3001C 8C435A40 AFA30020 AC405A00 3C030001 34638260 AC435A00 AC405A30
24030C00 AC435A40 0086102A 14400005 00A7102A 00801021 00C02021 00403021
00A7102A 14400004 28940000 00A01021 00E02821 00403821 0014200B 0080A021
3C029D00 8C420094 8C420000 0082202B 2443FFFF 0064A00A 28D50000 0015300B
00C0A821 00C2182B 2442FFFF 0043A80A 28B60000 0016280B 00A0B021 3C029D00
8C420098 8C420000 00A2202B 2443FFFF 0064B00A 28F70000 0017380B 00E0B821
00E2182B 2442FFFF 0043B80A 7E123C00 7E113A00 321000FF 241E0001 AFBE0010
02802021 02C02821 02A03021 02E03821 0411FDE0 00000000 3C139D00 8E630090
8E62001C 8064002C 0040F809 24050006 8E630090 8E62001C 8064002D 0040F809
24050005 03D4A023 0295A821 03D62023 00972021 70952002 10800013 2484FFFF
3C02BF80 8C435A10 30630002 1460FFFD 00000000 AC525A20 8C435A10 30630002
1460FFFD 00000000 AC515A20 8C435A10 30630002 1460FFFD 00000000 AC505A20
1480FFF0 2484FFFF 3C03BF80 8C625A10 30420080 1040FFFD 3C02BF80 8C425A10
30420020 14400006 3C02BF80 8C435A20 8C435A10 30630020 1060FFFC 00000000
3C10BF80 AE005A00 24030040 3C02BF80 AC435A14 3C029D00 8C430090 8C42001C
8064002D 0040F809 24050006 AE005A00 8FA20018 AE025A30 8FA30020 AE035A40
8FA2001C AE025A00 8FBF004C 8FBE0048 8FB70044 8FB60040 8FB5003C 8FB40038
8FB30034 8FB20030 8FB1002C 8FB00028 03E00008 27BD0050
'ReadBufferSPI
27BDFFD0 AFBF002C AFB40028 AFB30024 AFB20020 AFB1001C 0086102A 14400004
AFB00018 00801021 00C02021 00403021 00A7102A 14400005 28820000 00A01021
00E02821 00403821 28820000 0002200B 3C029D00 8C420094 8C420000 0082402B
2443FFFF 0068200A 28C30000 0003300B 00C2182B 2442FFFF 0043300A 28A20000
0002280B 3C029D00 8C420098 8C420000 00A2402B 2443FFFF 0068280A 28E30000
0003380B 00E2182B 2442FFFF 0043380A 24020001 00458823 02278821 00441823
00661821 72238802 3C10BF80 8E125A30 8E145A00 8E135A40 AE005A00 3C030001
34638260 AE035A00 AE025A30 AFA00010 0411FD52 00000000 3C029D00 8C430090
8C42001C 8064002D 0040F809 24050005 AE005A20 3C03BF80 8C625A10 30420080
1040FFFD 3C02BF80 8C435A20 8C425A10 30420020 14400006 3C02BF80 8C435A20
8C435A10 30630020 1060FFFC 00000000 12200014 2631FFFF 8FA40040 3C03BF80
AC605A20 AC605A20 AC605A20 8C625A10 30420080 1040FFFD 00000000 8C625A20
A0820002 8C625A20 A0820001 8C625A20 A0820000 12200003 24840003 1000FFF0
2631FFFF 3C109D00 8E030090 8E02001C 8064002C 0040F809 24050005 8E030090
8E02001C 8064002D 0040F809 24050006 3C02BF80 AC405A00 AC525A30 AC535A40
AC545A00 8FBF002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008
27BD0030
'DrawBufferSPI
27BDFFC0 AFBF003C AFBE0038 AFB70034 AFB60030 AFB5002C AFB40028 AFB30024
AFB20020 AFB1001C AFB00018 8FB00050 3C03BF80 8C765A30 8C7E5A00 8C775A40
AC605A00 3C020001 34428260 AC625A00 AC605A30 24020C00 AC625A40 0086102A
50400004 00808821 00C08821 10000002 00809821 00C09821 00A7102A 50400004
00A09021 00E09021 10000002 00A0A821 00E0A821 2A620000 0002200B 3C029D00
8C420094 8C430000 0263682B 246CFFFF 2A280000 0008300B 00C04021 0223482B
01803021 2AA20000 0002280B 3C029D00 8C420098 8C430000 02A3582B 246AFFFF
2A420000 0002380B 00E01021 0243382B 240E0001 AFAE0010 018D200A 014B280A
0109300B 0147100A 00403821 0411FCCA 00000000 3C149D00 8E830090 8E82001C
8064002C 0040F809 24050006 8E830090 8E82001C 8064002D 0040F809 24050005
0255102A 10400030 0233402A 10000034 3C03BF80 04400022 00608021 8CC50094
8CA50000 0045282B 50A0001E 24420001 06A2001C 24420001 8CC50098 8CA50000
02A5282B 50A00017 24420001 8067FFFD 8069FFFE 806AFFFF 00608021 8C855A10
30A50002 14A0FFFD 00000000 AC8A5A20 8C855A10 30A50002 14A0FFFD 00000000
AC895A20 8C855A10 30A50002 14A0FFFD 00000000 AC875A20 10000002 24420001
24420001 0222282A 10A0FFDA 24630003 26B50001 0255102A 10400005 3C03BF80
10000007 00000000 3C069D00 3C04BF80 1500FFF7 02601021 1000FFCE 26030003
8C625A10 30420080 1040FFFD 3C02BF80 8C425A10 30420020 14400006 3C02BF80
8C435A20 8C435A10 30630020 1060FFFC 00000000 3C10BF80 AE005A00 24030040
3C02BF80 AC435A14 3C029D00 8C430090 8C42001C 8064002D 0040F809 24050006
AE005A00 AE165A30 AE175A40 AE1E5A00 8FBF003C 8FBE0038 8FB70034 8FB60030
8FB5002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0040
'getFPC
27BDFFF8 AFBF0004 00852023 03E42021 ACC40000 8FBF0004 03E00008 27BD0008
'pstring
27BDFFE0 AFBF001C AFB00018 00808021 00002021 3C059D00 24A51058 27A60010
0411FFEF 00000000 8FA40010 3C029D00 8C42002C 0040F809 02042021 8FBF001C
8FB00018 03E00008 27BD0020
'main
27BDFFC8 AFBF0034 AFB40030 AFB3002C AFB20028 AFB10024 AFB00020 00808821
00A08021 00C09021 00E09821 00002021 3C059D00 24A510C0 27A60018 0411FFD5
00000000 3C029D00 8C430090 8E040000 A064002E 8C430090 8E240000 A064002C
8C430090 8E440000 A064002D 8C430090 92640000 24840002 A0640015 8C420090
80430015 28640004 5480000A 24030014 3C059D00 2463FFFC A0430015 8CA20090
80430015 28640004 1080FFFB 2463FFFC 24030014 A0430014 3C109D00 8E030090
8E020010 8064002E 24050008 0040F809 00003021 8E030090 8E020010 8064002E
24050065 0040F809 00003021 8E030090 8E02001C 8064002E 0040F809 24050006
8E030090 8E020010 8064002C 24050008 0040F809 00003021 8E030090 8E020010
8064002C 24050065 0040F809 00003021 8E030090 8E02001C 8064002C 0040F809
24050006 8E030090 8E020010 8064002D 24050008 0040F809 00003021 8E030090
8E020010 8064002D 24050065 0040F809 00003021 8E030090 8E02001C 8064002D
0040F809 24050006 3C02BF81 8C43F220 7C63D800 3C020580 3442B053 00621826
24020030 24040014 0083100B 00401821 3C029D00 8C420088 00621821 8C640000
24030064 54830007 00008821 3C03BF80 8C715A30 8C725A00 8C745A40 10000003
3C03BF81 00009021 3C03BF81 8C64F220 7C84D800 3C030580 3463B053 00831826
24040030 24050014 00A3200B 00821021 8C430000 24020065 1062006F 3C029D00
8C420010 3C03BF81 8C65F220 7CA5D800 3C030580 3463B053 00A32826 2403000C
24040005 0065200A 24050008 0040F809 00003021 3C029D00 8C420010 3C03BF81
8C65F220 7CA5D800 3C030580 3463B053 00A32826 2403000C 24040005 0065200A
24050065 0040F809 00003021 3C029D00 8C420010 3C03BF81 8C65F220 7CA5D800
3C030580 3463B053 00A32826 2403000B 2404002F 0065200A 24050002 0040F809
00003021 3C029D00 8C420010 3C03BF81 8C65F220 7CA5D800 3C030580 3463B053
00A32826 2403000B 2404002F 0065200A 24050065 0040F809 00003021 3C029D00
8C420010 3C03BF81 8C65F220 7CA5D800 3C030580 3463B053 00A32826 2403000A
24040004 0065200A 24050008 0040F809 00003021 3C029D00 8C420010 3C03BF81
8C65F220 7CA5D800 3C030580 3463B053 00A32826 2403000A 24040004 0065200A
24050065 0040F809 00003021 3C02BF81 8C43F220 7C63D800 3C020580 3442B053
1462000C 3C02BF81 8C43FA90 24040001 7C831804 AC43FA90 3C02BF81 8C43FCA0
24040006 7C831804 AC43FCA0 1000000B 3C02BF80 8C43FA90 24040007 7C831804
AC43FA90 3C02BF81 8C43FC9C 24040006 7C831804 AC43FC9C 3C02BF80 34038060
AC435A00 24030003 AC435A30 24030C00 AC435A40 16200005 3C109D00 8C515A30
8C525A00 8C545A40 3C109D00 8E030090 8E02001C 8064002E 0040F809 24050006
8E020004 0040F809 24042710 8E030090 8E02001C 8064002E 0040F809 24050005
8E020004 0040F809 24042710 8E030090 8E02001C 8064002E 0040F809 24050006
240400E0 0411FAEA 00000000 00002021 0411FAC4 00000000 24040003 0411FAC1
00000000 24040009 0411FABE 00000000 24040008 0411FABB 00000000 24040016
0411FAB8 00000000 2404000A 0411FAB5 00000000 2404003F 0411FAB2 00000000
24040078 0411FAAF 00000000 2404004C 0411FAAC 00000000 24040009 0411FAA9
00000000 2404000A 0411FAA6 00000000 24040008 0411FAA3 00000000 24040016
0411FAA0 00000000 2404001A 0411FA9D 00000000 2404000F 0411FA9A 00000000
240400E1 0411FABA 00000000 00002021 0411FA94 00000000 24040016 0411FA91
00000000 24040019 0411FA8E 00000000 24040003 0411FA8B 00000000 2404000F
0411FA88 00000000 24040005 0411FA85 00000000 24040032 0411FA82 00000000
24040045 0411FA7F 00000000 24040046 0411FA7C 00000000 24040004 0411FA79
00000000 2404000E 0411FA76 00000000 2404000D 0411FA73 00000000 24040035
0411FA70 00000000 24040037 0411FA6D 00000000 2404000F 0411FA6A 00000000
240400C0 0411FA8A 00000000 24040017 0411FA64 00000000 24040015 0411FA61
00000000 240400C1 0411FA81 00000000 24040041 0411FA5B 00000000 240400C5
0411FA7B 00000000 00002021 0411FA55 00000000 24040012 0411FA52 00000000
24040080 0411FA4F 00000000 24040036 0411FA6F 00000000 24040048 0411FA49
00000000 2404003A 0411FA69 00000000 24040066 0411FA43 00000000 240400B0
0411FA63 00000000 00002021 0411FA3D 00000000 240400B1 0411FA5D 00000000
240400A0 0411FA37 00000000 240400B4 0411FA57 00000000 24040002 0411FA31
00000000 240400B6 0411FA51 00000000 24040002 0411FA2B 00000000 24040002
0411FA28 00000000 2404003B 0411FA25 00000000 240400B7 0411FA45 00000000
240400C6 0411FA1F 00000000 240400F7 0411FA3F 00000000 240400A9 0411FA19
00000000 24040051 0411FA16 00000000 2404002C 0411FA13 00000000 24040082
0411FA10 00000000 24040011 0411FA30 00000000 8E020004 3C040001 0040F809
3484D4C0 24040029 0411FA29 00000000 8E020004 0040F809 240461A8 8E020090
80500015 2610FFFF 24040036 0411FA20 00000000 24020001 1202000D 2A020002
10400005 24020002 12000014 24040028 10000030 00000000 12020024 24020003
1602002C 24040088 10000016 00000000 24040048 0411F9EB 00000000 3C029D00
8C430094 24040140 AC640000 8C420098 240301E0 1000001F AC430000 0411F9E1
00000000 3C029D00 8C430094 240401E0 AC640000 8C420098 24030140 10000015
AC430000 0411F9D7 00000000 3C029D00 8C430094 24040140 AC640000 8C420098
240301E0 1000000B AC430000 240400E8 0411F9CC 00000000 3C029D00 8C430094
240401E0 AC640000 8C420098 24030140 AC430000 8FA50018 3C029D00 8C430048
3C049D00 248408D4 00852021 AC640000 8FA50018 8C43004C 3C049D00 24840404
00852021 AC640000 8FA50018 8C4300DC 3C049D00 24840D50 00852021 AC640000
8FA50018 8C4300E0 3C049D00 24840B4C 00852021 AC640000 8C430048 8C440094
8C860000 8C420098 8C470000 AFA00010 8C620000 00002021 00002821 24C6FFFF
0040F809 24E7FFFF 3C02BF80 AC515A30 AC525A00 AC545A40 3C049D00 248419C4
0411FDA4 00000000 8FBF0034 8FB40030 8FB3002C 8FB20028 8FB10024 8FB00020
03E00008 27BD0038
'.rodata
'startup
39494C49 20383834 76697264 6C207265 6564616F 000A0D64
End CSub


Source code
/*******************************************************************************
*
* Driver for ILI9488 Display driver written as CSUB
*
* (c) Peter Mather 2019 with acknowledgements to Peter Carnegie & Geoff Graham
*
*
* This CFunction MUST be compiled with Optimization Level 1, -O1
* -O2,-O3,-Os will compile successfully, but generate exceptions at runtime.
*
* When Generating the CSUB, use MERGE CSUB mode, and name the CSUB
* ILI9488
*
* Entry point is function void main(
* long long *DC,
* long long *RST,
* long long *CS
* long long *orientation)
*
* V1.0 2019-05-27 Peter Mather
*
******************************************************************************/
#include <stdarg.h>

#define Version 100 //Version 1.00
#define _SUPPRESS_PLIB_WARNING // required for XC1.33 Later compiler versions will need PLIB to be installed
#include <plib.h> // the pre Harmony peripheral libraries


#include "../cfunctions.h"
// Change the width and height if required (defined in portrait mode)
// or use the constructor to over-ride defaults
#define TFT_WIDTH 320
#define TFT_HEIGHT 480


// Delay between some initialisation commands
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked


// Generic commands used by TFT_eSPI.cpp
#define TFT_NOP 0x00
#define TFT_SWRST 0x01

#define TFT_SLPIN 0x10
#define TFT_SLPOUT 0x11

#define TFT_INVOFF 0x20
#define TFT_INVON 0x21

#define TFT_DISPOFF 0x28
#define TFT_DISPON 0x29

#define TFT_CASET 0x2A
#define TFT_RASET 0x2B
#define TFT_RAMWR 0x2C

#define TFT_RAMRD 0x2E

#define TFT_MADCTL 0x36

#define TFT_MAD_MY 0x80
#define TFT_MAD_MX 0x40
#define TFT_MAD_MV 0x20
#define TFT_MAD_ML 0x10
#define TFT_MAD_RGB 0x00
#define TFT_MAD_BGR 0x08
#define TFT_MAD_MH 0x04
#define TFT_MAD_SS 0x02
#define TFT_MAD_GS 0x01

#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read

#define LANDSCAPE 1
#define PORTRAIT 2
#define RLANDSCAPE 3
#define RPORTRAIT 4
#define MX170
#if defined(MX170)
// SPI pin numbers and registers
#define SPI_INP_PIN (HAS_44PINS ? 41 : 14)
#define SPI_OUT_PIN (HAS_44PINS ? 20 : 3)
#define SPI_CLK_PIN (HAS_44PINS ? 14 : 25)
#define SPI_PPS_OPEN PPSInput(2, SDI1, RPB5); PPSOutput(2, RPA1, SDO1)
#define SPI_PPS_CLOSE PPSOutput(2, RPA1, NULL)
#define SPICON *(volatile unsigned int *)(0xbf805800) //SPI status register
#define SPISTAT *(volatile unsigned int *)(0xbf805810) //SPI status register
#define SPIBUF *(volatile unsigned int *)(0xbf805820) //SPI output buffer
#define SPIBRG *(volatile unsigned int *)(0xbf805830) //SPI output buffer
#define SPICON2 *(volatile unsigned int *)(0xbf805840) //SPI status register
#define SPISTATCLR *(volatile unsigned int *)(0xbf805814) //SPI status clear register
#define ILImode 0x18520
#define ILIbrg 0
#elif defined(MX470)
// SPI pin numbers and registers
#define SPI_INP_PIN (HAS_100PINS ? 11 : 47)
#define SPI_OUT_PIN (HAS_100PINS ? 12 : 5)
#define SPI_CLK_PIN (HAS_100PINS ? 10 : 4)
#define SPI_PPS_OPEN { if(HAS_100PINS) {PPSInput(2, SDI2, RPG7); PPSOutput(1, RPG8, SDO2); } else {PPSInput(2, SDI2, RPC13); PPSOutput(2, RPG7, SDO2);}}
#define SPI_PPS_CLOSE { if(HAS_100PINS) PPSOutput(1, RPG8, NULL); else PPSOutput(2, RPG7, NULL); }
#define SPICON *(volatile unsigned int *)(0xbf805A00) //SPI status register
#define SPISTAT *(volatile unsigned int *)(0xbf805A10) //SPI status register
#define SPIBUF *(volatile unsigned int *)(0xbf805A20) //SPI output buffer
#define SPIBRG *(volatile unsigned int *)(0xbf805A30) //SPI output buffer
#define SPICON2 *(volatile unsigned int *)(0xbf805A40) //SPI status register
#define SPISTATCLR *(volatile unsigned int *)(0xbf805A14) //SPI status clear register
#endif
#define SPIsend(a) {int j;SPIBUF=a; while((SPISTAT & 0x80)==0); j=SPIBUF;}
#define SPIqueue(a) {while(SPISTAT & 0x02){};SPIBUF=a;}
int ReadRectangle(int x1, int y1, int x2, int y2, int pos, char *p );

#define SPIsend(a) {int j;SPIBUF=a; while((SPISTAT & 0x80)==0); j=SPIBUF;}
// set the chip select for the SPI to low (enabled)
// if the SPI is currently set to a different mode or baudrate this will change it accordingly
// also, it checks if the chip select pin needs to be changed
// set the chip select for SPI1 to high (disabled)
void spi_write_data(unsigned char data){
PinSetBit(Option->LCD_CD, LATSET);
PinSetBit(Option->LCD_CS, LATCLR);
SPIsend(data);
PinSetBit(Option->LCD_CS, LATSET);
}
void spi_write_command(unsigned char data){
PinSetBit(Option->LCD_CD, LATCLR);
PinSetBit(Option->LCD_CS, LATCLR);
SPIsend(data);
PinSetBit(Option->LCD_CS, LATSET);
}
void spi_write_cd(unsigned char command, int data, ...){
int i;
va_list ap;
va_start(ap, data);
spi_write_command(command);
for(i = 0; i < data; i++) spi_write_data((char)va_arg(ap, int));
va_end(ap);
}

void DefineRegion(int xstart, int ystart, int xend, int yend, int rw) {
PinSetBit(Option->LCD_CD, LATCLR);
PinSetBit(Option->LCD_CS, LATCLR);
SPIsend(TFT_CASET);
PinSetBit(Option->LCD_CD, LATSET);
SPIsend(xstart >> 8);
SPIsend(xstart);
SPIsend(xend >> 8);
SPIsend(xend);
PinSetBit(Option->LCD_CD, LATCLR);
SPIsend(TFT_RASET);
PinSetBit(Option->LCD_CD, LATSET);
SPIsend(ystart >> 8);
SPIsend(ystart);
SPIsend(yend >> 8);
SPIsend(yend);
PinSetBit(Option->LCD_CD, LATCLR);
if(rw){
SPIsend(TFT_RAMWR);
} else {
SPIsend(TFT_RAMRD);
}
PinSetBit(Option->LCD_CS, LATSET);
}


//Print the bitmap of a char on the video output
// x, y - the top left of the char
// width, height - size of the char's bitmap
// scale - how much to scale the bitmap
// fc, bc - foreground and background colour
// bitmap - pointer to the bitmap
void DrawBitmapSPI(int x1, int y1, int width, int height, int scale, int fc, int bc, unsigned char *bitmap){
int i, j, k, m, n;
unsigned char fhb, fmb, flb, bhb, bmb, blb;
unsigned int consave=0,brgsave=0,con2save;
int vertCoord, horizCoord, XStart, XEnd, YEnd;
if(x1>=HRes || y1>=VRes || x1+width*scale<0 || y1+height*scale<0)return;

// adjust when part of the bitmap is outside the displayable coordinates
vertCoord = y1; if(y1 < 0) y1 = 0; // the y coord is above the top of the screen
XStart = x1; if(XStart < 0) XStart = 0; // the x coord is to the left of the left marginn
XEnd = x1 + (width * scale) - 1; if(XEnd >= HRes) XEnd = HRes - 1; // the width of the bitmap will extend beyond the right margin
YEnd = y1 + (height * scale) - 1; if(YEnd >= VRes) YEnd = VRes - 1;// the height of the bitmap will extend beyond the bottom margin
brgsave=SPIBRG; //save any user SPI setup
consave=SPICON;
con2save=SPICON2;
SPICON=0x0;
SPICON=0x018260;
#ifdef MX470
char *p=0;
SPIBRG=0;
if(bc == -1) { //special case of overlay text
i = 0;
j = width * height * scale * scale * 3;
p = GetMemory(j); //allocate some temporary memory
ReadBuffer(XStart, y1, XEnd, YEnd, p);
}
#else
SPIBRG=0;
#endif
SPICON2=0xC00;
// convert the colours to 565 format
fhb = (fc >> 16) & 0b11111111;
fmb = (fc >> 8) & 0b11111111;
flb = fc & 0xFF;
bhb = (bc >> 16) & 0b11111111;
bmb = (bc >> 8) & 0b11111111;
blb = bc & 0xFF;
n=0;

DefineRegion(x1, y1, x1 + (width * scale) - 1, y1 + (height * scale) -1,1);
PinSetBit(Option->LCD_CD, LATSET); //set CD high
PinSetBit(Option->LCD_CS, LATCLR);
for(i = 0; i < height; i++) { // step thru the font scan line by line
for(j = 0; j < scale; j++) { // repeat lines to scale the font
if(vertCoord++ < 0) continue; // we are above the top of the screen
if(vertCoord > VRes) return; // we have extended beyond the bottom of the screen
horizCoord = x1;
for(k = 0; k < width; k++) { // step through each bit in a scan line
for(m = 0; m < scale; m++) { // repeat pixels to scale in the x axis
if(horizCoord++ < 0) continue; // we have not reached the left margin
if(horizCoord > HRes) continue; // we are beyond the right margin
if((bitmap[((i * width) + k)/8] >> (((height * width) - ((i * width) + k) - 1) %8)) & 1) {
SPIqueue(fhb);
SPIqueue(fmb);
SPIqueue(flb);
n+=3;
} else {
#ifdef MX470
if(bc==-1){
SPIqueue(p[n+2]);
SPIqueue(p[n+1]);
SPIqueue(p[n]);
n+=3;
} else {
SPIqueue(bhb);
SPIqueue(bmb);
SPIqueue(blb);
}
#else
SPIqueue(bhb);
SPIqueue(bmb);
SPIqueue(blb);
#endif
}
}
}
}
}
while((SPISTAT & 0x80)==0); //wait for all writes to complete
while(!(SPISTAT & 0x20)){i=SPIBUF;} // clean up rx fifo if not empty
SPICON=0;
#ifdef MX470
SPI2STATCLR=0x40;
#else
SPI1STATCLR=0x40;
#endif

PinSetBit(Option->LCD_CS, LATSET);
SPICON=0x0;
SPIBRG=brgsave; //restore user (or my) setup
SPICON2=con2save;
SPICON=consave;
}
// Draw a rectangle
// this is the basic drawing primitive used by most drawing routines
// x1, y1, x2, y2 - the coordinates
// c - the colour
void DrawRectangleSPI(int x1, int y1, int x2, int y2, int c){
unsigned int consave=0,brgsave=0,con2save;
int i, t;
unsigned char hb, mb, lb;
brgsave=SPIBRG; //save any user SPI setup
consave=SPICON;
con2save=SPICON2;
SPICON=0x0;
SPICON=0x018260;
#ifdef MX470
SPIBRG=0;
#else
SPIBRG=0;
#endif
SPICON2=0xC00;
// make sure the coordinates are kept within the display area
if(x2 <= x1) { t = x1; x1 = x2; x2 = t; }
if(y2 <= y1) { t = y1; y1 = y2; y2 = t; }
if(x1 < 0) x1 = 0; if(x1 >= HRes) x1 = HRes - 1;
if(x2 < 0) x2 = 0; if(x2 >= HRes) x2 = HRes - 1;
if(y1 < 0) y1 = 0; if(y1 >= VRes) y1 = VRes - 1;
if(y2 < 0) y2 = 0; if(y2 >= VRes) y2 = VRes - 1;

// convert the colours to 565 format
hb = ((c >> 16) & 0b11111111);
mb = ((c >> 8) & 0b11111111);
lb = c & 0b11111111;

DefineRegion(x1, y1, x2, y2,1);
PinSetBit(Option->LCD_CD, LATSET); //set CD high
PinSetBit(Option->LCD_CS, LATCLR);
i = x2 - x1 + 1;
i *= (y2 - y1 + 1);
while(i--){
SPIqueue(hb);
SPIqueue(mb);
SPIqueue(lb);
}
while((SPISTAT & 0x80)==0); //wait for all writes to complete
while(!(SPISTAT & 0x20)){i=SPIBUF;} // clean up rx fifo if not empty
SPICON=0;
#ifdef MX470
SPI2STATCLR=0x40;
#else
SPI1STATCLR=0x40;
#endif

PinSetBit(Option->LCD_CS, LATSET);
SPICON=0x0;
SPIBRG=brgsave; //restore user (or my) setup
SPICON2=con2save;
SPICON=consave;
}
#ifdef MX470
void ReadBufferSPI(int x1, int y1, int x2, int y2, char* p) {
unsigned int consave=0,brgsave=0,con2save;
int r, N, t;
// make sure the coordinates are kept within the display area
if(x2 <= x1) { t = x1; x1 = x2; x2 = t; }
if(y2 <= y1) { t = y1; y1 = y2; y2 = t; }
if(x1 < 0) x1 = 0; if(x1 >= HRes) x1 = HRes - 1;
if(x2 < 0) x2 = 0; if(x2 >= HRes) x2 = HRes - 1;
if(y1 < 0) y1 = 0; if(y1 >= VRes) y1 = VRes - 1;
if(y2 < 0) y2 = 0; if(y2 >= VRes) y2 = VRes - 1;
N=(x2- x1+1) * (y2- y1+1);
brgsave=SPIBRG; //save any user SPI setup
consave=SPICON;
con2save=SPICON2;
SPICON=0x0;
SPICON=0x018260;
#ifdef MX470
SPIBRG=1;
#else
SPIBRG=0;
#endif
DefineRegion(x1, y1, x2, y2, 0);
PinSetBit(Option->LCD_CS, LATCLR);
SPIsend(0); //dummy read
while(!(SPISTAT & 0x20)){r=SPIBUF;} // clean up rx fifo if not empty
r=0;
while(N--) {
SPIBUF = 0;
SPIBUF = 0;
SPIBUF = 0; // set up three reads
while((SPISTAT & 0x80)==0);
p[r+2] = SPIBUF;
p[r+1] = SPIBUF;
p[r] = SPIBUF;
r+=3;
}

PinSetBit(Option->LCD_CD, LATCLR);
PinSetBit(Option->LCD_CS, LATSET);
// revert to non enhanced SPI mode
SPICON=0x0;
SPIBRG=brgsave; //restore user (or my) setup
SPICON2=con2save;
SPICON=consave;
}

void DrawBufferSPI(int x1, int y1, int x2, int y2, char* p) {
unsigned int i, consave=0,brgsave=0,con2save;
brgsave=SPIBRG; //save any user SPI setup
consave=SPICON;
con2save=SPICON2;
SPICON=0x0;
SPICON=0x018260;
#ifdef MX470
SPIBRG=0;
#else
SPIBRG=0;
#endif
SPICON2=0xC00;
union colourmap
{
char rgbbytes[4];
unsigned int rgb;
} c;
int xx1=x1, yy1=y1, xx2=x2, yy2=y2, x, y, t ;
// make sure the coordinates are kept within the display area
if(x2 <= x1) { t = x1; x1 = x2; x2 = t; }
if(y2 <= y1) { t = y1; y1 = y2; y2 = t; }
if(x1 < 0) xx1 = 0; if(x1 >= HRes) xx1 = HRes - 1;
if(x2 < 0) xx2 = 0; if(x2 >= HRes) xx2 = HRes - 1;
if(y1 < 0) yy1 = 0; if(y1 >= VRes) yy1 = VRes - 1;
if(y2 < 0) yy2 = 0; if(y2 >= VRes) yy2 = VRes - 1;


DefineRegion(xx1, yy1, xx2, yy2,1);
PinSetBit(Option->LCD_CD, LATSET); //set CD high
PinSetBit(Option->LCD_CS, LATCLR);


for(y=y1;y<=y2;y++){
for(x=x1;x<=x2;x++){
if(x>=0 && x<HRes && y>=0 && y<VRes){
c.rgbbytes[0]=*p++; //this order swaps the bytes to match the .BMP file
c.rgbbytes[1]=*p++;
c.rgbbytes[2]=*p++;
// convert the colours to 565 format
SPIqueue(c.rgbbytes[2]);
SPIqueue(c.rgbbytes[1]);
SPIqueue(c.rgbbytes[0]);
} else p+=3;
}
}

while((SPISTAT & 0x80)==0); //wait for all writes to complete
while(!(SPISTAT & 0x20)){i=SPIBUF;} // clean up rx fifo if not empty
SPICON=0;
#ifdef MX470
SPI2STATCLR=0x40;
#else
SPI1STATCLR=0x40;
#endif

PinSetBit(Option->LCD_CS, LATSET);
SPICON=0x0;
SPIBRG=brgsave; //restore user (or my) setup
SPICON2=con2save;
SPICON=consave;
}
#endif

__attribute__((noinline)) void getFPC(void *a, void *b, volatile unsigned int *c)
{
*c = (unsigned int) (__builtin_return_address (0) - (b -a)) ;
}
void pstring(const char *s){
volatile unsigned int libAddr ;
getFPC(NULL,&&getFPCLab,&libAddr) ; // warning can be ignored, stupid editor
getFPCLab: { }
unsigned char * testData = (unsigned char *)((void *)s + libAddr );
MMPrintString(testData);
}

/*******************************************************************************
*
* ILI9488 : Initialise the CFunction Driver Sub-System
*
* Function called to initialise the driver SubSystem
*
* ILI9488 should be called from MM.STARTUP
* On exit, vectors DrawRectangleVector, and DrawBitmapVector will
* be set to point to the CFunctions DrawRectangleSPI and
* DrawBitmapSPI respectively
*
* Entry point is function long long main(
* long long *DC,
* long long *RST,
* long long *CS
* long long *orientation)
* long long *size)
*
******************************************************************************/
void main(long long *CD, long long *RST, long long *CS,long long *orientation){
volatile unsigned int libAddr ;
getFPC(NULL,&&getFPCLab,&libAddr) ; // warning can be ignored, stupid editor
getFPCLab: { }
unsigned int consave=0,brgsave=0,con2save;
Option->LCD_Reset=*RST;
Option->LCD_CD=*CD;
Option->LCD_CS=*CS;
Option->DISPLAY_ORIENTATION=*orientation + 2;
while(Option->DISPLAY_ORIENTATION>3)Option->DISPLAY_ORIENTATION-=4;
Option->DISPLAY_TYPE=20;

ExtCfg(Option->LCD_Reset,EXT_DIG_OUT,0);ExtCfg(Option->LCD_Reset,EXT_BOOT_RESERVED,0);
PinSetBit(Option->LCD_Reset, LATSET);
ExtCfg(Option->LCD_CD,EXT_DIG_OUT,0);ExtCfg(Option->LCD_CD,EXT_BOOT_RESERVED,0);
PinSetBit(Option->LCD_CD, LATSET);
ExtCfg(Option->LCD_CS,EXT_DIG_OUT,0);ExtCfg(Option->LCD_CS,EXT_BOOT_RESERVED,0);
PinSetBit(Option->LCD_CS, LATSET);
if(ExtCurrentConfig[SPI_OUT_PIN] == EXT_RESERVED) { //already open
brgsave=SPIBRG;
consave=SPICON;
con2save=SPICON2;
}
if(ExtCurrentConfig[SPI_OUT_PIN]!=EXT_BOOT_RESERVED){
ExtCfg(SPI_OUT_PIN, EXT_DIG_OUT, 0); ExtCfg(SPI_OUT_PIN, EXT_BOOT_RESERVED, 0);
ExtCfg(SPI_INP_PIN, EXT_DIG_IN, 0); ExtCfg(SPI_INP_PIN, EXT_BOOT_RESERVED, 0);
ExtCfg(SPI_CLK_PIN, EXT_DIG_OUT, 0); ExtCfg(SPI_CLK_PIN, EXT_BOOT_RESERVED, 0);
SPI_PPS_OPEN;
}
SPICON=0x8060;
SPIBRG=3;
SPICON2=0xC00;// this is defined in IOPorts.h
if(!brgsave){ //save my settings
brgsave=SPIBRG;
consave=SPICON;
con2save=SPICON2;
}


//Reset the ILI9488
PinSetBit(Option->LCD_Reset,LATSET);
uSec(10000);
PinSetBit(Option->LCD_Reset,LATCLR);
uSec(10000);
PinSetBit(Option->LCD_Reset,LATSET);
spi_write_command(0xE0); // Positive Gamma Control
spi_write_data(0x00);
spi_write_data(0x03);
spi_write_data(0x09);
spi_write_data(0x08);
spi_write_data(0x16);
spi_write_data(0x0A);
spi_write_data(0x3F);
spi_write_data(0x78);
spi_write_data(0x4C);
spi_write_data(0x09);
spi_write_data(0x0A);
spi_write_data(0x08);
spi_write_data(0x16);
spi_write_data(0x1A);
spi_write_data(0x0F);

spi_write_command(0XE1); // Negative Gamma Control
spi_write_data(0x00);
spi_write_data(0x16);
spi_write_data(0x19);
spi_write_data(0x03);
spi_write_data(0x0F);
spi_write_data(0x05);
spi_write_data(0x32);
spi_write_data(0x45);
spi_write_data(0x46);
spi_write_data(0x04);
spi_write_data(0x0E);
spi_write_data(0x0D);
spi_write_data(0x35);
spi_write_data(0x37);
spi_write_data(0x0F);

spi_write_command(0XC0); // Power Control 1
spi_write_data(0x17);
spi_write_data(0x15);

spi_write_command(0xC1); // Power Control 2
spi_write_data(0x41);

spi_write_command(0xC5); // VCOM Control
spi_write_data(0x00);
spi_write_data(0x12);
spi_write_data(0x80);

spi_write_command(TFT_MADCTL); // Memory Access Control
spi_write_data(0x48); // MX, BGR

spi_write_command(0x3A); // Pixel Interface Format
#if defined (ESP32_PARALLEL)
spi_write_data(0x55); // 16 bit colour for parallel
#else
spi_write_data(0x66); // 18 bit colour for SPI
#endif

spi_write_command(0xB0); // Interface Mode Control
spi_write_data(0x00);

spi_write_command(0xB1); // Frame Rate Control
spi_write_data(0xA0);

spi_write_command(0xB4); // Display Inversion Control
spi_write_data(0x02);

spi_write_command(0xB6); // Display Function Control
spi_write_data(0x02);
spi_write_data(0x02);
spi_write_data(0x3B);

spi_write_command(0xB7); // Entry Mode Set
spi_write_data(0xC6);

spi_write_command(0xF7); // Adjust Control 3
spi_write_data(0xA9);
spi_write_data(0x51);
spi_write_data(0x2C);
spi_write_data(0x82);

spi_write_command(TFT_SLPOUT); //Exit Sleep
uSec(120000);

spi_write_command(TFT_DISPON); //Display on
uSec(25000);

// End of ILI9488 display configuration
int rotation =Option->DISPLAY_ORIENTATION-1;
spi_write_command(TFT_MADCTL);
switch (rotation) {
case 1: // Portrait
spi_write_data(TFT_MAD_MX | TFT_MAD_BGR);
HRes = TFT_WIDTH;
VRes = TFT_HEIGHT;
break;
case 0: // Landscape (Portrait + 90)
spi_write_data(TFT_MAD_MV | TFT_MAD_BGR);
HRes = TFT_HEIGHT;
VRes = TFT_WIDTH;
break;
case 3: // Inverter portrait
spi_write_data(TFT_MAD_MY | TFT_MAD_BGR);
HRes = TFT_WIDTH;
VRes = TFT_HEIGHT;
break;
case 2: // Inverted landscape
spi_write_data(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR);
HRes = TFT_HEIGHT;
VRes = TFT_WIDTH;
break;
}

//Set the DrawRectangle vector to point to our function
DrawRectangleVector= (unsigned int)&DrawRectangleSPI + libAddr;

//Set the DrawBitmap vector to point to our function
DrawBitmapVector=(unsigned int)&DrawBitmapSPI + libAddr;

#ifdef MX470
DrawBufferVector=(unsigned int)&DrawBufferSPI + libAddr;
ReadBufferVector=(unsigned int)&ReadBufferSPI + libAddr;
#endif
//CLS
DrawRectangle(0,0,HRes-1,VRes-1,0x000000);
SPIBRG=brgsave; //restore user (or my) setup
SPICON=consave;
SPICON2=con2save;
static const char startup[]="ILI9488 driver loaded\r\n";
pstring(startup);
}


Edited by matherp 2019-05-28
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 05:19pm 27 May 2019
Copy link to clipboard 
Print this post

Thank peter (ps: see your PM)
I mount dyi for test this ...after...night
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1321
Posted: 08:22am 28 May 2019
Copy link to clipboard 
Print this post

Thanks from me too for this one Peter. The 320 will fit a project I've got a lot better than the 272. Just gotta wait for the slowboat now!

Greg
 
damos
Regular Member

Joined: 15/04/2016
Location: Australia
Posts: 54
Posted: 11:00pm 19 Mar 2021
Copy link to clipboard 
Print this post

I recently renewed my SC subscription and thought I would also get some Micromite backpack v3 PCBs and a 3.5" LCD panel.

I assembled everything and the console worked perfectly, but when I plugged in the panel, the backlight came on but the console was frozen. When I removed the panel the console worked and said the driver was loaded.

Given Peter's comments I checked the PCB wiring and noticed that pin 9 on the LCD panel isn't even connected. I tried a 2.8" panel and it worked perfectly.

So I used extenders to connect just pins 1-8. The LCD worked perfectly. I then added extenders one by one expecting it to eventually no longer start. Eventually I had all the wires connected and the LCD and touch both worked perfectly. I removed the extenders and plugged the panel straight into the backpack. It is clear the the backlight is working as the panel is initializing when the screen clears, but the console doesn't work.

It is pretty weird, as it almost as if the extra resistance of the extenders is allowing it to work. I put it away as I am happy to use it with extenders if required, but I will appreciate it if anyone has any ideas.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 12:29am 20 Mar 2021
Copy link to clipboard 
Print this post

I probably can't help but more information would be helpful.

Which driver are you using? Peter's or SC's? Did you follow the setup procedure from the article and set the screen parameters to suit the board as per the article?

SC does mention the problem with the MISO pin.

Bill
Keep safe. Live long and prosper.
 
morgs67
Regular Member

Joined: 10/07/2019
Location: Australia
Posts: 63
Posted: 04:58am 21 Mar 2021
Copy link to clipboard 
Print this post

  Turbo46 said  

SC does mention the problem with the MISO pin.

Bill


Found this in an arduino article for using  multiple devices on an SPI bus.

"// WARNING: Do not connect ILI9488 display SDO to MISO if other devices share the SPI bus (TFT SDO does NOT tristate when CS is high) "

Tony
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 06:08am 21 Mar 2021
Copy link to clipboard 
Print this post

  Quote  TFT SDO does NOT tristate when CS is high

Yes, this is more or less what SC said in their May article when they were first testing the display and also why Peter's 680 ohm resistor is a solution. SC just left it disconnected on the V3 backpack board.

Bill
Keep safe. Live long and prosper.
 
damos
Regular Member

Joined: 15/04/2016
Location: Australia
Posts: 54
Posted: 03:08am 22 Mar 2021
Copy link to clipboard 
Print this post

Thanks. The driver I am using is the latest version of the Micromite firmware.

I tried everything in the article, and I did note the the MISO pin is not connected on the PCB. I was going to use Peter's trick and realized the pin is not even connected.

It is just weird that it works through the extension cable, but not when plugged in directly. It is identical wiring either way, possibly an ohm's resistance on each wire between the backpack and the LCD display.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5867
Posted: 03:37am 22 Mar 2021
Copy link to clipboard 
Print this post

  damos said  It is just weird that it works through the extension cable, but not when plugged in directly.

The extension cable might be adding enough capacitance to make the difference.
I would consider capacitance over resistance in this instance.

Which pins want the extra capacitance might be difficult to determine.

Jim
VK7JH
MMedit   MMBasic Help
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 04:15am 22 Mar 2021
Copy link to clipboard 
Print this post

You could connect a 10k resistor from pin 5 on the 1455 to +5v. That has known to be a problem. Maybe the proximity of the display when plugged in is affecting Rx to the micromite by injecting noise while the signal is initially open circuit. Jim's capacitance suggestion just woke up one of my brain cells.

Bill
Keep safe. Live long and prosper.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 01:11am 07 Apr 2021
Copy link to clipboard 
Print this post

@Damos, Did you ever get your screen working when plugged directly onto the board?

Bill
Keep safe. Live long and prosper.
 
damos
Regular Member

Joined: 15/04/2016
Location: Australia
Posts: 54
Posted: 01:52am 08 Apr 2021
Copy link to clipboard 
Print this post

I haven't tried. Got carried away on my K9 (as in Dr Who) project, which is now finished and am now working on the TSynth project. I am actually OK with running it through a cable and don't have an immediate need for this display as I have plenty of 2.8" displays and was saving this for something special.

After today's post (see TSynth topic), anything that is larger than 2.8" I will probably use HTML. The capabilities on CSS are astounding and there is pretty much nothing you can do in native code that CSS can't do in a couple of lines.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 02:29am 08 Apr 2021
Copy link to clipboard 
Print this post

OK, Thanks damos.
Keep safe. Live long and prosper.
 
David_Plumley
Newbie

Joined: 03/01/2022
Location: New Caledonia
Posts: 8
Posted: 04:52am 05 Jan 2022
Copy link to clipboard 
Print this post

Hi!

I'm trying to run Peter's driver on an ILI9488 display plugged into an MM+ 64-pin backpack board.

SC's programs run OK; I've removed the MOSI pin... But I can't get Peter's driver to work.

Can I expect Peter's driver to work on my set-up, please?

And if it does, can I expect the GUI graphic controls to work OK too?

Thank you.

David.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 09:53am 05 Jan 2022
Copy link to clipboard 
Print this post

Sorry, I can't help but assuming you are using the correct MM+ driver it should work and I would expect the GUI controls to work also. I hope someone can verify that for you.

Bill
Keep safe. Live long and prosper.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 10:01am 05 Jan 2022
Copy link to clipboard 
Print this post

  Quote  I've removed the MOSI pin


I hope that is a typo. The MISO pin is the one to remove (Master in (the uP), Slave out)
Edited 2022-01-05 20:01 by matherp
 
David_Plumley
Newbie

Joined: 03/01/2022
Location: New Caledonia
Posts: 8
Posted: 09:40pm 05 Jan 2022
Copy link to clipboard 
Print this post

You're right, Peter, it is a typo. I have removed the MISO pin (the screen doesn't need to talk to the uP) and my setup works with SC's software. I would much appreciate your answer to my two questions, please. Thank you.

David.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 10:39pm 05 Jan 2022
Copy link to clipboard 
Print this post

Just tested and the MM+ version posted above woks perfectly on MM+ V5.05.05 and as long as MISO is disconnected touch will work and therefore GUI controls
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1584
Posted: 10:59pm 05 Jan 2022
Copy link to clipboard 
Print this post

Thanks Peter, then I'm guessing that David should verify that he is using the correct pins.

He may need to modify the pins in:
Sub mm.startup
ILI9488 27,28,24, 1 ' landscape
End Sub

To suit the backpack if they are different?

@David, Welcome to the forum by the way. Perhaps if you don't get help with your specific problem you could start a new post.

Bill
Keep safe. Live long and prosper.
 
David_Plumley
Newbie

Joined: 03/01/2022
Location: New Caledonia
Posts: 8
Posted: 07:23am 06 Jan 2022
Copy link to clipboard 
Print this post

Is the order of the pin numbers in the startup sub-routine as per the "Stop Press"
on page 39 of SC August 2019 (The Backpack V3 article by Tim Blythman)?

i.e. ILI9488 <CD>, <RST>, <CS>, <orientation>.

If so, then my startup subroutine is
Sub mm.startup
ILI9488 2, 23, 29, 1
End Sub
      as per the SC article.

Incidently, I notice that loading the ILI9488 driver has created
OPTION LCDPANEL USER 0, 0

in the LIBRARY. Shouldn't this be ...USER 480, 320 ?

When I run
GUI TEST LCDPANEL

from Tera Term, the screen remains blank, but the console prompt is absent until I
press a key, which is as per the display test. So it would seem that the
software is working OK (there is no error message) but for the display.

Touch works too. I activate the option with
OPTION TOUCH 1, 3

but of course I cannot see the four crosses one after the other. But if I press the screen four times, then
"Warning: Inaccurate calibration
Deviation X = -198, Y = 1670 (pixels)"
is displayed on the console before the prompt returns. The library then includes
GUI CALIBRATE 0, 2140, 224, 3314, -12935


These values are obviously meaningless, because I pressed the screen in
arbitrary positions (there being no crosses displayed). But the tactile software
is obviously functioning...

I've realised that my E64 is running V5.05.04. I tried to download the V5.05.05
bundle from Geoff's site, but the un-zipping was riddled with errors. Of the
two hex files, the MM one decompressed OK but the MM+ one did not...! I've
just e-mailed Geoff about it. But being the summer here in the Southern Hemisphere,
he might be away on holiday, of course... I don't know whether the V..01
difference will have an effect on my ILI9488 display problem...

I've been struggling on and off most of the day on this (except for lunch and a
siesta, of course...). I can't see what I'm doing wrong, probably because I
can't see the wood for the trees!

Some advice would be much appreciated. Thank you.

Here in Noumea, it is just after 6PM, 7AM GMT, on Thursday. Dinner time for us.

Have a nice day.

David.

P.S. - Just a reminder: I've plugged my ILI9488 into a uMite+ LCD Backpack board
which carries uMite+64 chip.
 
     Page 1 of 3    
Print this page
© JAQ Software 2024