draw.h File Reference

Buffered graphics routines. More...

Include dependency graph for draw.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define BOTTOM_LEFT   1
#define draw_paint()   drv_paint()
#define DRAW_PIXELS_PER_BYTE   (8 / DRAW_BITS_PER_PIXEL)
#define draw_set_display_brightness(brightness)   drv_set_display_brightness(brightness)
#define drv_setup()   drv_setup_io()
#define HORIZONTAL   0
#define TOP_LEFT   0
#define VERTICAL   1

Functions

void draw_bitmap (uns8 x, uns8 y, uns8 colour, char *bitmap)
void draw_circle (int x_centre, int y_centre, int r, uns8 colour)
void draw_circle2 (int x_centre, int y_centre, int r, uns8 colour)
void draw_clear_screen ()
uns8 draw_get_pixel (uns8 x, uns8)
void draw_init ()
uns16 draw_length_str (char *str)
void draw_line (uns8 x0, uns8 y0, uns8 x1, uns8 y1, uns8 colour)
void draw_print_buffer ()
void draw_print_str (uns8 x, uns8 y, uns8 width, uns8 start_pixel, uns8 colour, char *str)
void draw_rect (uns8 x, uns8 y, uns16 width, uns8 height, uns8 colour)
void draw_set_pixel (uns8 x, uns8 y, uns8 colour)
void draw_setup_io ()
void drv_init ()
void drv_paint ()
void drv_print_buffer ()
void drv_refresh ()
void drv_set_display_brightness (uns8 brightness)
void drv_setup_io ()

Detailed Description

You will need to pick a hardware buffering mode for the draw routines.

Draw buffer addressing

4 | U V W X Y 3 | P Q R S T 2 | K L M N O 1 | F G H I J 0 | A B C D E --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == BOTTOM_LEFT DRAW_HW_BUFFER_ORIENTATION == HORIZONTAL

0 | A B C D E 1 | F G H I J 2 | K L M N O 3 | P Q R S T 4 | U V W X Y --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == TOP_LEFT DRAW_HW_BUFFER_ORIENTATION == HORIZONTAL

0 | E J O T Y 1 | D I N S X 2 | C H M R W 3 | B G L Q V 4 | A F K P U --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == BOTTOM_LEFT DRAW_HW_BUFFER_ORIENTATION == VERTICAL

0 | A F K P U 1 | B G L Q V 2 | C H M R W 3 | D I N S X 4 | E J O T Y --------- 0 1 2 3 4 DRAW_HW_Y_ORIGIN == TOP_LEFT DRAW_HW_BUFFER_ORIENTATION == VERTICAL

Put the following in your config.h:

// - - - - - - - - - - - - - - - - - - - - 
// Draw defines
// - - - - - - - - - - - - - - - - - - - - 

#define DRAW_PIXELS_HIGH 24
#define DRAW_PIXELS_WIDE 16
#define DRAW_BITS_PER_PIXEL 1

#define DRAW_HW_Y_ORIGIN TOP_LEFT
// or BOTTOM_LEFT

#define DRAW_HW_BUFFER_ORIENTATION VERTICAL
// or HORIZONTAL

//Enable debug to see what's happening under the hood
//#define DRAW_DEBUG

// - - - - - - - - - - - - - - - - - - - - 

Define Documentation

#define BOTTOM_LEFT   1
 
#define draw_paint (  )     drv_paint()
#define DRAW_PIXELS_PER_BYTE   (8 / DRAW_BITS_PER_PIXEL)
#define draw_set_display_brightness ( brightness   )     drv_set_display_brightness(brightness)
 
#define drv_setup (  )     drv_setup_io()
#define HORIZONTAL   0
#define TOP_LEFT   0
#define VERTICAL   1

Function Documentation

void draw_bitmap ( uns8  x,
uns8  y,
uns8  colour,
char *  bitmap 
)

