Documentation for serdisplib >= V 1.92

DISCLAIMER:
THIS IS EXPERIMENTAL SOFTWARE AND HARDWARE. USE AT YOUR OWN RISK. THE MAINTAINER(S) OF THESE PAGES AND THE DEVELOPER(S) OF SOFTWARE AND HARDWARE PRESENTED ON THESE PAGES CAN NOT BE HELD LIABLE UNDER ANY CIRCUMSTANCES FOR DAMAGE TO HARDWARE OR SOFTWARE, LOST DATA, OR OTHER DIRECT OR INDIRECT DAMAGE RESULTING FROM THE USE OF THIS SOFTWARE OR HARDWARE. IF YOU DO NOT AGREE TO THESE CONDITIONS, YOU ARE NOT PERMITTED TO USE OR FURTHER DISTRIBUTE THIS SOFTWARE OR TO USE ANY TEMPLATES FOR BUILDING HARDWARE PRESENTED HERE.

Overview

attention:
the additional support of direct I/O starting with version 1.92 requested a change in the API:
instead of int filehandles a structure ppd (parallel port descriptor) is now used.
serdisp_init() now has an extra parameter that will be used in the future.

further infos on api-changes: HISTORY

serdisp_parport.h: Accessing the parallel port

serdisp_parport.h offers some functions for opening and closing a parallel port using a parallel port descriptor ('ppd').
either you may use these functions or any other function / code / ... that is returning either a file handle which can be controlled using ioctl-calls or direct I/O using outp-calls.
in this case such a handle has to be converted to a parallel port descriptor using PP_import().

serdisp_control.h: Accessing and controlling a display

all elementary functions for controlling a display are defined here

Examples

Complete example:
  char ppdev[] = "/dev/parport0";

  serdisp_PP_t* ppd;    
  serdisp_t* dd = 0;
  int i;

  /* opening the parallel port device */             
  ppd = PP_open(ppdev);
                
  if (ppd == (serdisp_PP_t*)0) {        
    fprintf(stderr, "Error opening %s\n", ppdev);
    exit (1);
  }

  /* opening and initialising the display */
  dd = serdisp_init(ppd, "PCD8544", "");
  if (!dd) {
    fprintf(stderr, "Error opening display.\nExiting ...\n\n".);
    exit(1);
  }


  /* turning on backlight */
  serdisp_feature(dd, FEATURE_BACKLIGHT, FEATURE_YES);

  /* clearing the display */
  serdisp_clear(dd);

  /* draw a border (only internal display buffer is affected!!) */
  for (i = 0; i < serdisp_getwidth(dd); i++) {
    serdisp_setpixel(dd, i, 0, 1);
    serdisp_setpixel(dd, i, serdisp_getheight(dd)-1, 1);
  }  
  for (i = 1; i < serdisp_getheight(dd)-1; i++) {
    serdisp_setpixel(dd, 0, i, 1);
    serdisp_setpixel(dd, serdisp_getwidth(dd)-1, 1);
  }

  /* commit changes -> update the display using the internal display buffer */
  serdisp_update(dd);

  /* some delay */
  usleep(100000);

  /* close the display */
  serdisp_close(dd);

  /* release parallel port */
  PP_close(ppd);

(c) 2003-2004 by wolfgang astleitner // version: 1.92 // 2004-03-22