Jump to content

KS0108


doc_rob

Recommended Posts

I have an old 128x64 monochrome Display with KS0107/0108 controller. Is this supported? I didn't find a driver. It uses 8bit parallel interface with two CS Lines because it is divided in half. Left 64pixel is one controller, right 64pixel the other one. Which is the best driver to start with if i have to develop a new one?

best regards,

Robert

Link to comment
Share on other sites

Hi,

There's currently no driver for that display from our side. However, writing one is very easy. I once wrote one for that display controller but that was for a paying customer that didn't allow us to put it into the public repository.
The split areas (two controllers) are not a problem either. Write a driver that handles the full display area and then simply check for the X coordinate and select the appropriate controller to talk to.

Link to comment
Share on other sites

Driver is functional. It was a lot of work but also a good learning experience. I have the possibility to read back from the display (untested because as it turns out after three days debugging - my display is broken) or have an array in RAM. I guess the linebuffer can be used for this but i don't know how. Could anybody look at the code and give me feedback. Thanks.

best regards, robert

driver.mk

gdisp_lld_config.h

gdisp_lld_KS0108.c

board_KS0108.h

Link to comment
Share on other sites

Hi,

First of all, thank you for sharing your driver with us and the rest of the community.
I gave it a very quick look and these are the things that popped to my mind:

  • You're using osalThreadSleepXXX() instead of gfxSleepXxx() at some locations (eg. the initialization code)
  • Your framebuffer (lcdbuf) is a global variable. This won't work if you want to use multiple displays. You must not create any global variables at all. Instead, the GDisplay* struct has a void* pointer named priv that you can use to store custom information. If you need more information than what a simple void* can hold create a structure and let the priv pointer point to that. Have a look at other existing drivers to see how it's done. Take the SSD1306 and the UC8173 drivers as an example.
  • There's code (that has been commented out) to clear the display. That is not necessary as the higher level GDISP stuff will take care of that and it will use the area filling if that is available so that code is really not required unless the KS0108 controller has a real "clear" hardware function.
  • Some general serious clean-up is required. The function and variable naming appears to be inconsistent and the indentation is just all over the place.

Don't hesitate to ask if you have any questions. We're happy to help wherever we can :) 

Link to comment
Share on other sites

I got a chance to look at the code, unfortunately it does not compile.

I made some changes:

.) removed KS0108_goto altogether (there's a typo in the argments anyway)

.) had to move #define CHIPS, #define BUFFSZ  and  #define RAM(g) to board_KS0108.h

After that it will compile and it works as far as i can test (means without readback) it.

Let me know what you think about it.

best regards,

robert

EDIT.

I almost forgot, i had to remove (void)state; in setpin_reset for the if(state) to work.

 

board_KS0108.h

gdisp_lld_KS0108.c

Edited by doc_rob
forgot something
Link to comment
Share on other sites

Why did you have to move the RAM(g) and other macros to the board file? That would be wrong. That is part of the generic driver. Only stuff that changes depending on your wiring must go into the board file.

To clarify: I don't say that what we have in the repository is correct right now (as apparently there are a few changes that were applied prior to that) but the framebuffer stuff definitely belongs to the driver, not to the board file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...