00593                                                             {
00594 
00595 
00596 uns8 bitpos = 0;
00597 uns8 bytepos = 0;
00598 uns8 value;
00599 uns8 bitmap_width = bitmap[0];
00600 uns8 bitmap_height = bitmap[1];
00601 uns8 bitmap_bpp = bitmap[2];
00602 uns8 xbitmap, ybitmap;
00603 
00604 
00605     bytepos = 3;    // first byte of data - 1
00606     bitpos = 0b10000000;    // left most bit
00607     
00608     for (xbitmap = 0; xbitmap < bitmap_width; xbitmap++) {
00609         for (ybitmap = 0; ybitmap < bitmap_height; ybitmap++) {
00610             if (bitpos == 0b10000000) {
00611                 bitpos = 0b00000001;
00612                 bytepos++;
00613                 value = bitmap[bytepos];
00614             } else {
00615                 bitpos = bitpos << 1;
00616             }
00617             if (value & bitpos) {
00618                 #if DRAW_HW_Y_ORIGIN == TOP_LEFT
00619                     draw_set_pixel(x + xbitmap, y + ybitmap, colour);
00620                 #else
00621                     draw_set_pixel(x + xbitmap, y - ybitmap, colour);
00622                 #endif
00623             }
00624         }   
00625     }   
00626 }    

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_circle ( int  x_centre,
int  y_centre,
int  r,
uns8  colour 
)

00392                                                                  {
00393     int x,y;
00394     int p = 1 - r;         // Initial value of decision parameter.
00395 
00396     x = 0;
00397     y = r;
00398     
00399     draw_circle_points(x_centre, y_centre, x, y, 2);
00400 
00401     while (x < y) {
00402         x++;
00403         if (p < 0)
00404             p += 2 * x + 1;
00405         else {
00406             y--;
00407             p += 2 * (x - y + 1);
00408         }
00409         draw_circle_points (x_centre, y_centre, x, y, colour);
00410     }
00411 
00412 }

Here is the call graph for this function:

void draw_circle2 ( int  x_centre,
int  y_centre,
int  r,
uns8  colour 
)

00428                                                                   {
00429     int x, y;
00430     //int p = 1 - r; // orig
00431     //int p = 3 - 2*r;         // (a) Initial value of decision parameter.
00432     //int p = 1-r; // (b)
00433     int p = 1 -r; // (c) 5//4 - r  
00434     x = 0;
00435     y = r;
00436     
00437     draw_circle_points2(x_centre, y_centre, x, y, colour);
00438 
00439     while (x < y) {
00440         x++;
00441         if (p < 0)
00442             //p += 2 * x + 2; // (orig)
00443             //p = p + (4 * x) + 6; // (a)
00444             //p = p + 2* x + 3; // (b)
00445             p = p + 2* x + 1; // (c)
00446         else {
00447             y--;
00448             //p += 2 * (x - y + 1); // (orig)
00449             // p = p + 4 * (x - y) + 10; // (a)
00450             //p = p + 2 * (x - y) + 5;
00451             p = p + 2*(x-y) + 1;
00452         }
00453         draw_circle_points2 (x_centre, y_centre, x, y, colour);
00454     }
00455 
00456 }

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_clear_screen (  ) 

