2 ** Main lightpen driver calibration functions.
4 ** 2013-07-25, Greg King
14 static const char *name;
17 /* Get a lightpen calibration value from a file if it exists. Otherwise, call
18 ** pen_calibrate() to create a value; then, write it into a file, so that it
19 ** will be available at the next time that the lightpen is used.
20 ** Might change the screen.
22 static void __fastcall__ adjuster (unsigned char *XOffset)
24 int fd = open (name, O_RDONLY);
27 pen_calibrate (XOffset);
28 fd = open (name, O_WRONLY | O_CREAT | O_EXCL);
30 (void) write (fd, XOffset, 1);
34 (void) read (fd, XOffset, 1);
40 /* pen_adjust() is optional; if you want to use its feature,
41 ** then it must be called before a driver is installed.
42 ** Note: This function merely saves the file-name pointer, and sets
43 ** the pen_adjuster pointer. The file will be read only when a driver
44 ** is installed, and only if that driver wants to be calibrated.
46 void __fastcall__ pen_adjust (const char *filename)
48 if (filename != NULL && filename[0] != '\0') {
50 pen_adjuster = adjuster;
52 pen_adjuster = pen_calibrate;