glk12232.h File Reference

#include <std.h>

Go to the source code of this file.

Data Structures

struct  metrics
 Structure for saving display related data. More...

Defines

#define GLK_RX_PIN   PIN_B2
 SmartITs standard pin for reading from the glk122323-25-SM.
#define GLK_STD_FONT_CHARS_PER_LINE   17
 define serial interface to LCD (see PICC compiler manual) the glk122323 built-in standard font uses17 chars per line
#define GLK_TX_PIN   PIN_B1
 SmartITs standard pin for writing to the glk122323-25-SM.
#define GLKSTREAM_SPEED   19200
 SmartITs standard speed setting for reading/writing from/to the glk12232-25-SM, see manual section 7.1.10.

Functions

void bargraph_init (int8 ref, int8 type, int8 x1, int8 y1, int8 x2, int8 y2)
void bargraph_write (int8 ref, int8 value)
void clear_display ()
void continue_line (int8 x, int8 y)
void display_bitmap (int8 ref, int8 x, int8 y)
void draw_line (int8 x1, int8 y1, int8 x2, int8 y2)
void draw_pixel (int8 x, int8 y)
void draw_rectangle_filled (int8 color, int8 x1, int8 y1, int8 x2, int8 y2)
void draw_rectangle_outlined (int8 color, int8 x1, int8 y1, int8 x2, int8 y2)
void enter_flowcontrol (int8 full_mark, int8 empty_mark)
void erase_file (int8 type, int8 ref)
void exit_flowcontrol ()
int8 get_module_type ()
int16 get_serial ()
int8 get_version ()
char * module_type_to_text (int8 type)
void purge_memory ()
void set_autoscroll (int1 on)
void set_backlight_off ()
void set_backlight_on (int8 minutes)
void set_contrast (int8 contrast)
void set_currentfont (int8 fontid)
void set_default_contrast (int8 contrast)
void set_drawingcolor (int8 color)
void set_fontmetrics (struct metrics fontmetrics)
void set_rs232_portspeed (int8 speed)
void set_serial (int8 serialnumber1, int8 serialnumber2)
void set_textinsertionpoint (int8 row, int8 col)
void set_textinsertionpoint_topleft ()
void upload_bitmap (int8 ref, int16 size, char *data_ptr)
void upload_font (int8 ref, int16 size, char *data_ptr)


Define Documentation

#define GLK_RX_PIN   PIN_B2
 

SmartITs standard pin for reading from the glk122323-25-SM.

Definition at line 30 of file glk12232.h.

#define GLK_STD_FONT_CHARS_PER_LINE   17
 

define serial interface to LCD (see PICC compiler manual) the glk122323 built-in standard font uses17 chars per line

Definition at line 45 of file glk12232.h.

#define GLK_TX_PIN   PIN_B1
 

SmartITs standard pin for writing to the glk122323-25-SM.

Definition at line 35 of file glk12232.h.

#define GLKSTREAM_SPEED   19200
 

SmartITs standard speed setting for reading/writing from/to the glk12232-25-SM, see manual section 7.1.10.

Definition at line 39 of file glk12232.h.


Function Documentation

void bargraph_init int8  ref,
int8  type,
int8  x1,
int8  y1,
int8  x2,
int8  y2
 

Sets aside space for a bar graph. x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
ref reference number (0-15) for use by the bargraph_write function
type one of 0 (vertical, starting at bottom), 1 (horizontal, starting from left), 2 (vertical, starting from top), 3 (horizontal, starting from right)
x1 x coordinate of the originating point.
y1 y coordinate of the originating point.
x2 x coordinate of the target point.
y2 y coordinate of the target point.

Definition at line 486 of file glk12232.h.

00487 {
00488         fprintf(GLKSTREAM, "%c%c%c%c%c%c%c%c", 254, 103, ref, type, x1, y1, x2, y2);            
00489 }

void bargraph_write int8  ref,
int8  value
 