00049                          {
00050 
00051 uns8 count;
00052     #if DRAW_TOTAL_BUFFER_SIZE == 1024 | DRAW_TOTAL_BUFFER_SIZE == 768 | DRAW_TOTAL_BUFFER_SIZE == 512 | DRAW_TOTAL_BUFFER_SIZE == 256
00053         count = 0;
00054         do {
00055             draw_buffer0[count] = 0;
00056             #if DRAW_TOTAL_BUFFER_SIZE > 256
00057                 draw_buffer1[count] = 0;
00058                 #if DRAW_TOTAL_BUFFER_SIZE > 512
00059                     draw_buffer2[count] = 0;
00060                     #if DRAW_TOTAL_BUFFER_SIZE > 768
00061                         draw_buffer3[count] = 0;
00062                     #endif
00063                 #endif
00064             #endif
00065             count++;
00066         } while (count != 0);
00067     #else
00068         #if DRAW_TOTAL_BUFFER_SIZE < 256
00069             count = 0;
00070             do {
00071                 draw_buffer0[count] = 0;
00072                 count++;
00073             } while (count < DRAW_TOTAL_BUFFER_SIZE);
00074         #else
00075             count = 0;
00076             do {
00077                 draw_buffer0[count] = 0;
00078                 count++;
00079             } while (count != 0);
00080             #if DRAW_TOTAL_BUFFER_SIZE < 512
00081                 do {
00082                     draw_buffer1[count] = 0;
00083                     count++;
00084                 } while (count < DRAW_TOTAL_BUFFER_SIZE - 256);
00085             #else
00086                 do {
00087                     draw_buffer1[count] = 0;
00088                     count++;
00089                 } while (count != 0);
00090                 #if DRAW_TOTAL_BUFFER_SIZE > 512
00091                     #if DRAW_TOTAL_BUFFER_SIZE < 768
00092                         do {
00093                             draw_buffer2[count] = 0;
00094                             count++;
00095                         } while (count < DRAW_TOTAL_BUFFER_SIZE - 512);
00096                     #else
00097                         // > 768
00098                         do {
00099                             draw_buffer2[count] = 0;
00100                             count++;
00101                         } while (count != 0);
00102                         
00103                         #if DRAW_TOTAL_BUFFER_SIZE < 1024
00104                             do {
00105                                 draw_buffer3[count] = 0;
00106                                 count++;
00107                             } while (count < DRAW_TOTAL_BUFFER_SIZE - 768);
00108                         #else
00109                             do {
00110                                 draw_buffer3[count] = 0;
00111                                 count++;
00112                             } while (count != 0);
00113                         #endif
00114                     #endif  
00115                 #endif
00116                 
00117             #endif      
00118             
00119         #endif
00120     #endif
00121 
00122 }

Here is the caller graph for this function:

uns8 draw_get_pixel ( uns8  x,
uns8   
)

00248                                     {
00249     return 0;
00250 }   

void draw_init (  ) 

00128                  {
00129     drv_init();
00130     draw_clear_screen();
00131 }   

Here is the call graph for this function:

uns16 draw_length_str ( char *  str  ) 

00516                                  {
00517 uns8 my_char;
00518 uns16 length;
00519 
00520     length = 0;
00521     while (*str != 0) {
00522         my_char = *str;
00523         my_char = my_char - 32;
00524         length = length + (PicPack5x7_index[my_char + 1] - PicPack5x7_index[my_char]) + 1;
00525         str++;
00526     }
00527     length = length - 1;    // no space at the end
00528     return length;
00529 }   

void draw_line ( uns8  x0,
uns8  y0,
uns8  x1,
uns8  y1,
uns8  colour 
)

00309                                                                 {
00310 
00311     int dy = y1 - y0;
00312     int dx = x1 - x0;
00313     int stepx, stepy;
00314 
00315     if (dy < 0) { dy = -dy;  stepy = -1; } else { stepy = 1; }
00316     if (dx < 0) { dx = -dx;  stepx = -1; } else { stepx = 1; }
00317     dy <<= 1;                                                  // dy is now 2*dy
00318     dx <<= 1;                                                  // dx is now 2*dx
00319 
00320     draw_set_pixel(x0, y0, colour);
00321     if (dx > dy) {
00322         int fraction = dy - (dx >> 1);                         // same as 2*dy - dx
00323         while (x0 != x1) {
00324             if (fraction >= 0) {
00325                 y0 += stepy;
00326                 fraction -= dx;                                // same as fraction -= 2*dx
00327             }
00328             x0 += stepx;
00329             fraction += dy;                                    // same as fraction -= 2*dy
00330             draw_set_pixel(x0, y0, colour);
00331         }
00332     } else {
00333         int fraction = dx - (dy >> 1);
00334         while (y0 != y1) {
00335             if (fraction >= 0) {
00336                 x0 += stepx;
00337                 fraction -= dy;
00338             }
00339             y0 += stepy;
00340             fraction += dx;
00341             draw_set_pixel(x0, y0, colour);
00342         }
00343     }
00344 }

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_print_buffer (  ) 

