diff --git a/docs/lcdproc-dev/make-driver.docbook b/docs/lcdproc-dev/make-driver.docbook index 1dca2da..5409e45 100644 --- a/docs/lcdproc-dev/make-driver.docbook +++ b/docs/lcdproc-dev/make-driver.docbook @@ -31,7 +31,8 @@ These files are provided only for drivers, others are provided for all of LCDpro The file port.h, located in the server/drivers/ directory provide Input/Output and port permissions for the PC compatible parallel port, also known as the LPT port. -Of course, these functions will only work if the computer where LCDproc runs has parallel port! In these situations, the configure script will see this and disable drivers that need a parallel port. + Of course, these functions will only work if the computer where LCDproc runs has parallel port!r + In these situations, the configure script will see this and disable drivers that need a parallel port. port.h file defines 6 static inline functions for port I/O: @@ -40,37 +41,43 @@ Of course, these functions will only work if the computer where LCDproc runs has Read a byte from port - - static inline int port_in - unsigned short int port - + + static inline int port_in + unsigned short int port + -Returns the content of the byte. + + Returns the content of the byte. + Write a char(byte) 'val' to port - - static inline void port_out - unsigned short int port - unsigned char val - + + static inline void port_out + unsigned short int port + unsigned char val + -Returns nothing (void). + + Returns nothing (void). + Get access to a specific port - - static inline int port_access - unsigned short int port - + + static inline int port_access + unsigned short int port + -Returns 0 if successful, -1 if failed. + + Returns 0 if successful, -1 if failed. + @@ -78,12 +85,14 @@ Of course, these functions will only work if the computer where LCDproc runs has Close access to a specific port - - static inline int port_deny - unsigned short int port - + + static inline int port_deny + unsigned short int port + -Returns 0 if successful, -1 if failed. + + Returns 0 if successful, -1 if failed. + @@ -91,31 +100,36 @@ Of course, these functions will only work if the computer where LCDproc runs has Get access to multiple sequential ports - - static inline int port_access_full - unsigned short int port - unsigned short int count - + + static inline int port_access_full + unsigned short int port + unsigned short int count + -Returns 0 if successful, -1 if failed. + + Returns 0 if successful, -1 if failed. + Close access to multiple sequential ports - - static inline int port_deny_full - unsigned short int port - unsigned short int count - + + static inline int port_deny_full + unsigned short int port + unsigned short int count + -Returns 0 if successful, -1 if failed. + + Returns 0 if successful, -1 if failed. + Example use + #include "port.h" @@ -146,15 +160,46 @@ port_deny_multiple(0x378,3); adv_bignum.h : Write Big-Numbers -adv_bignum.h is the headerfile for lib_bignum.a (made from adv_bignum.c) which contains everything needed to show big-numbers, including the fonts for the different displays. (All files are located in the server/drivers/ directory.) + + adv_bignum.h is the headerfile for lib_bignum.a + (made from adv_bignum.c) which contains everything needed to show big-numbers, + including the fonts for the different displays. + (All files are located in the server/drivers/ directory.) -There are only a few requirements to the calling driver: -The displays cellwidth has to be 5 and the cellheight 7 or 8. -The following functions have to be implemented: chr( ); - set_char( )(only if the display has custom-characters) -The custom-characters (if available) have to be at char 0, 1, 2, ..... ,n - -The lib determines the correct font, depending on the displaysize and the number of user-character, itself. So it is easy to integrate into the driver. + + + There are only a few requirements to the calling driver: + + + + + The display's cellwidth has to be 5 + (6 works also in some cases) and the cellheight + 7 or 8. + + + + The following functions have to be implemented by the driver: + + + chr() + + + set_char() (only if the display has custom-characters) + + + + + + The custom-characters (if available) have to be at char 0, 1, 2, ..... ,n + + + + + The library determines the correct font, depending on the display size and the number + of user-defined characters itself. + So it is easy to integrate into the driver. + @@ -162,68 +207,122 @@ port_deny_multiple(0x378,3); External provided Functions - - void lib_adv_bignum - Driver *drvthis - int x - int num - int height - int do_init - int customchars - + + void lib_adv_bignum + Driver *drvthis + int x + int num + int height + int do_init + int customchars + -The main thing the driver has to do is to call this function from its the num( ) function. + + The main thing the driver has to do is to call this function from its num() + function. + -Where num is the number (legal: 0,...9,:) to be written, height the displays hight in characters and customchars the number of available custom-characters. + + Where num is the number (legal: 0 - 9, + and :) + to be written, height the display's height in characters and + customchars the number of available custom characters. + -x is the x position of the top-left corner of the big-number (the big-numbers don't have a y position). The placing of the characters is done by the client, so the driver only has to forward the position to the lib. The bignumlib has no influence on the placing of the characters. + + x is the x position of the top-left corner of the big-number + (the big-numbers don't have a y position). + The placing of the characters is done by the client, so the driver only has to forward + the position to the lib. The bignumlib has no influence on the placing of the characters. + -If do_init is unequal 0 lib_bignum will set the custom-characters of the display for the big-numbers. -The driver has to check if the custom-characters have to be set or if it is already done and tell it to the lib (using the do_init parameter). -The common way is to use variable called p->ccmode or similar. In the different drivers there are some differences in the naming and handling of this variable. So the responsibility of checking and setting is left at the driver. + + If do_init is not 0 lib_bignum will set the + custom characters of the display for the big-numbers. + + + + The driver has to check if the custom-characters have to be set or if it is + already done and tell it to the lib (using the do_init parameter). + The common way is to use variable called p->ccmode or similar. + In the different drivers there are some differences in the naming and handling of this variable. + So the responsibility of checking and setting is left at the driver. + Internal Structure and Functions -The only function of lib_adv_bignum( ) is to determine the best display-dependent big-number-function for the given display-parameters, and to call it. - + + The only function of lib_adv_bignum() is to determine the best + display-dependent big-number function for the given display parameters, and to call it. + -The display-dependent functions are named adv_bignum_num_N_M( ). -Where N is the display-hight lines and M the number of used user-characters. -The bits of the user-characters are stored in static char bignum (take a look at the source and you will see what I mean). (On a display with a cellheight of 7 the lowest line stored is not shown.) While static char num_map defines the placing in the big number. (A big number is always 3 characters wide and 4 characters high. On a big number for 2 line displays the 2 lower lines are not in use.) -If user-characters have to be set the drivers set_char( ) function will be called once for every user-character. -Now adv_bignum_write_num( ) is called. This function places the 6 or 12 characters the big-number consists of in the framebuffer using the drivers char( ) function. + + The display-dependent functions are named adv_bignum_num_N_M(). + Where N is the display-height in lines and M + the number of used user-defineable characters. + The bits of the user-characters are stored in static char bignum + (take a look at the source and you will see what I mean). (On a display with a + cellheight of 7 the lowest line stored is not shown.) + While static char num_map defines the placing in the big number. + (A big number is always 3 characters wide and 4 characters high. + On a big number for 2 line displays the 2 lower lines are not in use.) + + + + If user-characters have to be set the driver's set_char() function + will be called once for every user-character. + + + + Now adv_bignum_write_num() is called. + This function places the 6 or 12 characters the big-number consists of in the framebuffer + using the drivers chr() function. + Example: -Calling the lib_adv_bignum( ) from a drivers_num function. (from serialVFD.c): + + + Calling the lib_adv_bignum() from a drivers_num function. + (from serialVFD.c): + MODULE_EXPORT void -serialVFD_num( Driver * drvthis, int x, int num ){ -int do_init=0; -PrivateData *p = drvthis->private_data; +serialVFD_num( Driver * drvthis, int x, int num ) +{ + PrivateData *p = drvthis->private_data; + int do_init = 0; - -if (p->ccmode != CCMODE_BIGNUM){ // Are the custom-characters set up correctly? If not: -do_init=1;// Lib_adv_bignum has to set the custom-characters. -p->ccmode = CCMODE_BIGNUM; // Switch custom-charactermode to bignum. -} -// Lib_adv_bignum does everything needed to show the big-numbers. -lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars); + if (p->ccmode != CCMODE_BIGNUM){ // Are the custom-characters set up correctly? If not: + do_init = 1; // Lib_adv_bignum has to set the custom-characters. + p->ccmode = CCMODE_BIGNUM; // Switch custom-charactermode to bignum. + } + // Lib_adv_bignum does everything needed to show the big-numbers. + lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars); } -All that's left to do is to include the header-file -#include "adv_bignum.h" -and to add libbignum.a to the libs and adv_bignum.h sources of your driver. + + All that's left to do is to include the header-file + + +#include "adv_bignum.h" + + + + and to add libbignum.a to the libs and adv_bignum.h + sources of your driver in the Makefile (or the file that generates the + Makefile). +