Fills the bar graph. x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
ref reference number (0-15) for use by the bargraph_write function
value bar graph is filled from start to value (in pixels)

Definition at line 497 of file glk12232.h.

00498 {
00499         fprintf(GLKSTREAM, "%c%c%c%c", 254, 105, ref, value);           
00500 }

void clear_display  ) 
 

Clears the whole display.

Definition at line 120 of file glk12232.h.

00121 {
00122   fprintf(GLKSTREAM, "%c%c", 254, 88);
00123 }

void continue_line int8  x,
int8  y
 

Draws a line from coordinate the last coordinate to (x,y). x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
x x coordinate of the target point.
y y coordinate of the target point.

Definition at line 428 of file glk12232.h.

00429 {
00430         fprintf(GLKSTREAM, "%c%c%c%c", 254, 108, x,y);          
00431 }

void display_bitmap int8  ref,
int8  x,
int8  y
 

Displays the bitmap [ref] with its top left corner starting at [x][y]. x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
ref reference number of the bitmap
x x-coordinate of the upper left point of the bitmap
y y-coordinate of the upper left point of the bitmap

Definition at line 509 of file glk12232.h.

00510 {
00511         fprintf(GLKSTREAM, "%c%c%c%c%c", 254, 98, ref, x,y);            
00512 }

void draw_line int8  x1,
int8  y1,
int8  x2,
int8  y2
 

Draws a line from coordinate (x1,y1) to (x2,y2). x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
x1 x coordinate of the originating point.
y1 y coordinate of the originating point.
x2 x coordinate of the target point.
y2 y coordinate of the target point.

Definition at line 417 of file glk12232.h.

00418 {
00419         fprintf(GLKSTREAM, "%c%c%c%c%c%c", 254, 108, x1,y1,x2,y2);              
00420 }

void draw_pixel int8  x,
int8  y
 

Draws a pixel at (x,y). x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
x x coordinate of the pixel.
y y coordinate of the pixel.

Definition at line 439 of file glk12232.h.

00440 {
00441         fprintf(GLKSTREAM, "%c%c%c%c", 254, 112, x,y);          
00442 }

void draw_rectangle_filled int8  color,
int8  x1,
int8  y1,
int8  x2,
int8  y2
 

Draws a filled rectangle from coordinate (x1,y1) (upper left edge) to (x2,y2) (lower right edge) using color = color. x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
color 0 = white, 255 = black.
x1 x coordinate of the originating point.
y1 y coordinate of the originating point.
x2 x coordinate of the target point.
y2 y coordinate of the target point.

Definition at line 469 of file glk12232.h.

00470 {
00471         fprintf(GLKSTREAM, "%c%c%c%c%c%c%c", 254, 120, color, x1,y1,x2,y2);             
00472 }

void draw_rectangle_outlined int8  color,
int8  x1,
int8  y1,
int8  x2,
int8  y2
 

Draws an outlined rectangle from coordinate (x1,y1) (upper left edge) to (x2,y2) (lower right edge) using color = color. x values are in [0;31], y values are in [0;121]. Both values are decimal.

Parameters:
color 0 = white, 255 = black.
x1 x coordinate of the originating point.
y1 y coordinate of the originating point.
x2 x coordinate of the target point.
y2 y coordinate of the target point.

Definition at line 454 of file glk12232.h.

00455 {
00456         fprintf(GLKSTREAM, "%c%c%c%c%c%c%c", 254, 114, color, x1,y1,x2,y2);             
00457 }

void enter_flowcontrol int8  full_mark,
int8  empty_mark
 

Switches to flow control mode. By default, the flow control mode is off.

Parameters:
full_mark full mark for the display buffer. When buffer reaches [full_mark] the display will return 0xFE to the host.
empty_mark empty mark for the display buffer. When buffer reaches [empty_mark] the display will return 0xFF to the host.

Definition at line 254 of file glk12232.h.