00268                          {
00269 #ifdef DRAW_DEBUG
00270 uns8    inv_y, x , y,
00271          byte_loc, bit_loc;
00272 uns16    buffer_loc;
00273 
00274     for(y = 0 ; y < DRAW_PIXELS_HIGH ; y++) {
00275         inv_y = DRAW_PIXELS_HIGH - 1 - y; // need to print out from the top
00276         if (inv_y < 10) {
00277             serial_putc('0');
00278         }
00279         serial_print_int(inv_y);
00280         serial_putc(' ');
00281         serial_print_int_hex(inv_y * DRAW_PIXELS_WIDE / DRAW_PIXELS_PER_BYTE);
00282         serial_putc('|');
00283         for(x = 0 ; x < DRAW_PIXELS_WIDE  ; x++) {
00284             buffer_loc = inv_y * DRAW_PIXELS_WIDE + x;
00285             byte_loc = buffer_loc / DRAW_PIXELS_PER_BYTE;
00286             bit_loc = buffer_loc & (DRAW_PIXELS_PER_BYTE -1);
00287 
00288             //if (bit_loc == 0) {
00289             //  serial_putc(' ');
00290             //  serial_print_int_hex(byte_loc);
00291             //  serial_putc(' ');
00292             //} 
00293             
00294             if (test_bit(draw_buffer0[byte_loc], bit_loc)) {
00295                 
00296                     serial_putc('1');
00297                     
00298             } else {
00299                 serial_putc('0');
00300             }
00301         }
00302         
00303         serial_print_str("|\n");
00304         
00305     }
00306 #endif  
00307 }           

Here is the call graph for this function:

void draw_print_str ( uns8  x,
uns8  y,
uns8  width,
uns8  start_pixel,
uns8  colour,
char *  str 
)

00531                                                                                           {
00532 
00533 uns8 my_char;
00534 uns16 index_pos;
00535 uns16 index_pos_next;
00536 uns16 count, s_count;
00537 uns8 sliver, x_origin, y_origin, pixel;
00538     y_origin = y;
00539     x_origin = x;
00540     pixel = 0;
00541     while (*str != 0) {
00542         // first look up character in index
00543         my_char = *str;
00544         my_char = my_char - 32;
00545 
00546 
00547         index_pos = PicPack5x7_index[my_char];
00548         index_pos_next = PicPack5x7_index[my_char + 1];
00549             for(count = index_pos ; count < index_pos_next ; count++) {
00550                 if (count < 256) {
00551                     sliver = PicPack5x7_bitmap_0[count];
00552                 } else {
00553                     sliver = PicPack5x7_bitmap_1[count-256];
00554                 }
00555                 // Now iterate over sliver
00556                 if (pixel >= start_pixel) {
00557                     s_count = 0;
00558                     while (s_count < 7) {
00559                         if (test_bit(sliver, 6)) {
00560                             #if DRAW_HW_Y_ORIGIN == BOTTOM_LEFT
00561                                 draw_set_pixel(x, y + s_count, colour);
00562                             #else
00563                             // DRAW_HW_Y_ORIGIN == TOP_LEFT
00564                                 draw_set_pixel(x, y - s_count, colour);
00565                             #endif
00566                         }   
00567                         sliver <<= 1;
00568                         s_count++;
00569                     }
00570                     x++;
00571                 }
00572                 if (x - x_origin == width) {
00573                     return;
00574                 }   
00575                 pixel++;    
00576                 // Need to add a bit here to only
00577                 // increment to new line when we have got to height chars
00578                 
00579             }       
00580         str++;
00581         if (pixel >= start_pixel) {
00582             x++;
00583         }
00584         pixel++;
00585             
00586         if (x - x_origin == width) {
00587             return;
00588         }   
00589     }
00590 }    

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_rect ( uns8  x,
uns8  y,
uns16  width,
uns8  height,
uns8  colour 
)

00253                                                                       {
00254 uns16 dx, dy;
00255 
00256     for(dy = y ; dy < y + height ; dy++) {
00257         for(dx = x ; dx < x + width ; dx++) {
00258             draw_set_pixel(dx, dy, colour);
00259 /*          serial_print_str("P:");
00260             serial_print_int(dx);
00261             serial_print_str(",");
00262             serial_print_int(dy);
00263             serial_print_nl();
00264 */      }
00265     }   
00266 }   

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_set_pixel ( uns8  x,
uns8  y,
uns8  colour 
)

