Arduino GLCD Library: Migrating Configurations

# Migrating Configurations

Configuration has been significantly improved to give a wider choice of pins, support for more processor types and more display panels as well as make configurtion much simpler. Because of this additional functionality, the way panels and pins are configured has changed.

The good news is that if you are using the wiring and pins recommend in the ks0108 library, you should not have to do anything. It should work "out of the box".

One obvious change is that all the ks0108 configuration files have been relocated to a config directory.

There is now a master configuration file that determines which configuration is "active". This master configuration file is glcd_Config.h and is not in the config directory.

The glcd library is shipped with ks0108 configuration files that are very similar to the configuraiton files in the ks0108 library. In fact, in fact they preserve many of the same ks0108 naming conventions.

There is a ks0108_panel.h file that is used to set panel specific configuration information and there are ks0108_{BOARD}.h board specific files to set pin configuration for each board type.

Warning:
  While tempting, DO NOT copy any of the existing ks0108.h, ks0108_panel.h, or ks0108_{BOARD}.h files to the config directory. This will not work as the glcd library versions of the header files have additional defines that are not present in the ks0108 version of the header files.

The glcd low level code has been rewritten to greatly simplify configuration as well as allow greater flexibility in AVR pin assignment. As a result, it is no longer necessary to manually configure any AVR port information, including byte vs nibble mode or be restricted to using particular nibbles or pins.

Any AVR/Arduino pin can now be used for any GLCD pin function.

There are no longer any restristions as to which Arduino/AVR pins must be used for any glcd function. Simply specify the pin and at compile time, the code will automagically figure out the best possible mode for the configured pins and generate the smallest/fastest code including single instructions when possible. If all the data pins are on the same AVR port and in the proper order, byte mode will be used, if pins span ports but are are sequential and nibble aligned, then nibble mode will be used. The code will drop down to individual bit i/o if necessary. The code is even smart enough to use nibble mode for one nibble an then bit i/o for the other bits in the data byte.

While the code does support any Arduino/AVR pin for any glcd function, if pins are grouped appropriately on the AVR ports, the code can take advantage of byte or nibble mode to offer a potential performance increase.

The very low level routines were also rewritten to accurately honor all the delay timing values in the ks0108 data sheet. (which was not previously the case) The code now also uses real timing cycle delay loops based on nanoseconds which are scaled to the processor speed. Since all the delay timing values are based on the datastheet delay values, there normally is no need to have to adjust these values.

Gone is all messing with EN_DELAY_VALUE.

The new library has been tested with many different panels and should "just work". If for some reason the panel is an odd panel with significantly slower timing, each individual timing delay value can be adjusted in the ks0108_Panel.h file to match the datasheet specification.

The code now allows configuring the number of glcd CSEL chip select lines as well as the behavior of those pins.

This is useful when configuring for displays larger than 128x64 as different displays handle the CSEL lines differently.

In terms of how to actually move a custom pin configuration from the ks0108 library to the glcd library:

Normally, for a standard 128x64 ks0108 panel, the only changes necessary for a custom pin configuration will be to modify the ks0108_{BOARD}.h file. Everthing else will automatically configure itself.

If the custom configuration is more complex than simple pin changes to a 128x64 display:

- Edit the glcd_Config.h file to select the Active config file (normally not necessary for ks0108)
- Edit the ks0108_panel.h to verify/set proper values for:
  - DISPLAY_WIDTH
  - DISPLAY_HEIGHT
  - CHIP_HEIGHT
  - CHIP_WIDTH
  - If necessary, modify NBR_CHIP_SELECT_PINS and corresponding glcd_CHIPx defines
- Edit ks0108_{BOARD}.h to verify/set all the pin values

See the library configuration page for full details on configuration: Configuration