/* display_start - start display on LCD */ void display_start(frame_buffer_t *frame_buffer) { unsigned char *fb = frame_buffer->fb; int column_max = frame_buffer->column_max; LCD_init(); fb_write_char(0,5,"NOKIA 5110", fb, column_max); sprintf(title, "Description: chenchachan - Copyright (c) 2013, chenchacha"); fb_write_char(1,0,title, fb, column_max); /* fb_negation_dollop(0,0,83,47,fb,column_max); */ /* display_boxes(frame_buffer); */ LCD_draw_frame_buffer(0,0,fb, column_max); LCD_draw_dollop(0,0,83,47); #if 0 LCD_draw_point(30,25); /* write a boxes */ LCD_draw_dollop(25,48,0,0); LCD_draw_dollop(25,25,0,84); LCD_draw_dollop(48,48,0,84); LCD_draw_dollop(25,48,84,84); #endif } /* ----- end of function display_start ----- */
int display_roll(frame_buffer_t *frame_buffer, int place, int roll, int dirction, int step) { unsigned char *fb = frame_buffer->fb; int column_max = frame_buffer->column_max; int i = place; /* display button interrupt count */ sprintf(title, "button count:%d", button_count); fb_write_char(5,0,title, fb, column_max); /* roll left */ if (dirction) { while (i<place+roll) { /* sprintf(title, "%d,fixed position roll left:%d", i, i); * fb_write_char(3,0,title, fb, column_max); */ LCD_draw_frame_buffer(0,i,fb,column_max); i += step; } } else { /* roll right */ while (i>place-roll) { /* sprintf(title, "%d,fixed position roll right:%d", i, i); * fb_write_char(4,0,title, fb, column_max); */ LCD_draw_frame_buffer(0,i,fb,column_max); i -= step; } } LCD_draw_frame_buffer(0,i,fb,column_max); return i; } /* ----- end of function display_roll ----- */
/* Write text to the terminal */ void fb_write(const char *data, size_t length) { for(size_t i = 0; i < length; i++) { fb_write_char(data[i]); } }
/* display_add_string - add a string on LCD */ void display_add_string(frame_buffer_t *frame_buffer, int x, int y, const char *string) { unsigned char *fb = frame_buffer->fb; int column_max = frame_buffer->column_max; fb_write_char(x,y,string, fb, column_max); } /* ----- end of function display_add_string ----- */
void fb_write_string(const char* str, unsigned int len) { unsigned int i = 0; for (; i < len; ++i) { fb_write_char(*str); ++str; } fb_set_cursor_pos(fb_curr_pos/2); }