00135                                                  {
00136 
00137 uns8 *buffer;
00138 uns16 buffer_loc, loc_byte;
00139 uns8  loc_bit, loc_in_buffer, buffer_num;
00140 uns8  bit_count;
00141     // inverse here
00142     // y = DRAW_PIXELS_HIGH - 1 - y;
00143     
00144     #if DRAW_HW_Y_ORIGIN == TOP_LEFT
00145         #if DRAW_HW_BUFFER_ORIENTATION == HORIZONTAL
00146             buffer_loc = y * DRAW_PIXELS_WIDE + x;
00147         #else
00148         // DRAW_HW_BUFFER_ORIENTATION == VERTICAL
00149             buffer_loc = x * DRAW_PIXELS_HIGH + y;
00150         #endif
00151     #else
00152     // DRAW_HW_Y_ORIENTATION == BOTTOM_LEFT
00153         #if DRAW_HW_BUFFER_ORIENTATION == HORIZONTAL
00154             buffer_loc = y * DRAW_PIXELS_WIDE + x;
00155         #else
00156         // DRAW_HW_BUFFER_ORIENTATION == VERTICAL
00157             buffer_loc = x * DRAW_PIXELS_HIGH + y;
00158         #endif
00159     #endif
00160 /*    serial_print_int(x);
00161     serial_putc(' ');
00162     serial_print_int(y);
00163     serial_print_nl();
00164     
00165     serial_print_str("->");
00166     serial_print_int(buffer_loc);
00167 */
00168     
00169     buffer_loc = buffer_loc * DRAW_BITS_PER_PIXEL;           
00170 //  loc_byte = buffer_loc / DRAW_PIXELS_PER_BYTE;
00171     loc_byte = buffer_loc / 8;
00172     loc_bit = (buffer_loc & (0x07));
00173     
00174 /*byte  0        1        2   
00175 bit     0 2 4 6  0 2 4 6  0 2 4 6
00176 pix     0 1 2 3  4 5 6 7  8 9 a b 
00177 bit pos 0 2 4 6  8 a c e
00178 */
00179     loc_in_buffer = loc_byte & 0xff;
00180     buffer_num = loc_byte >> 8;
00181     
00182     /* 
00183     // For debugging
00184     serial_print_str(" x=");
00185     serial_print_int(x);
00186     serial_print_str(" y=");
00187     serial_print_int(y);
00188     serial_print_str(" buffer_loc=");
00189     serial_print_int(buffer_loc);
00190     serial_print_str(" loc_byte=");
00191     serial_print_int(loc_byte);
00192     serial_print_str(" loc_bit=");
00193     serial_print_int(loc_bit); 
00194     serial_print_str(" LIB=");
00195     serial_print_int(loc_in_buffer);
00196     serial_print_nl();
00197     serial_print_str(" bnum=");
00198     serial_print_int(buffer_num);
00199     serial_print_str("\n");
00200     */
00201     if (buffer_num == 0) {
00202         buffer = &draw_buffer0;
00203     }
00204     #if DRAW_TOTAL_BUFFER_SIZE > 256
00205     
00206     else if (buffer_num == 1) {
00207         buffer = &draw_buffer1;
00208 
00209     }
00210         #if DRAW_TOTAL_BUFFER_SIZE > 512
00211         else if (buffer_num == 2) {
00212             buffer = &draw_buffer2;
00213 
00214         }
00215             #if DRAW_TOTAL_BUFFER_SIZE > 768
00216             else if (buffer_num == 3) {
00217             buffer = &draw_buffer3;
00218 
00219             }
00220             #endif
00221         #endif
00222     #endif
00223     #if DRAW_BITS_PER_PIXEL > 1
00224     
00225         bit_count = 0;
00226     
00227         while (bit_count < DRAW_BITS_PER_PIXEL) {
00228             if (test_bit(colour, bit_count)) {
00229                 set_bit(buffer[loc_in_buffer], loc_bit);
00230             } else {
00231                 clear_bit(buffer[loc_in_buffer], loc_bit);
00232             }
00233             bit_count++;
00234             loc_bit++;
00235         }
00236     #else
00237     
00238         if (colour) {
00239             set_bit(buffer[loc_in_buffer], loc_bit);
00240         } else {
00241             clear_bit(buffer[loc_in_buffer], loc_bit);
00242         }   
00243     #endif  
00244 
00245 }