00255 {
00256   fprintf(GLKSTREAM, "%c%c", full_mark, empty_mark);
00257 }

void erase_file int8  type,
int8  ref
 

Erases referenced file from memory.

Parameters:
type type of the file (1 = font, 5 = bitmap)
ref reference number of the file.

Definition at line 519 of file glk12232.h.

00520 {
00521         fprintf(GLKSTREAM, "%c%c%c%c", 254, 45, type, ref);             
00522 }

void exit_flowcontrol  ) 
 

Switch off flow control mode (this is the default).

Definition at line 262 of file glk12232.h.

00263 {
00264   fprintf(GLKSTREAM, "%c%c", 254, 59);
00265 }

int8 get_module_type  ) 
 

Reads the module type.

Returns:
module type or zero (0) on error.

Definition at line 164 of file glk12232.h.

00165 {
00166   int8 modtype;
00167   modtype = 0;
00168   
00169   fprintf(GLKSTREAM, "%c%c", 254, 55);
00170   if (kbhit())
00171   {
00172     modtype = getc();
00173   }
00174 
00175   return modtype;
00176 }

int16 get_serial  ) 
 

Returns the serial number of the module

Returns:
the 16bit value contains the first byte of the serial number in the upper 8 bits and the second byte of the serial number in the lower 8 bits. Make sure to split the returned 16bit int correctly in two 8 bit ints. int8 high,low; high=low=0; high = (returned_value >> 8) || high; low = returned_value || low;

Definition at line 287 of file glk12232.h.

00288 {
00289         int8 serialnumber1; 
00290         int8 serialnumber2; 
00291         int16 serialnumber;
00292         serialnumber1 = 0;
00293         serialnumber2 = 0;
00294         serialnumber = 0;
00295   fprintf(GLKSTREAM, "%c%c", 254, 70);
00296   if (kbhit())
00297   {
00298     serialnumber1 = getc();
00299   }
00300   if (kbhit())
00301   {
00302     serialnumber2 = getc();
00303   }
00304         serialnumber = ( (serialnumber || serialnumber1) << 8) || serialnumber2;
00305         return serialnumber;
00306 }

int8 get_version  ) 
 

Reads the firmware type.

Returns:
firmware version or zero (0) on error.

Definition at line 312 of file glk12232.h.

00313 {
00314   int8 version;
00315   version = 0;
00316   
00317   fprintf(GLKSTREAM, "%c%c", 254, 54);
00318   if (kbhit())
00319   {
00320     version = getc();
00321   }
00322 
00323   return version;
00324 }

char * module_type_to_text int8  type  ) 
 

Translates the module type returned by get_moduletype() into plain text.

Parameters:
type module type to be translated into plain text

Definition at line 649 of file glk12232.h.

