1 // ****************************************************************************
2 // main.c (C) 1992-2003 Christophe de Dinechin (ddd)
4 // ****************************************************************************
8 // Main entry point of the VFD800 control program
17 // ****************************************************************************
18 // This document is confidential.
19 // Do not redistribute without written permission
20 // ****************************************************************************
22 // * Revision : $Revision$
24 // ****************************************************************************
33 int main(int argc
, char **argv
)
34 // ----------------------------------------------------------------------------
35 // Entry point for the program
36 // ----------------------------------------------------------------------------
49 for (d
= 0; d
<= 256; d
++)
51 VFD_Brightness(.5 + .5 * d
/ 256.0);
52 for (y
= 0; y
< 4; y
++)
55 VFD_Command(AUTOINCX
);
56 for (x
= 0; x
< 160; x
++)
61 for (bright
= 1.0; bright
>= 0.0; bright
-= 0.1)
63 VFD_Brightness(bright
);
68 VFD_Text("abcdefghijklmnopqrstuvwxyz");
71 VFD_Text("J'aime Christine a la folie!");
73 for (bright
= 0.0; bright
<= 1.0; bright
+= 0.1)
75 VFD_Brightness(bright
);
84 time_t t
= time(NULL
);
85 float load1
, load2
, load3
;
87 FILE *f
= fopen("/proc/loadavg", "r");
89 // Display oscillating date/time
99 // Display load averages
100 fscanf(f
, "%f %f %f", &load1
, &load2
, &load3
);
108 for (l
= 0; l
< 120; l
++)
111 if (l1
>= l
) b
|= 0x07;
112 if (l2
>= l
) b
|= 0x1C;
113 if (l3
>= l
) b
|= 0x70;
117 // Display current fortune
118 for (s
= 0; s
< 2; s
++)
122 system ("/usr/games/fortune > /tmp/glop");
123 fortune
= fopen("/tmp/glop", "r");
141 memmove(fbytes
, fbytes
+1, 159);
142 fbytes
[159] = *fptr
++;
146 for (l
= 0; l
< 160; l
++)
160 // ----------------------------------------------------------------------------
161 // Show the character map
162 // ----------------------------------------------------------------------------
165 for (x
= 0; x
< 256; x
++)
168 for (y
= 0; y
< 6; y
++)
170 int byte
= VFD_Font
[x
][y
];
171 unsigned char z
= byte
;
172 if (0) for (d
= 0; d
< 8; d
++)
179 printf("0x%02X%s ", z
, y
< 5 ? "," : "");
181 printf("}%s /* 0x%02X %c */\n",
182 x
< 255 ? "," : " ", x
, isprint(x
) ? x
: ' ');