Here is the caller graph for this function:

void draw_setup_io (  ) 

00124                      {
00125     drv_setup_io();
00126 }

Here is the call graph for this function:

void drv_init (  ) 

00287                 {
00288     ea_ldp6416_init();
00289 }   

Here is the call graph for this function:

Here is the caller graph for this function:

void drv_paint (  ) 

00073                  {
00074     uns8 count;
00075     // start_crit_sec();
00076     count = 0;
00077     
00078     do {
00079         buffer0[count] = draw_buffer0[count];
00080         #if ea_ldp6416_displays > 1
00081             buffer1[count] = draw_buffer1[count];
00082         #endif;
00083         #if ea_ldp6416_displays > 2
00084             buffer2[count] = draw_buffer2[count];
00085         #endif
00086         #if ea_ldp6416_displays > 3
00087             buffer3[count] = draw_buffer3[count];
00088         #endif
00089         count++;
00090     } while (count !=0);
00091     //end_crit_sec();   
00092 }

Here is the call graph for this function:

void drv_print_buffer (  ) 

00094                         {
00095 uns8 count;
00096 
00097     count = 0;
00098     do {
00099         serial_print_int(buffer0[count]);
00100         serial_print_spc();
00101         count++;
00102     } while (count != 0);   
00103     serial_print_nl();
00104 
00105 }

Here is the call graph for this function:

void drv_refresh (  ) 

