update serialVFD driver and comment bignum library -
patch provided by Stefan Herdler
This commit is contained in:
@@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
If you want to add a new device to the driver add a new section
|
If you want to add a new device to the driver add a new section
|
||||||
to the displaytype-switch-case in the init-function and fill it
|
to the displaytype-switch-case in the init-function and fill it
|
||||||
with the corrrect commands for the display.
|
with the correct commands for the display.
|
||||||
(Try wich displaytype works best with your display, copy and modify
|
(Try which displaytype works best with your display, copy and modify
|
||||||
it's section that is the easiest way I guess.)
|
it's section that is the easiest way I guess.)
|
||||||
|
|
||||||
|
|
||||||
@@ -33,10 +33,13 @@
|
|||||||
http://www.maltepoeggel.de/html/vfd/index.html
|
http://www.maltepoeggel.de/html/vfd/index.html
|
||||||
|
|
||||||
|
|
||||||
|
It is possible to switch the display off and back on while the server is
|
||||||
|
running. It may take a few minutes untill the next full refresh makes
|
||||||
|
the display show everything correctly.
|
||||||
|
|
||||||
|
|
||||||
To enable the bignumbers on 2-line displays (only this driver supports
|
To enable the bignumbers on 2-line displays (only this driver supports
|
||||||
this yet) you have to edit "/clientchrono.c" before compiling.
|
this yet) you have to edit "/clients/lcdproc/chrono.c" before compiling.
|
||||||
In function "big_clock_screen" you have to replace the "4" by a "2" in
|
In function "big_clock_screen" you have to replace the "4" by a "2" in
|
||||||
this line: "if (lcd_hgt < 4)"
|
this line: "if (lcd_hgt < 4)"
|
||||||
|
|
||||||
|
|||||||
+103
-59
@@ -23,27 +23,49 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Demands on the calling driver / display:
|
Requirements to the calling driver / display:
|
||||||
cellwidth == 5
|
cellwidth == 5
|
||||||
cellheight == 7 or 8 (testet only on 7)
|
cellheight == 7 or 8 (tested only on 7)
|
||||||
needed functions:
|
needed functions:
|
||||||
drvthis->set_char (only if the display has usercharacters)
|
drvthis->set_char (only if the display has customcharacters)
|
||||||
drvthis->chr
|
drvthis->chr
|
||||||
usercharacters (if available) at 0, 1, 2, ..... ,n
|
customcharacters (if available) at char 0, 1, 2, ..... ,n
|
||||||
|
|
||||||
USAGE:
|
USAGE:
|
||||||
|
|
||||||
Just call lib_adv_bignum(drvthis, x, num, height, do_init, customchars)
|
Just call lib_adv_bignum(drvthis, x, num, height, do_init, customchars)
|
||||||
from drvthis->num.
|
from drvthis->num.
|
||||||
The library does everything needed to show bignumbers EXPECT checking or
|
The library does everything needed to show bignumbers EXCEPT checking or
|
||||||
setting the CCMODE variable. The driver has to do this (see serialVFD.c
|
setting the CCMODE variable. The driver has to do this (see serialVFD.c
|
||||||
for details).
|
for details).
|
||||||
|
|
||||||
|
Example: Call of the lib_adv_bignum from a drivers_num function :
|
||||||
|
|
||||||
|
MODULE_EXPORT void
|
||||||
|
serialVFD_num( Driver * drvthis, int x, int num )
|
||||||
|
{
|
||||||
|
int do_init=0;
|
||||||
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
|
|
||||||
|
if (p->ccmode != CCMODE_BIGNUM) // Are the customcharacters set up correctly? If not:
|
||||||
|
{
|
||||||
|
do_init=1; // Lib_adv_bignum has to set the customcharacters.
|
||||||
|
p->ccmode = CCMODE_BIGNUM; // Switch customcharactermode to bignum.
|
||||||
|
}
|
||||||
|
// Lib_adv_bignum does everything needed to show the bignumbers.
|
||||||
|
lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars);
|
||||||
|
}
|
||||||
|
|
||||||
|
To enable the bignumbers on 2-line displays you have to edit "/clients/lcdproc/chrono.c"
|
||||||
|
before compiling. In function "big_clock_screen" you have to replace the "4" by a "2" in
|
||||||
|
this line: "if (lcd_hgt < 4)".
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
//#include <stdio.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
//#include <termios.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -75,36 +97,38 @@ static void adv_bignum_num_4_3 (Driver *drvthis, int x, int num, int height, int
|
|||||||
static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], int x, int num, int height);
|
static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], int x, int num, int height);
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function determines the best possible bignumbertype for the display.
|
||||||
|
// The called bignumberfunction is depending on the display's height and the
|
||||||
|
// number of customcharacters.
|
||||||
void
|
void
|
||||||
lib_adv_bignum(Driver *drvthis, int x, int num, int height, int do_init, int customchars)
|
lib_adv_bignum(Driver *drvthis, int x, int num, int height, int do_init, int customchars)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (height) {
|
switch (height) { // Display heigth:
|
||||||
case 2:
|
case 2: // 2 lines
|
||||||
case 3:
|
case 3: // are 3 line displays really existing?
|
||||||
if(customchars == 0){
|
if(customchars == 0){// 2 lines and customchars = 0
|
||||||
adv_bignum_num_2_0 (drvthis, x, num, height, do_init);
|
adv_bignum_num_2_0 (drvthis, x, num, height, do_init);
|
||||||
}
|
}
|
||||||
else if(customchars ==1 ){
|
else if(customchars ==1 ){// 2 lines and customchars = 1
|
||||||
adv_bignum_num_2_1 (drvthis, x, num, height, do_init);
|
adv_bignum_num_2_1 (drvthis, x, num, height, do_init);
|
||||||
}
|
}
|
||||||
else if(customchars < 3){
|
else if(customchars < 5){// 2 lines and customchars = 2 ... 4
|
||||||
adv_bignum_num_2_2 (drvthis, x, num, height, do_init);
|
adv_bignum_num_2_2 (drvthis, x, num, height, do_init);
|
||||||
}
|
}
|
||||||
else if(customchars < 28){
|
else if(customchars < 28){ // 2 lines and customchars = 5 ... 27
|
||||||
adv_bignum_num_2_5 (drvthis, x, num, height, do_init);
|
adv_bignum_num_2_5 (drvthis, x, num, height, do_init);
|
||||||
}
|
}
|
||||||
else { //p->customchars <= 28
|
else { // 2 lines and customchars >= 28
|
||||||
adv_bignum_num_2_28 (drvthis, x, num, height, do_init);
|
adv_bignum_num_2_28 (drvthis, x, num, height, do_init);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4: // 4 lines
|
||||||
if(customchars < 3){
|
if(customchars < 3){// 4 lines and customchars < 3
|
||||||
adv_bignum_num_4_0 (drvthis, x, num, height, do_init);
|
adv_bignum_num_4_0 (drvthis, x, num, height, do_init);
|
||||||
}
|
}
|
||||||
else { //p->customchars <= 4
|
else { // 4 lines and customchars >= 3
|
||||||
adv_bignum_num_4_3 (drvthis, x, num, height, do_init);
|
adv_bignum_num_4_3 (drvthis, x, num, height, do_init);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -113,12 +137,16 @@ lib_adv_bignum(Driver *drvthis, int x, int num, int height, int do_init, int cus
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function writes the selected type of bignumber by calling the drivers_char function.
|
||||||
|
// It is called by displaydepending bignumber function to write the numbers.
|
||||||
static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], int x, int num, int height)
|
static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], int x, int num, int height)
|
||||||
{
|
{
|
||||||
int y, dx;
|
int y, dx;
|
||||||
for (y = 0; y < height; y++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
if(num == 10)
|
if(num == 10) // ":" is only 1 character wide.
|
||||||
drvthis->chr (drvthis, x, y+1, write_num_map[num][y][0]);
|
drvthis->chr (drvthis, x, y+1, write_num_map[num][y][0]);
|
||||||
else
|
else
|
||||||
for (dx = 0; dx <3; dx++)
|
for (dx = 0; dx <3; dx++)
|
||||||
@@ -131,13 +159,14 @@ static void adv_bignum_write_num (Driver *drvthis, char write_num_map[][4][4], i
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// stored usercharacters
|
// Display dependent functions.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function is called for a 2 line display without custom characters.
|
||||||
|
// (pretty ugly looking)
|
||||||
static void adv_bignum_num_2_0 (Driver *drvthis, int x, int num, int height, int do_init)
|
static void adv_bignum_num_2_0 (Driver *drvthis, int x, int num, int height, int do_init)
|
||||||
{
|
{
|
||||||
static char num_map[][4][4] = {
|
static char num_map[][4][4] = {
|
||||||
@@ -196,14 +225,16 @@ static char num_map[][4][4] = {
|
|||||||
".",
|
".",
|
||||||
" ",
|
" ",
|
||||||
" " }
|
" " }
|
||||||
};
|
}; // Defines the character placing inside the bignumber.
|
||||||
|
|
||||||
adv_bignum_write_num (drvthis, num_map, x, num, height);
|
adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function is usable for a 2 line display with 1 or more custom characters.
|
||||||
|
// (not a beauty, but useable)
|
||||||
static void adv_bignum_num_2_1 (Driver *drvthis, int x, int num, int height, int do_init)
|
static void adv_bignum_num_2_1 (Driver *drvthis, int x, int num, int height, int do_init)
|
||||||
{
|
{
|
||||||
static char num_map[][4][4] = {
|
static char num_map[][4][4] = {
|
||||||
@@ -262,10 +293,10 @@ static char num_map[][4][4] = {
|
|||||||
{"."},
|
{"."},
|
||||||
{" "},
|
{" "},
|
||||||
{" "} }
|
{" "} }
|
||||||
};
|
}; // Defines the character placing inside the bignumber.
|
||||||
if (do_init)
|
if (do_init) // Set customcharacters if needed.
|
||||||
{
|
{
|
||||||
static char bignum[1][5 * 8] = {
|
static char bignum[1][5 * 8] = { // stored customcharacter
|
||||||
{
|
{
|
||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
@@ -276,14 +307,16 @@ if (do_init)
|
|||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
}};
|
}};
|
||||||
drvthis->set_char (drvthis, 0, &bignum[0][0]);
|
drvthis->set_char (drvthis, 0, &bignum[0][0]); // put the customcharacter into the display
|
||||||
}
|
}
|
||||||
adv_bignum_write_num (drvthis, num_map, x, num, height);
|
adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function is usable for a 2 line display with 2 or more custom characters.
|
||||||
|
// (o.k.)
|
||||||
static void adv_bignum_num_2_2 (Driver *drvthis, int x, int num, int height, int do_init)
|
static void adv_bignum_num_2_2 (Driver *drvthis, int x, int num, int height, int do_init)
|
||||||
{
|
{
|
||||||
static char num_map[][4][4] ={
|
static char num_map[][4][4] ={
|
||||||
@@ -342,10 +375,10 @@ static char num_map[][4][4] ={
|
|||||||
".",
|
".",
|
||||||
" ",
|
" ",
|
||||||
" " }
|
" " }
|
||||||
};
|
}; // Defines the character placing inside the bignumber.
|
||||||
if (do_init)
|
if (do_init) // Set customcharacters if needed.
|
||||||
{
|
{
|
||||||
static char bignum[2][5 * 8] = {
|
static char bignum[2][5 * 8] = { // stored customcharacters
|
||||||
{
|
{
|
||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0,
|
||||||
@@ -367,15 +400,17 @@ if (do_init)
|
|||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
}};
|
}};
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= 2 ; i++) {
|
for (i = 0; i <= 2 ; i++) { // put the customcharacters into the display
|
||||||
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adv_bignum_write_num (drvthis, num_map, x, num, height);
|
adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function is usable for a 2 line display with 5 or more custom characters.
|
||||||
|
// (nice bignumbers)
|
||||||
static void adv_bignum_num_2_5 (Driver *drvthis, int x, int num, int height, int do_init)
|
static void adv_bignum_num_2_5 (Driver *drvthis, int x, int num, int height, int do_init)
|
||||||
{
|
{
|
||||||
static char num_map[][4][4] =
|
static char num_map[][4][4] =
|
||||||
@@ -422,10 +457,10 @@ static char num_map[][4][4] =
|
|||||||
{{'.'},/*:*/
|
{{'.'},/*:*/
|
||||||
{'.'},
|
{'.'},
|
||||||
{" "},
|
{" "},
|
||||||
{" "}}};
|
{" "}}}; // Defines the character placing inside the bignumber.
|
||||||
if (do_init)
|
if (do_init) // Set customcharacters if needed.
|
||||||
{
|
{
|
||||||
static char bignum[5][5 * 8] = {
|
static char bignum[5][5 * 8] = { // stored customcharacters
|
||||||
{
|
{
|
||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
@@ -477,15 +512,17 @@ if (do_init)
|
|||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
}};
|
}};
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= 5 ; i++) {
|
for (i = 0; i <= 5 ; i++) { // put the customcharacters into the display
|
||||||
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adv_bignum_write_num (drvthis, num_map, x, num, height);
|
adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function is usable for a 2 line display with 28 or more custom characters.
|
||||||
|
// (Wow, allmost graphical)
|
||||||
static void adv_bignum_num_2_28 (Driver *drvthis, int x, int num, int height, int do_init)
|
static void adv_bignum_num_2_28 (Driver *drvthis, int x, int num, int height, int do_init)
|
||||||
{
|
{
|
||||||
static char num_map[][4][4] =
|
static char num_map[][4][4] =
|
||||||
@@ -532,12 +569,12 @@ static char num_map[][4][4] =
|
|||||||
{{27},/*:*/
|
{{27},/*:*/
|
||||||
{27},
|
{27},
|
||||||
{" "},
|
{" "},
|
||||||
{" "}}};
|
{" "}}}; // Defines the character placing inside the bignumber.
|
||||||
|
|
||||||
if (do_init)
|
if (do_init) // Set customcharacters if needed.
|
||||||
{
|
{
|
||||||
|
|
||||||
static char bignum[28][5 * 8] = {
|
static char bignum[28][5 * 8] = { // stored customcharacters
|
||||||
{ //0
|
{ //0
|
||||||
0, 0, 0, 1, 1,
|
0, 0, 0, 1, 1,
|
||||||
0, 0, 1, 1, 1,
|
0, 0, 1, 1, 1,
|
||||||
@@ -820,17 +857,22 @@ static char bignum[28][5 * 8] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= 28 ; i++) {
|
for (i = 0; i <= 28 ; i++) { // put the customcharacters into the display
|
||||||
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adv_bignum_write_num (drvthis, num_map, x, num, height);
|
adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function is usable for a 4 line display without custom characters.
|
||||||
|
// (o.k.)
|
||||||
static void adv_bignum_num_4_0 (Driver *drvthis, int x, int num, int height, int do_init)
|
static void adv_bignum_num_4_0 (Driver *drvthis, int x, int num, int height, int do_init)
|
||||||
{
|
{
|
||||||
|
/* Ugly code extracted by David GLAUDE from lcdm001.c ;)*/
|
||||||
|
/* Moved to driver.c by Joris Robijn */
|
||||||
|
// Moved to adv_bignum.c by Stefan Herdler
|
||||||
static char num_map[][4][4] = {
|
static char num_map[][4][4] = {
|
||||||
{ /* 0 */
|
{ /* 0 */
|
||||||
" _ ",
|
" _ ",
|
||||||
@@ -887,13 +929,15 @@ static char num_map[][4][4] = {
|
|||||||
".",
|
".",
|
||||||
".",
|
".",
|
||||||
" " }
|
" " }
|
||||||
};
|
}; // Defines the character placing inside the bignumber.
|
||||||
|
|
||||||
adv_bignum_write_num (drvthis, num_map, x, num, height);
|
adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// This function is usable for a 4 line display with 5 or more custom characters.
|
||||||
|
// (nice bignumbers)
|
||||||
static void adv_bignum_num_4_3 (Driver *drvthis, int x, int num, int height, int do_init)
|
static void adv_bignum_num_4_3 (Driver *drvthis, int x, int num, int height, int do_init)
|
||||||
{
|
{
|
||||||
static char num_map[][4][4] =
|
static char num_map[][4][4] =
|
||||||
@@ -940,10 +984,10 @@ static char num_map[][4][4] =
|
|||||||
{{" "},/*:*/
|
{{" "},/*:*/
|
||||||
{'.'},
|
{'.'},
|
||||||
{'.'},
|
{'.'},
|
||||||
{" "}}};
|
{" "}}}; // Defines the character placing inside the bignumber.
|
||||||
if (do_init)
|
if (do_init) // Set customcharacters if needed.
|
||||||
{
|
{
|
||||||
static char bignum[5][5 * 8] = {
|
static char bignum[5][5 * 8] = { // stored customcharacters
|
||||||
{
|
{
|
||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1,
|
||||||
@@ -976,11 +1020,11 @@ if (do_init)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i <= 3 ; i++) {
|
for (i = 0; i <= 3 ; i++) { // put the customcharacters into the display
|
||||||
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
drvthis->set_char (drvthis, i, &bignum[i][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adv_bignum_write_num (drvthis, num_map, x, num, height);
|
adv_bignum_write_num (drvthis, num_map, x, num, height); // write the number
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+86
-67
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
Copyright (C) 2006 Stefan Herdler
|
Copyright (C) 2006 Stefan Herdler
|
||||||
|
|
||||||
This driver is based on drv_base.c, wirz-sli.c and hd44780 from LCDproc
|
This driver is based on wirz-sli.c, hd44780.c, drv_base.c and NoritakeVFD
|
||||||
and the NoritakeVFD driver from this package.
|
driver.
|
||||||
It may contain parts of other drivers of this package too.
|
It may contain parts of other drivers of this package too.
|
||||||
|
|
||||||
2006-01-26 Version 0.1: everything should work (not all hardware tested!)
|
2006-02-13 Version 0.2: everything should work (not all hardware tested!)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -55,16 +55,16 @@
|
|||||||
it's section that is the easiest way I guess.)
|
it's section that is the easiest way I guess.)
|
||||||
|
|
||||||
|
|
||||||
On this page I found pictures and datasheets from the VFD's:
|
On this page I found pictures and datasheets of the VFD's:
|
||||||
http://www.maltepoeggel.de/html/vfd/index.html
|
http://www.maltepoeggel.de/html/vfd/index.html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To enable the bignumbers on 2-line displays (only this driver supports
|
To enable the bignumbers on 2-line displays (only this driver supports
|
||||||
this yet) you have to edit "/clientchrono.c" before compiling.
|
this yet) you have to edit "/clients/lcdproc/chrono.c" before compiling.
|
||||||
In function "big_clock_screen" you have to replace the "4" by a "2" in
|
In function "big_clock_screen" you have to replace the "4" by a "2" in
|
||||||
this line: "if (lcd_hgt < 4)"
|
this line: "if (lcd_hgt < 4)".
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -192,24 +192,13 @@ get_info Implemented.
|
|||||||
#include "lcd_lib.h"
|
#include "lcd_lib.h"
|
||||||
#include "adv_bignum.h"
|
#include "adv_bignum.h"
|
||||||
|
|
||||||
#define pos1_cursor 4
|
#define pos1_cursor 4 //moves cursor to top left character.
|
||||||
#define mv_cursor 5 //moves cursor to position (next byte).
|
#define mv_cursor 5 //moves cursor to position specified by the next byte.
|
||||||
#define reset 6
|
#define reset 6 //reset
|
||||||
#define init_cmds 7
|
#define init_cmds 7 //commands needed to initialize the display.
|
||||||
#define set_user_char 8
|
#define set_user_char 8 //set user character.
|
||||||
#define hor_tab 9 //moves cursor 1 chr right
|
#define hor_tab 9 //moves cursor 1 chr right
|
||||||
|
|
||||||
/* Constants for userdefchar_mode */
|
|
||||||
//#define NUM_CCs 8 /* max. number of custom characters */
|
|
||||||
|
|
||||||
//typedef enum {
|
|
||||||
// standard, /* only char 0 is used for heartbeat */
|
|
||||||
// vbar, /* vertical bars */
|
|
||||||
// hbar, /* horizontal bars */
|
|
||||||
// custom, /* custom settings */
|
|
||||||
// bignum,
|
|
||||||
// } CGmode;
|
|
||||||
|
|
||||||
typedef struct driver_private_data {
|
typedef struct driver_private_data {
|
||||||
char device[200];
|
char device[200];
|
||||||
int fd;
|
int fd;
|
||||||
@@ -225,6 +214,7 @@ typedef struct driver_private_data {
|
|||||||
int brightness;
|
int brightness;
|
||||||
int customchars;
|
int customchars;
|
||||||
int ISO_8859_1;
|
int ISO_8859_1;
|
||||||
|
unsigned int refresh_timer;
|
||||||
unsigned char charmap[128];
|
unsigned char charmap[128];
|
||||||
int display_type;
|
int display_type;
|
||||||
char custom_char[31][7]; // used for "KD Rev 2.1" only
|
char custom_char[31][7]; // used for "KD Rev 2.1" only
|
||||||
@@ -245,10 +235,11 @@ MODULE_EXPORT int supports_multiple = 0;
|
|||||||
MODULE_EXPORT char *symbol_prefix = "serialVFD_";
|
MODULE_EXPORT char *symbol_prefix = "serialVFD_";
|
||||||
|
|
||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
static void serialVFD_init_vbar (Driver *drvthis);
|
void serialVFD_init_vbar (Driver *drvthis);
|
||||||
static void serialVFD_init_hbar (Driver *drvthis);
|
void serialVFD_init_hbar (Driver *drvthis);
|
||||||
static void serialVFD_draw_frame (Driver *drvthis, char *dat);
|
void serialVFD_draw_frame (Driver *drvthis, char *dat);
|
||||||
|
void serialVFD_put_brightness (Driver *drvthis);
|
||||||
|
void serialVFD_put_char (Driver *drvthis, int n);
|
||||||
|
|
||||||
// Opens com port and sets baud correctly...
|
// Opens com port and sets baud correctly...
|
||||||
//
|
//
|
||||||
@@ -257,7 +248,6 @@ serialVFD_init (Driver *drvthis)
|
|||||||
{
|
{
|
||||||
struct termios portset;
|
struct termios portset;
|
||||||
int tmp, w, h, brightness;
|
int tmp, w, h, brightness;
|
||||||
// int reboot = 0;
|
|
||||||
char size[200] = DEFAULT_SIZE;
|
char size[200] = DEFAULT_SIZE;
|
||||||
|
|
||||||
PrivateData *p;
|
PrivateData *p;
|
||||||
@@ -274,6 +264,7 @@ serialVFD_init (Driver *drvthis)
|
|||||||
p->cellheight = DEFAULT_CELL_HEIGHT;
|
p->cellheight = DEFAULT_CELL_HEIGHT;
|
||||||
p->ccmode = CCMODE_STANDARD;
|
p->ccmode = CCMODE_STANDARD;
|
||||||
p->ISO_8859_1 = 1;
|
p->ISO_8859_1 = 1;
|
||||||
|
p->refresh_timer = 0;
|
||||||
|
|
||||||
debug(RPT_INFO, "%s(%p)", __FUNCTION__, drvthis );
|
debug(RPT_INFO, "%s(%p)", __FUNCTION__, drvthis );
|
||||||
|
|
||||||
@@ -664,27 +655,36 @@ serialVFD_init (Driver *drvthis)
|
|||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
// Changes screen brightness (0-255; 140 seems good)
|
// Changes screen brightness (0 min ... 255 max ... 1000 also max)
|
||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
serialVFD_set_brightness (Driver *drvthis, int state, int brightness)
|
serialVFD_set_brightness (Driver *drvthis, int state, int brightness)
|
||||||
{
|
{ // set p->brightness
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
int realbrightness = -1;
|
|
||||||
|
|
||||||
if (brightness > 0) {
|
|
||||||
|
if (brightness > 0)
|
||||||
|
{
|
||||||
if (brightness > 255)
|
if (brightness > 255)
|
||||||
brightness = 255;
|
brightness = 255;
|
||||||
if (p->brightness != brightness)
|
if (p->brightness != brightness)
|
||||||
{
|
{
|
||||||
realbrightness = (int) (brightness / 64);
|
|
||||||
write (p->fd, &p->hw_cmd[realbrightness][1],\
|
|
||||||
p->hw_cmd[realbrightness][0]);
|
|
||||||
}
|
|
||||||
p->brightness=brightness;
|
p->brightness=brightness;
|
||||||
|
serialVFD_put_brightness (drvthis);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
serialVFD_put_brightness (Driver *drvthis)
|
||||||
|
{ // set hardware brightness
|
||||||
|
PrivateData *p = drvthis->private_data;
|
||||||
|
int realbrightness = (int) (p->brightness / 64);
|
||||||
|
//(4 steps 0-64, 65-128, 129-192, 193-1000)
|
||||||
|
|
||||||
|
write (p->fd, &p->hw_cmd[realbrightness][1],\
|
||||||
|
p->hw_cmd[realbrightness][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -723,7 +723,7 @@ serialVFD_hbar (Driver *drvthis, int x, int y, int len, int promille, int option
|
|||||||
//
|
//
|
||||||
MODULE_EXPORT void
|
MODULE_EXPORT void
|
||||||
serialVFD_set_char (Driver *drvthis, int n, char *dat)
|
serialVFD_set_char (Driver *drvthis, int n, char *dat)
|
||||||
{
|
{ //set char in p->custom_char
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
int letter=0;
|
int letter=0;
|
||||||
unsigned int byte, bit;
|
unsigned int byte, bit;
|
||||||
@@ -734,8 +734,6 @@ serialVFD_set_char (Driver *drvthis, int n, char *dat)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
if(p->display_type==1)
|
|
||||||
{
|
|
||||||
for (byte = 0;byte < p->usr_chr_dot_assignment[0]; byte++)
|
for (byte = 0;byte < p->usr_chr_dot_assignment[0]; byte++)
|
||||||
{
|
{
|
||||||
for (bit = 0;bit < 8; bit++)
|
for (bit = 0;bit < 8; bit++)
|
||||||
@@ -746,29 +744,26 @@ serialVFD_set_char (Driver *drvthis, int n, char *dat)
|
|||||||
p->custom_char[n][byte] = letter;
|
p->custom_char[n][byte] = letter;
|
||||||
letter = 0;
|
letter = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
write (p->fd, &p->hw_cmd[set_user_char][1],\
|
|
||||||
p->hw_cmd[set_user_char][0]);
|
|
||||||
|
|
||||||
write (p->fd, &p->usr_chr_mapping[n], 1);
|
if (p->display_type != 1) //not KD Rev 2.1
|
||||||
|
serialVFD_put_char (drvthis, n);
|
||||||
|
|
||||||
for (byte = 0;byte < p->usr_chr_dot_assignment[0]; byte++)
|
|
||||||
{
|
|
||||||
for (bit = 0;bit < 8; bit++)
|
|
||||||
{
|
|
||||||
if((int)p->usr_chr_dot_assignment[bit+8*byte+1] != 0)
|
|
||||||
letter |= (dat[(int)p->usr_chr_dot_assignment[bit+8*byte+1]-1] << bit);
|
|
||||||
}
|
|
||||||
write (p->fd, &letter, 1);
|
|
||||||
letter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (p->need_refresh == 1)
|
if (p->need_refresh == 1)
|
||||||
p->custom_char_changed[n]=1;
|
p->custom_char_changed[n]=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
serialVFD_put_char (Driver *drvthis, int n)
|
||||||
|
{ // put char in display
|
||||||
|
PrivateData *p = drvthis->private_data;
|
||||||
|
write (p->fd, &p->hw_cmd[set_user_char][1],\
|
||||||
|
p->hw_cmd[set_user_char][0]);// substitute and select Character to overwrite
|
||||||
|
write (p->fd, &p->usr_chr_mapping[n], 1);
|
||||||
|
write (p->fd, &p->custom_char[n][0], p->usr_chr_dot_assignment[0]);// overwrite selected Character
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
// Blasts a single frame onscreen, to the lcd...
|
// Blasts a single frame onscreen, to the lcd...
|
||||||
//
|
//
|
||||||
@@ -782,6 +777,30 @@ serialVFD_draw_frame (Driver *drvthis, char *dat)
|
|||||||
|
|
||||||
if (!dat)
|
if (!dat)
|
||||||
return;
|
return;
|
||||||
|
if (p->refresh_timer > 500) // Do a full refresh every 500 refreshs.
|
||||||
|
// With this it is possible to switch display on and off while lcdproc is running
|
||||||
|
{
|
||||||
|
write (p->fd, &p->hw_cmd[init_cmds][1],p->hw_cmd[init_cmds][0]);
|
||||||
|
serialVFD_put_brightness (drvthis); // restore brightness
|
||||||
|
|
||||||
|
for (i = 0; i < (p->height * p->width); i++)
|
||||||
|
p->backingstore[i]=0; // clear Backing-store
|
||||||
|
|
||||||
|
if (p->display_type != 1) //not KD Rev 2.1
|
||||||
|
{
|
||||||
|
for(i=0;i<p->customchars;i++) // refresh all customcharacters
|
||||||
|
serialVFD_put_char (drvthis, i);
|
||||||
|
/* {
|
||||||
|
write (p->fd, &p->hw_cmd[set_user_char][1],\
|
||||||
|
p->hw_cmd[set_user_char][0]);// substitute and select character to overwrite
|
||||||
|
write (p->fd, &p->usr_chr_mapping[i], 1);
|
||||||
|
write (p->fd, &p->custom_char[(int)dat[i]][0], p->usr_chr_dot_assignment[0]);// overwrite selected Character
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
p->refresh_timer = 0;
|
||||||
|
}
|
||||||
|
p->refresh_timer++;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < (p->height * p->width); i++)
|
for (i = 0; i < (p->height * p->width); i++)
|
||||||
{
|
{
|
||||||
@@ -809,20 +828,20 @@ serialVFD_draw_frame (Driver *drvthis, char *dat)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dat[i] >= 0 && dat[i] <= 30)
|
if(dat[i] >= 0 && dat[i] <= 30) // custom character
|
||||||
{
|
{
|
||||||
if (p->display_type == 1) // KD Rev 2.1 only
|
if (p->display_type == 1) // KD Rev 2.1 only
|
||||||
{
|
{
|
||||||
write (p->fd, "\x1A\xDB", 2); // substitute and select Character to overwrite (237)
|
write (p->fd, "\x1A\xDB", 2); // substitute and select character to overwrite (237)
|
||||||
write (p->fd, &p->custom_char[(int)dat[i]][0], 7);// overwrite selected Character
|
write (p->fd, &p->custom_char[(int)dat[i]][0], 7);// overwrite selected character
|
||||||
write (p->fd, "\xDB", 1); // Write Character
|
write (p->fd, "\xDB", 1); // write character
|
||||||
}
|
}
|
||||||
else // all other displays
|
else // all other displays
|
||||||
{
|
{
|
||||||
write (p->fd, &p->usr_chr_mapping[(int)dat[i]], 1);
|
write (p->fd, &p->usr_chr_mapping[(int)dat[i]], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(dat[i] < 0 && (p->ISO_8859_1 != 0))
|
else if(dat[i] < 0 && (p->ISO_8859_1 != 0)) // ISO_8859_1 translation for 129 ... 255
|
||||||
{
|
{
|
||||||
write (p->fd, &p->charmap[dat[i] + 128], 1);
|
write (p->fd, &p->charmap[dat[i] + 128], 1);
|
||||||
}
|
}
|
||||||
@@ -835,11 +854,11 @@ serialVFD_draw_frame (Driver *drvthis, char *dat)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_chr != -10)
|
if (last_chr != -10) // update backingstore if something changed
|
||||||
{
|
{
|
||||||
memcpy(p->backingstore, dat, p->height * p->width);
|
memcpy(p->backingstore, dat, p->height * p->width);
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<32;i++)
|
for(i=0;i<p->customchars;i++)
|
||||||
p->custom_char_changed[i]=0;
|
p->custom_char_changed[i]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -854,11 +873,12 @@ serialVFD_num( Driver * drvthis, int x, int num )
|
|||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
|
|
||||||
|
|
||||||
if (p->ccmode != CCMODE_BIGNUM)
|
if (p->ccmode != CCMODE_BIGNUM) // Are the customcharacters set up correctly? If not:
|
||||||
{
|
{
|
||||||
do_init=1;
|
do_init=1; // Lib_adv_bignum has to set the customcharacters.
|
||||||
p->ccmode = CCMODE_BIGNUM;
|
p->ccmode = CCMODE_BIGNUM; // Switch customcharactermode to bignum.
|
||||||
}
|
}
|
||||||
|
// Lib_adv_bignum does everything needed to show the bignumbers.
|
||||||
lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars);
|
lib_adv_bignum(drvthis, x, num, p->height, do_init, p->customchars);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -906,7 +926,6 @@ serialVFD_icon (Driver *drvthis, int x, int y, int icon)
|
|||||||
p->ccmode = CCMODE_STANDARD;
|
p->ccmode = CCMODE_STANDARD;
|
||||||
serialVFD_set_char(drvthis, 0, icons[0]);
|
serialVFD_set_char(drvthis, 0, icons[0]);
|
||||||
serialVFD_chr(drvthis, x, y, 0);
|
serialVFD_chr(drvthis, x, y, 0);
|
||||||
// serialVFD_chr(drvthis, x, y, 127 );
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -1; // Let the core do other icons
|
return -1; // Let the core do other icons
|
||||||
@@ -1196,6 +1215,6 @@ MODULE_EXPORT char *
|
|||||||
serialVFD_get_info (Driver *drvthis)
|
serialVFD_get_info (Driver *drvthis)
|
||||||
{
|
{
|
||||||
PrivateData *p = drvthis->private_data;
|
PrivateData *p = drvthis->private_data;
|
||||||
strcpy(p->info, "Driver for many serialVFDs from NEC(all FIPC based), Noritake, Futaba and the \"KD Rev2.1\"VFD");
|
strcpy(p->info, "Driver for many serialVFDs from NEC(all FIPC based), Noritake, Futaba and the \"KD Rev2.1\"VFD.");
|
||||||
return p->info;
|
return p->info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
Copyright (C) 2006 Stefan Herdler
|
Copyright (C) 2006 Stefan Herdler
|
||||||
|
|
||||||
This driver is based on drv_base.c, wirz-sli.c and hd44780 from LCDproc
|
This driver is based on wirz-sli.c, hd44780.c, drv_base.c and NoritakeVFD
|
||||||
0.4.5 and the NoritakeVFD driver from this package.
|
driver.
|
||||||
It may contain parts of other drivers of this package too.
|
It may contain parts of other drivers of this package too.
|
||||||
|
|
||||||
2006-01-26 Version 0.1: everything should work (not all hardware tested!)
|
2006-02-13 Version 0.2: everything should work (not all hardware tested!)
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
Reference in New Issue
Block a user