00650 {
00651         char module_name[];
00652         char unknown[] = "unknown";
00653         char *names[28];
00654         char name1[] = "LCD0821";
00655         char name2[] = "LCD2021";
00656         char name3[] = "LCD1641";
00657         char name4[] = "LCD2041";
00658         char name5[] = "LCD4021";
00659         char name6[] = "LCD4041";
00660         char name7[] = "LK202-25";
00661         char name8[] = "LK204-25";
00662         char name9[] = "LK404-55";
00663         char name10[] = "VFD2021";
00664         char name11[] = "VFD2041";
00665         char name12[] = "VFD4021";
00666         char name13[] = "VK202-25";
00667         char name14[] = "VK204-25";
00668         char name15[] = "GLC12232";
00669         char name16[] = "GLC12864";
00670         char name17[] = "GLC128128";
00671         char name18[] = "GLC24064";
00672         char name19[] = "GLK12864-25";
00673         char name20[] = "GLK24064-25";
00674         char name21[] = "GLK128128-25";
00675         char name22[] = "GLK12232-25";
00676         char name23[] = "LK404-AT";
00677         char name24[] = "VFD1621";
00678         char name25[] = "LK402-12";
00679         char name26[] = "LK162-12";
00680         char name27[] = "LK204-25PC";
00681         char name28[] = "GLK12232-25-SM";
00682 
00683         names[0] = name1;
00684         names[1] = name2;
00685         names[2] = name3;
00686         names[3] = name4;
00687         names[4] = name5;
00688         names[5] = name6;
00689         names[6] = name7;
00690         names[7] = name8;
00691         names[8] = name9;
00692         names[9] = name10;
00693         names[10] = name11;
00694         names[11] = name12;
00695         names[12] = name13;
00696         names[13] = name14;
00697         names[14] = name15;
00698         names[15] = name16;
00699         names[16] = name17;
00700         names[17] = name18;
00701         names[18] = name19;                                                                                                                             
00702         names[19] = name20;
00703         names[20] = name21;
00704         names[21] = name22;
00705         names[22] = name23;
00706         names[23] = name24;
00707         names[24] = name25;
00708         names[25] = name26;
00709         names[26] = name27;
00710         names[27] = name28;
00711 
00712 
00713         switch (type)
00714         {
00715                 case 0x01:{                             module_name = name1;            }
00716                 case 0x03:{                             module_name = name2;            }
00717                 case 0x04:{                     module_name = name3;            }
00718                 case 0x05:{                             module_name = name4;            }
00719                 case 0x06:{                     module_name = name5;            }
00720                 case 0x07:{                     module_name = name6;            }
00721                 case 0x08:{                     module_name = name7;            }
00722                 case 0x09:{                             module_name = name8;    }
00723                 case 0x0A:{                             module_name = name9;            }
00724                 case 0x0B:{                             module_name = name10;           }
00725                 case 0x0C:{                             module_name = name11;           }
00726                 case 0x0D:{                             module_name = name12;           }
00727                 case 0x0E:{                     module_name = name13;           }
00728                 case 0x0F:{                     module_name = name14;           }
00729                 case 0x10:{                             module_name = name15;           }
00730                 case 0x11:{                             module_name = name16;           }
00731                 case 0x12:{                     module_name = name17;           }
00732                 case 0x13:{                             module_name = name18;           }
00733                 case 0x14:{                             module_name = name19;           }
00734                 case 0x15:{                             module_name = name20;           }
00735                 case 0x21:{                             module_name = name21;           }
00736                 case 0x22:{                             module_name = name22;           }
00737                 case 0x31:{                             module_name = name23;           }
00738                 case 0x32:{                             module_name = name24;           }
00739                 case 0x33:{                             module_name = name25;           }
00740                 case 0x34:{                             module_name = name26;           }
00741                 case 0x35:{                             module_name = name27;           }
00742         case 0x24:{                             module_name = name28;           }
00743                 default:
00744                 {
00745                         module_name = unknown;
00746                 }
00747         }
00748         return(module_name);
00749 }

void purge_memory  ) 
 

Purges complete memory. All fonts, font metrics, bitmaps and settings are removed. So be very careful, without a font, no text will be displayed! Be sure to have a working (own) font BEFORE you do use this.

Definition at line 529 of file glk12232.h.

00530 {
00531         fprintf(GLKSTREAM, "%c%c%c%c", 254, 33, 89, 33);                
00532 }

void set_autoscroll int1  on  ) 
 

Reads the firmware type.

Parameters:
on sets autoscrolling property of the display, if on = 1 (true), then autoscrolling is enabled (default state), if on = 0 (false), then autoscrolling is disabled. if on != 1 && on != 0 -> on = 1

Definition at line 332 of file glk12232.h.

00333 {
00334         if (on == 1) 
00335         {
00336                 fprintf(GLKSTREAM, "%c%c", 254, 81);
00337         }
00338         else if (on == 0)
00339         {
00340                 fprintf(GLKSTREAM, "%c%c", 254, 82);
00341         }
00342         else
00343         {
00344                 fprintf(GLKSTREAM, "%c%c", 254, 81);
00345         }       
00346 }

