emWin on Custom Board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

emWin on Custom Board

805 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zepedrowdp on Tue Apr 29 15:11:03 MST 2014
Hey!

I'm using a LPC1754 with a 2.4'' inch TFT controlled by ILI9341. I used this BSP for MCB1700 to start.

There are a couple of differences between the two boards, so I will need to adapt some code to make this work, sadly I haven't got much experience doing this.

I know that MCB1700 has a TFT controller that is different from ILI9341 and therefore uses GUIDRV_FLEXCOLOR_F66708 while mine uses GUIDRV_FLEXCOLOR_F66709.
Also, the SPI code I saw on LCD_X_SPI.c file seems very different from the one described on ILI9341 datasheet (I'm using 4 wire serial data interface II).



From what I understand I need to alter the code on the file LCD_X_Serial.c and LCDConfig.c that come with emWin on the Samples folders, is there any tutorial or example to follow? I'm a bit lost on how to adapt this code. Help!
Labels (1)
0 Kudos
2 Replies

531 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zepedrowdp on Tue Apr 29 18:34:45 MST 2014
Hello Wouter,

I already read that note. The problem is that the example from the AppNote uses a different controller which makes everything harder to adapt... I was hopping for an example that shows at least how to alter LCD_X_Serial.c instead of re-writing the hole file like on the AppNote.


Taking a first glance at LCD_X_Serial.c I was hopping it would be just a matter of indicating which pin does what but it seems to be more than that.


/*********************************************************************
*
*           Hardware configuration
*
**********************************************************************

  Needs to be adapted to your target hardware.
*/

// Configuration example:
/*
#define LCD_CLR_A0()      P7 &= ~(1<<1)
#define LCD_SET_A0()      P7 |=  (1<<1)
#define LCD_CLR_RESET()   P7 &= ~(1<<2)
#define LCD_SET_RESET()   P7 |=  (1<<2) 
#define LCD_CLR_CLK()     P7 &= ~(1<<3)
#define LCD_SET_CLK()     P7 |=  (1<<3) 
#define LCD_CLR_DATA()    P7 &= ~(1<<4)
#define LCD_SET_DATA()    P7 |=  (1<<4) 
#define LCD_SET_DIR_OUT() P7D = 0xff
#define LCD_CLR_CS()      P7 &= ~(1<<0)      // Optional
#define LCD_SET_CS()      P7 |=  (1<<0)      // Optional
#define LCD_CLR_CS1()     P7 &= ~(1<<5)      // Optional (only for mult. controllers)
#define LCD_SET_CS1()     P7 |=  (1<<5)      // Optional (only for mult. controllers)
#define LCD_DELAY(ms)     GUI_Delay(ms)      // Optional

*/


For example, what's the role of LCD_SET_CLK() in this? Should I just indicate the pin where the SPI clock is? But then I don't understand how it works with the initialization function.:

void LCD_X_Init(void) {
  LCD_CLR_RESET();
  LCD_SET_DIR_OUT();
  LCD_SET_CS();
  #ifdef LCD_SET_CS1
    LCD_SET_CS1();
  #endif
  LCD_SET_A0();
  LCD_SET_RESET();
  LCD_SET_CLK();
  LCD_SET_DATA();
  LCD_DELAY(20);
  LCD_SET_RESET();
  LCD_DELAY(20);
}


Shouldn't there be some kind of set up of the seria clock or should I write it myself? But then, if I write LCD_SET_CLK() has a function that configures the serial clock, then what is it doing in here?:

/*********************************************************************
*
*           Send1 routine
*
**********************************************************************

  Usually, there is no need to modify this routine.
  It should be sufficient ot modify the low-level macros above or
  in a configuration file.
*/

/* Write 1 byte, MSB first */

static void Send1(unsigned char Data) {
  if ((Data >> 7) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
  if ((Data >> 6) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
  if ((Data >> 5) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
  if ((Data >> 4) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
  if ((Data >> 3) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
  if ((Data >> 2) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
  if ((Data >> 1) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
  if ((Data >> 0) & 1) LCD_SET_DATA(); else LCD_CLR_DATA(); LCD_CLR_CLK(); LCD_SET_CLK();
}
0 Kudos

531 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wouter on Tue Apr 29 16:20:18 MST 2014
Hi José,

You may want to have a look at the emWin porting guide, this should be quite helpful to get you started.

Regards,
Wouter
0 Kudos