While I am not sure if the GDD_X tool will continue to be supported or if it will be added to the ‘new’ MLA (it is currently NOT planned), readers of the “Graphics, Touch, Sound and USB” book that have purchased a recent version of the Mikromedia boards (featuring the new Qt2 type TFT displays) might find some extra difficulty in running the last two projects in chapter 7.
We can blame the rapid evolution of the display market, its crazy (high volume consumer driven) dynamics, but the fact remains that we have to learn to live with it. Adding the new IL9341 controller support to the MLA graphics library is simple enough (I did include the new driver source files IL9341.c and IL9341.h in the book project repositories and I managed to add a few notes in each chapter just before going to print) but adding support to the GDD_X tool might seem a little more convoluted. Not to worry, here you will find a few notes that will help you ‘fix’ it at least as long as you stick to the ‘legacy’ MLA:
1- Start by browsing inside the /Microchip folder. If you followed the book first chapter instructions, that should have been copied in its entirety from the MLA installation directory (June-2013) into your working directory (/Mikromedia)
2- Open the /Graphics folder and proceed further inside the /GDD folder. Here you will find a Default_Template.xml file and a Default_Template folder.
3- Open the xml file with a text editor (MPLAB X editor?) and add the IL9341 drivers to the list enclosed by the <Drivers> tags.
<Drivers> ... <list>Microchip\Graphcis\Drivers\IL9341.c</list> <list>Microchip\Include\Graphics\IL9341.h</list> ... </Drivers>
4- Save the file and proceed to opening the templates folder now. Inside of it you will find a /Configs folder. Once more, using your editor of choice, open the HWP_MIKRO_8PMP.h file. This is where the hardware configuration of the PIC24Mikromedia is defined.
5- You can customise it to your heart’s content, perhaps removing a lot of boilerplate stuff that has nothing to do with the Mikromedias, but to reduce risk and get to the point proceed to search for word ‘HX8347’. You will find it in four instances, where you will apply the following edits:
a) Where you find:
Proceed to comment the line and/or edit as:
b) Where you find:
// Using HX8347D Display Controller #if defined(GFX_USE_DISPLAY_CONTROLLER_HX8347D) #define DISP_ORIENTATION 90 #define DISP_HOR_RESOLUTION 240 #define DISP_VER_RESOLUTION 320 #endif
Edit as :
#if defined(GFX_USE_DISPLAY_CONTROLLER_HX8347D) || defined(GFX_USE_DISPLAY_CONTROLLER_IL9341) ...
c) Where you’ll find:
#elif defined (GFX_USE_DISPLAY_CONTROLLER_HX8347D) #define PMP_DATA_SETUP_TIME (18) #define PMP_DATA_WAIT_TIME (82) // See HX8347 data sheet for details #define PMP_DATA_HOLD_TIME (0)
#elif defined (GFX_USE_DISPLAY_CONTROLLER_IL9341) #define PMP_DATA_SETUP_TIME (0) #define PMP_DATA_WAIT_TIME (0) // See IL9341 data sheet for details #define PMP_DATA_HOLD_TIME (1)
And you are all set!