void set_backlight_off  ) 
 

Switch the backlight off.

Definition at line 155 of file glk12232.h.

00156 {
00157   fprintf(GLKSTREAM, "%c%c", 254, 70);
00158 }

void set_backlight_on int8  minutes  ) 
 

Switch the backlight on for [minutes]. Zero (0) means that backlight stays on forever.

Definition at line 147 of file glk12232.h.

00148 {
00149   fprintf(GLKSTREAM, "%c%c%c", 254, 66, minutes);
00150 }

void set_contrast int8  contrast  ) 
 

Sets display contrast.

Parameters:
contrast must be between 0 and 255; larger means darker.

Definition at line 129 of file glk12232.h.

00130 {
00131   fprintf(GLKSTREAM, "%c%c%c", 254, 80, contrast);
00132 }

void set_currentfont int8  fontid  ) 
 

Sets the font to be used. The standard font (unless overwritten) has id = 1. The standard font has 5x7 pixels.

Parameters:
fontid id of the font to be used. font id = fontid has to be in the glk12232-sm-25 memory!

Definition at line 372 of file glk12232.h.

Referenced by upload_bitmap(), and upload_font().

00373 {
00374         fprintf(GLKSTREAM, "%c%c%c", 254, 49, fontid);  
00375 }       

void set_default_contrast int8  contrast  ) 
 

Sets display contrast and saves it as default.

Parameters:
contrast must be between 0 and 255; larger means darker.

Definition at line 138 of file glk12232.h.

00139 {
00140   fprintf(GLKSTREAM, "%c%c%c", 254, 91, contrast);
00141 }

void set_drawingcolor int8  color  ) 
 

Sets the drawing color (in grey scale).

Parameters:
color 0 = white, 255 = black

Definition at line 404 of file glk12232.h.

00405 {
00406         fprintf(GLKSTREAM, "%c%c%c", 254, 99, color);           
00407 }

void set_fontmetrics struct metrics  fontmetrics  ) 
 

Sets the font metrics to be used.

Parameters:
fontmetrics metrics structure

Definition at line 381 of file glk12232.h.

References metrics::left_margin, metrics::scroll_row, metrics::top_margin, metrics::x_space, and metrics::y_space.

00382 {
00383         /*
00384         struct metrics{
00385         int8 left_margin;
00386         int8 top_margin;
00387         int8 x_space;
00388         int8 y_space;
00389         int8 scroll_row;
00390         };
00391         */
00392         fprintf(GLKSTREAM, "%c%c%c%c%c%c%c", 254, 50,
00393          fontmetrics.left_margin,
00394          fontmetrics.top_margin,
00395          fontmetrics.x_space,
00396          fontmetrics.y_space,
00397          fontmetrics.scroll_row);
00398 }       

void set_rs232_portspeed int8  speed  ) 
 

Set rs232 port speed.

Parameters:
speed is either 0x20 (9600 baud), 0x0F (19200 baud, default), 0x95 (57600 baud), 0x03 (76800 baud) or 0x8A (115200 - attention, according to the glk12232-25-sm manual, section 7.1.10, the speed is 115000 and not 115200!) If speed is unknown, the standard speed is used.

Definition at line 185 of file glk12232.h.

