Community
cancel
Showing results for 
Search instead for 
Did you mean: 
mgolu
New Contributor II
1,307 Views

KS0108 display driver porting from STM32

Jump to solution

Hi all,

As in subjest I have graphic display ABG128064H05-YHY-R-01 based on KS0108 driver. I found driver on STM32 for this display but I want to port it into D2000 platform. I want to ask about two functions GLCD_ReadStatus and GLCD_WriteCommand because I'm not sure how they should looks like in D2000. Maybe someone have any idea ?

link to lbr for STM32: http://en.radzio.dxp.pl/ks0108/ks0108-stm32.rar http://en.radzio.dxp.pl/ks0108/ks0108-stm32.rar

Oryginal function body looks as below:

//-------------------------------------------------------------------------------------------------

// Read Status byte from specified controller (0-2)

//-------------------------------------------------------------------------------------------------

unsigned char GLCD_ReadStatus(unsigned char controller)

{

unsigned char status;

//GPIO_StructInit(&GPIO_InitStructure);

//GPIO_InitStructure.GPIO_Pin = 0xFF << KS0108_D0; //pin

//GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //pullup

qm_pmux_input_en (const qm_pin_id_t pin, const bool enable); //Enable input for a pin in the pin mux controller.

qm_pmux_pullup_en (const qm_pin_id_t pin, const bool enable); //Enable pullup for a pin in the pin mux controller.

//GPIO_Init(KS0108_PORT, &GPIO_InitStructure);

qm_gpio_set_config(&GPIO_InitStructure);

GPIO_SetBits(KS0108_PORT, KS0108_RW);

GPIO_ResetBits(KS0108_PORT, KS0108_RS);

GLCD_EnableController(controller);

GLCD_Delay();

GPIO_SetBits(KS0108_PORT, KS0108_EN);

GLCD_Delay();

status = ((GPIO_ReadInputData(KS0108_PORT) >> KS0108_D0) & 0xFF);

GPIO_ResetBits(KS0108_PORT, KS0108_EN);

GLCD_DisableController(controller);

return status;

}

//-------------------------------------------------------------------------------------------------

// Write command to specified controller

//-------------------------------------------------------------------------------------------------

void GLCD_WriteCommand(unsigned char commandToWrite, unsigned char controller)

{

while(GLCD_ReadStatus(controller)&DISPLAY_STATUS_BUSY);

GPIO_StructInit(&GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = (0xFF << KS0108_D0);

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;

GPIO_Init(KS0108_PORT, &GPIO_InitStructure);

GPIO_ResetBits(KS0108_PORT, KS0108_RS | KS0108_RW);

GLCD_Delay();

GLCD_EnableController(controller);

GLCD_Delay();

GPIO_SetBits(KS0108_PORT, (commandToWrite << KS0108_D0));

commandToWrite ^= 0xFF;

GPIO_ResetBits(KS0108_PORT, (commandToWrite << KS0108_D0));

GLCD_Delay();

GPIO_SetBits(KS0108_PORT, KS0108_EN);

GLCD_Delay();

GPIO_ResetBits(KS0108_PORT, KS0108_EN);

GLCD_Delay();

GLCD_DisableController(controller);

}

I connect it into D2000 board as below:

# include "qm_pinmux.h"

//Data bus - lines

# define LCD_DB0 QM_PIN_ID_6

# define LCD_DB1 QM_PIN_ID_7

# define LCD_DB2 QM_PIN_ID_2

# define LCD_DB3 QM_PIN_ID_5

# define LCD_DB4 QM_PIN_ID_10

# define LCD_DB5 QM_PIN_ID_11

# define LCD_DB6 QM_PIN_ID_12

# define LCD_DB7 QM_PIN_ID_13

//Data port

# define KS0108_PORT QM_GPIO_0

//Control Lines

# define KS0108_CS1 QM_PIN_ID_16

# define KS0108_CS2 QM_PIN_ID_18

# define KS0108_RST QM_PIN_ID_17

# define KS0108_RW QM_PIN_ID_0

# define KS0108_RS QM_PIN_ID_24

# define KS0108_EN QM_PIN_ID_9

# define KS0108_D0 0

# define DISPLAY_STATUS_BUSY 0x80

//User button

# define USER_BUTTON_IN QM_PIN_ID_2

extern unsigned char screen_x;

extern unsigned char screen_y;

extern int qm_gpio_clear_pin();

extern int qm_gpio_set_pin();

0 Kudos
1 Solution
idata
Community Manager
109 Views

Hi Mark_kram,

Thanks for reaching out.

Did you check the http://https//downloadcenter.intel.com/download/25619/Intel-Quark-Microcontroller-Software-Interface Intel® Quark™ Microcontroller Software Interface? I think that it can help you to set the GPIOs in the right way to use your display with the D2000 platform.

I hope you find it helpful.

Have a nice day.

Regards,

-Leonardo

View solution in original post

1 Reply
idata
Community Manager
110 Views

Hi Mark_kram,

Thanks for reaching out.

Did you check the http://https//downloadcenter.intel.com/download/25619/Intel-Quark-Microcontroller-Software-Interface Intel® Quark™ Microcontroller Software Interface? I think that it can help you to set the GPIOs in the right way to use your display with the D2000 platform.

I hope you find it helpful.

Have a nice day.

Regards,

-Leonardo

View solution in original post

Reply