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