00186 {
00187         int8 recognized_speed = 0x0F;
00188         switch(speed) {
00189                 // 9600 baud
00190                 case 0x20: recognized_speed = 0x20; break; 
00191                 // 19200 baud
00192                 case 0x0f: recognized_speed = 0x0f; break;
00193                 // 57600 baud
00194                 case 0x95: recognized_speed = 0x95; break;
00195                 // 76800 baud
00196                 case 0x03: recognized_speed = 0x03; break;
00197                 // 115200 baud ?
00198                 case 0x8A: recognized_speed = 0x8A; break;
00199                 default: 
00200                 {
00201                         // failsafe default
00202                         recognized_speed = 0x0f;
00203                 }       
00204         }
00205         // sets the new speed
00206         fprintf(GLKSTREAM, "%c%c%c", 254, 57, recognized_speed);
00207         // defines the new stream
00208 
00209         switch(recognized_speed) {
00210                 // 9600 baud
00211                 case 0x20:
00212                 {
00213                   #use rs232(baud=9600,xmit=GLK_RX_PIN,rcv=GLK_TX_PIN, STREAM=GLKSTREAM)                        
00214                         break;  
00215                 }
00216                 // 19200 baud
00217                 case 0x0f: 
00218                 {
00219                   #use rs232(baud=19200,xmit=GLK_RX_PIN,rcv=GLK_TX_PIN, STREAM=GLKSTREAM)                       
00220                         break;  
00221                 }
00222                 // 57600 baud
00223                 case 0x95: 
00224                 {
00225                   #use rs232(baud=57600,xmit=GLK_RX_PIN,rcv=GLK_TX_PIN, STREAM=GLKSTREAM)                       
00226                         break;  
00227                 }
00228                 // 76800 baud
00229                 case 0x03:
00230                 {
00231                   #use rs232(baud=76800,xmit=GLK_RX_PIN,rcv=GLK_TX_PIN, STREAM=GLKSTREAM)                       
00232                         break;  
00233                 }
00234                 // 115200 baud ?
00235                 case 0x8A:
00236                 {
00237                   #use rs232(baud=115200,xmit=GLK_RX_PIN,rcv=GLK_TX_PIN, STREAM=GLKSTREAM)                      
00238                         break;  
00239                 }
00240                 default: 
00241                 {
00242                   #use rs232(baud=19200,xmit=GLK_RX_PIN,rcv=GLK_TX_PIN, STREAM=GLKSTREAM)                       
00243                 }       
00244         }       
00245 }

void set_serial int8  serialnumber1,
int8  serialnumber2
 

Sets the serial number. This is a one-time-use-function. It has no effect if the serial number is already set. Some modules ship with no serial number set.

Parameters:
serialnumber1 first byte of the two byte serial number
serialnumber2 second byte of the two byte serial number

Definition at line 274 of file glk12232.h.

00275 {
00276   fprintf(GLKSTREAM, "%c%c%c%c", 254, 34, serialnumber1, serialnumber2);
00277 }

void set_textinsertionpoint int8  row,
int8  col
 

Sets the text insertion point according to the currently used font.

Parameters:
col column to set the insertion point to, the standard font has a width of 17
row row to set the insertion point to

Definition at line 353 of file glk12232.h.

00354 {
00355   fprintf(GLKSTREAM, "%c%c%c%c", 254, 71, row, col);    
00356 }

void set_textinsertionpoint_topleft  ) 
 

Sets the text insertion point to the top left corner.

Definition at line 361 of file glk12232.h.

00362 {
00363         fprintf(GLKSTREAM, "%c%c", 254, 72);    
00364 }

void upload_bitmap int8  ref,
int16  size,
char *  data_ptr
 

Uploads a bitmap into memory to be stored there permanently. On [ref]=1 lies the standard image which is displayed on power-up.

ATTENTION: bitmap size > 255 byte do currently not work.

Parameters:
ref reference number of the file.
size of the file.
data_ptr pointer to char array containing the bitmap data.

Definition at line 544 of file glk12232.h.

References set_currentfont().

