A short, but complete example to give a first impression:
#include <stdio.h>
#include <stdlib.h>
#include "serdisplib/serdisp.h"
int main(int argc, char** argv) {
char sdcdev[] = "/dev/parport0";
char dispname[] = "PCD8544";
serdisp_CONN_t* sdcd;
serdisp_t* dd = 0;
int i;
if (sdcd == (serdisp_CONN_t*)0) {
fprintf(stderr,
"Error opening %s, additional info: %s\n", sdcdev,
sd_geterrormsg());
exit (1);
}
if (!dd) {
fprintf(stderr,
"Error opening display %s, additional info: %s\n", dispname,
sd_geterrormsg());
exit(1);
}
}
}
sleep(30);
return(0);
}
Open display, draw something, and exit without clearing the display:
Open display as in example 1, but use default identifier function:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "serdisplib/serdisp.h"
int main(int argc, char** argv) {
char* sdcdev = 0;
char dispname[] = "PCD8544";
serdisp_CONN_t* sdcd;
serdisp_t* dd = 0;
...
if ( ! (sdcdev && strlen(sdcdev) > 0 ) ) {
}
if (sdcd == (serdisp_CONN_t*)0) {
fprintf(stderr,
"Error opening %s, additional info: %s\n", sdcdev,
sd_geterrormsg());
exit (1);
}
if (!dd) {
fprintf(stderr,
"Error opening display %s, additional info: %s\n", dispname,
sd_geterrormsg());
exit(1);
}
...
return(0);
}