00116                    {
00117 
00118 
00119 uns8 x;
00120 uns8 data;
00121 
00122     
00123 #if ea_ldp6416_max_brightness > 0
00124     bright_count++;
00125     
00126     if (bright_count > bright_level) {
00127         // Turn off display
00128         set_pin(ea_ldp6416_en_port, ea_ldp6416_en_pin);
00129     }
00130     
00131     if (bright_count == ea_ldp6416_max_brightness) {
00132         bright_count = 255;
00133 #endif
00134                 
00135         for (x = 0; x < x_refresh; x++) {   // WAS 16
00136             #if ea_ldp6416_displays == 1
00137                 data = buffer0[buffer_position];
00138             #endif
00139 
00140             #if ea_ldp6416_displays == 2 && ea_ldp6416_display_orientation == HORIZONTAL
00141                 if (current_buffer == 0) {
00142                     data = buffer0[buffer_position];
00143                 } else {
00144                     data = buffer1[buffer_position];
00145                 }
00146             #endif  
00147             #if ea_ldp6416_displays == 3 && ea_ldp6416_display_orientation == HORIZONTAL
00148                 switch (current_buffer) {
00149                     case 0: data = buffer0[buffer_position]; break;
00150                     case 1: data = buffer1[buffer_position]; break;
00151                     case 2: data = buffer2[buffer_position]; break;
00152                 } 
00153             #endif
00154             #if ea_ldp6416_displays == 4 && ea_ldp6416_display_orientation == HORIZONTAL
00155                 switch (current_buffer) {
00156                     case 0: data = buffer0[buffer_position]; break;
00157                     case 1: data = buffer1[buffer_position]; break;
00158                     case 2: data = buffer2[buffer_position]; break;
00159                     case 3: data = buffer3[buffer_position]; break;
00160                 } 
00161             #endif
00162             
00163             set_pins_r1_g1();
00164             
00165             if (data.0) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00166             if (data.1) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00167             
00168             clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00169             set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00170             
00171             set_pins_r1_g1();
00172             
00173             if (data.2) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00174             if (data.3) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00175             
00176             clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00177             set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00178             
00179             set_pins_r1_g1();
00180             
00181             if (data.4) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00182             if (data.5) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00183                 
00184             clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00185             set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00186             
00187             set_pins_r1_g1();
00188             
00189             if (data.6) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00190             if (data.7) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00191                 
00192             clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00193             set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00194             
00195             buffer_position++;
00196             
00197             #if ea_ldp6416_displays > 1 && ea_ldp6416_display_orientation == HORIZONTAL
00198                 if (buffer_position == 0) {
00199                     current_buffer++;
00200                 }   
00201             #endif  
00202         }   
00203     
00204         #if ea_ldp6416_displays == 2 && ea_ldp6416_display_orientation == VERTICAL
00205     
00206             for (x = 0; x < x_refresh; x++) {
00207                 data = buffer1[buffer_position1];
00208                 
00209                 set_pins_r1_g1();
00210                 
00211                 if (data_upper.0) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00212                 if (data_upper.1) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00213                     
00214                 clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00215                 set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00216                 
00217                 set_pins_r1_g1();
00218                 
00219                 if (data_upper.2) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00220                 if (data_upper.3) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00221                 
00222                 clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00223                 set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00224                 
00225                 set_pins_r1_g1();
00226                 
00227                 if (data_upper.4) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00228                 if (data_upper.5) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00229                 
00230                 clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00231                 set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00232                 
00233                 set_pins_r1_g1();
00234                 
00235                 if (data_upper.6) { clear_pin(ea_ldp6416_r1_port, ea_ldp6416_r1_pin); }
00236                 if (data_upper.7) { clear_pin(ea_ldp6416_g1_port, ea_ldp6416_g1_pin); }
00237                     
00238                 clear_pin(ea_ldp6416_s_port, ea_ldp6416_s_pin);
00239                 set_pin  (ea_ldp6416_s_port, ea_ldp6416_s_pin);
00240                 
00241                 buffer_position1++;
00242             } // x loop 
00243             
00244         #endif
00245             
00246     
00247         set_pin(ea_ldp6416_en_port, ea_ldp6416_en_pin); // turn enable off
00248         
00249         clear_pin(ea_ldp6416_a_port, ea_ldp6416_a_pin);
00250         clear_pin(ea_ldp6416_b_port, ea_ldp6416_b_pin);
00251         clear_pin(ea_ldp6416_c_port, ea_ldp6416_c_pin);
00252         clear_pin(ea_ldp6416_d_port, ea_ldp6416_d_pin);
00253         
00254         if (current_row.0) { set_pin(ea_ldp6416_a_port, ea_ldp6416_a_pin); }
00255         if (current_row.1) { set_pin(ea_ldp6416_b_port, ea_ldp6416_b_pin); }    
00256         if (current_row.2) { set_pin(ea_ldp6416_c_port, ea_ldp6416_c_pin); }        
00257         if (current_row.3) { set_pin(ea_ldp6416_d_port, ea_ldp6416_d_pin); } 
00258 
00259         // latch data   
00260         set_pin(ea_ldp6416_l_port, ea_ldp6416_l_pin);
00261         clear_pin(ea_ldp6416_l_port, ea_ldp6416_l_pin);
00262         
00263         // enable display of row
00264         clear_pin(ea_ldp6416_en_port, ea_ldp6416_en_pin);
00265     
00266         current_row++;
00267         if (current_row == y_refresh) {
00268             current_buffer = 0;
00269             buffer_position = 0;
00270             current_row = 0;
00271         }   
00272 
00273 #if ea_ldp6416_max_brightness > 0
00274 
00275     }
00276 #endif
00277 
00278 }

void drv_set_display_brightness ( uns8  brightness  ) 

00108                                                  {
00109     if (brightness < ea_ldp6416_max_brightness) {
00110         bright_level = brightness;
00111     } else {
00112         bright_level = ea_ldp6416_max_brightness;
00113     }
00114 }   

void drv_setup_io (  ) 

00283                     {
00284     ea_ldp6416_setup_io();
00285 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Fri Aug 19 09:04:54 2011 for Pic Pack Library by  doxygen 1.6.1