00545 {
00546         int16 lower_byte, higher_byte;
00547         int16 bitmask1, bitmask2; //fontfilesize
00548 
00549   // bitmask for clearing the high byte 
00550   bitmask1 = 0x00FF;
00551   bitmask2 = 0xFF00;
00552   lower_byte = (size & bitmask1);
00553   higher_byte = (size & bitmask2);
00554         
00555   set_currentfont(1);
00556         
00557         fprintf(GLKSTREAM, "%c%c%c", 254,94,ref);
00558         // read confirmation byte for reference
00559   ref = fgetc(GLKSTREAM); 
00560   // send confirmation byte for correct received reference
00561   fprintf(GLKSTREAM, "%c", 0x01); 
00562         // send low size in16 (lower byte of file size)
00563   fprintf(GLKSTREAM, "%c", lower_byte);// 27 im testbeispiel
00564         // read confirmation byte for lower byte size
00565   ref = fgetc(GLKSTREAM); 
00566   // send confirmation byte for correct received lower byte size
00567   fprintf(GLKSTREAM, "%c", 0x01); 
00568         // send high size int16 ( higher byte of file size)
00569   fprintf(GLKSTREAM, "%c", higher_byte); // 0x00 im testbeispiel
00570         // read confirmation byte for higher byte size
00571   ref = fgetc(GLKSTREAM); 
00572         
00573         // read confirmation byte for "file fits into memory"
00574         ref = fgetc(GLKSTREAM); 
00575   // if file fits, ref = 0x01, else ref = 0x08
00576 
00577         for (lower_byte=0; lower_byte < size; lower_byte++) 
00578         {
00579                 // transmit one byte
00580                 fprintf(GLKSTREAM, "%c", data_ptr[lower_byte]);
00581                 // confirm correct transmission of one sent byte
00582                 ref = fgetc(GLKSTREAM); 
00583                 // confirm confirmation
00584                 fprintf(GLKSTREAM, "%c", 0x01);
00585         }
00586         
00587 }

void upload_font int8  ref,
int16  size,
char *  data_ptr
 

Uploads a font definition into memory. Be aware of the fact, that only these characters will be displayed which have been uploaded before. Others will simply not be printed!

ATTENTION: font size>255 byte do currently not work.

Parameters:
ref reference number of the font.
size of the file.
data_ptr pointer to char array containing the font data.

Definition at line 600 of file glk12232.h.

References set_currentfont().

00601 {
00602         int16 lower_byte, higher_byte;
00603         int16 bitmask1, bitmask2; //fontfilesize
00604 
00605   // bitmask for clearing the high byte 
00606   bitmask1 = 0x00FF;
00607   bitmask2 = 0xFF00;
00608   lower_byte = (size & bitmask1);
00609   higher_byte = (size & bitmask2);
00610         
00611   set_currentfont(1);
00612         
00613         fprintf(GLKSTREAM, "%c%c%c", 254,36,ref);
00614         // read confirmation byte for reference
00615   ref = fgetc(GLKSTREAM); 
00616   // send confirmation byte for correct received reference
00617   fprintf(GLKSTREAM, "%c", 0x01); 
00618         // send low size in16 (lower byte of file size)
00619   fprintf(GLKSTREAM, "%c", lower_byte);// 27 im testbeispiel
00620         // read confirmation byte for lower byte size
00621   ref = fgetc(GLKSTREAM); 
00622   // send confirmation byte for correct received lower byte size
00623   fprintf(GLKSTREAM, "%c", 0x01); 
00624         // send high size int16 ( higher byte of file size)
00625   fprintf(GLKSTREAM, "%c", higher_byte); // 0x00 im testbeispiel
00626         // read confirmation byte for higher byte size
00627   ref = fgetc(GLKSTREAM); 
00628         
00629         // read confirmation byte for "file fits into memory"
00630         ref = fgetc(GLKSTREAM); 
00631   // if file fits, ref = 0x01, else ref = 0x08
00632 
00633         for (lower_byte=0; lower_byte < size; lower_byte++) 
00634         {
00635                 // transmit one byte
00636                 fprintf(GLKSTREAM, "%c", data_ptr[lower_byte]);
00637                 // confirm correct transmission of one sent byte
00638                 ref = fgetc(GLKSTREAM); 
00639                 // confirm confirmation
00640                 fprintf(GLKSTREAM, "%c", 0x01);
00641         }
00642         
00643 }


Generated on Tue Nov 30 09:16:49 2004 for Smart-Its Headers by  doxygen 1.3.9.1