void lcd_col(char chr) { lcd_base_addr(lcdCacheIdx); lcd_send(chr, LCD_DATA); lcdCacheIdx++; }
/* Displays a separator at current cursor location */ void lcd_sep() { lcd_base_addr(lcdCacheIdx); // 5 pixel wide characters and add space lcd_send(0x44, LCD_DATA); lcd_send(0, LCD_DATA); lcdCacheIdx += 2; }
// Clears an area on a line void lcd_clear_area(unsigned char line, unsigned char startX, unsigned char endX) { // Start and end positions of line int start = line * LCD_WIDTH + startX; int end = line * LCD_WIDTH + endX; lcd_base_addr(start); // Clear all data in range from cache for(unsigned int i = start; i < end; i++) lcd_send(0, LCD_DATA); }
// Clears the display void lcd_clear(void) { lcdCacheIdx = 0; lcd_base_addr(lcdCacheIdx); // Set the entire cache to zero and write 0s to lcd int lcd_size = ((LCD_WIDTH * LCD_HEIGHT) / CHAR_HEIGHT); for(int i=0;i<lcd_size;i++) lcd_send(0, LCD_DATA); }
/* Clears the display */ void lcd_clear(void) { lcdCacheIdx = 0; lcd_base_addr(lcdCacheIdx); // Set the entire cache to zero and write 0s to lcd for(int i=0;i<LCD_CACHE_SIZE;i++) { lcd_send(0, LCD_DATA); } }
/* Displays a character at current cursor location */ void lcd_chr(char chr) { lcd_base_addr(lcdCacheIdx); // 5 pixel wide characters and add space for(unsigned char i=0;i<5;i++) { lcd_send(pgm_read_byte(&font5x7[chr-32][i]) << 1, LCD_DATA); } lcd_send(0, LCD_DATA); lcdCacheIdx += 6; }
/* Clears an area on a line */ void lcd_clear_area(unsigned char line, unsigned char startX, unsigned char endX) { // Start and end positions of line int start = (line-1)*84+(startX-1); int end = (line-1)*84+(endX-1); lcd_base_addr(start); // Clear all data in range from cache for(unsigned int i=start;i<end;i++) { lcd_send(0, LCD_DATA); } }
/* Clears the display */ void lcd_clear(void) { int lcdCacheIdx = 0; lcd_base_addr(lcdCacheIdx); // Set the entire cache to zero and write 0s to lcd for(int i=0;i<LCD_CACHE_SIZE;i++) { lcd_send(0, LCD_DATA); lcd_buffer[ i ] = 0; set_update_table( i ); } }
// Displays a character at current cursor location or moves to new line if enter char is given void lcd_chr(char chr) { if (chr == '\n') { // move to next line and first column lcdCacheIdx = lcdCacheIdx + LCD_WIDTH - lcdCacheIdx % LCD_WIDTH; //next line and x=0 } else { lcd_base_addr(lcdCacheIdx); // 5 pixel wide characters and add space for(unsigned char i=0; i < CHAR_WIDTH - 1; i++) lcd_send(pgm_read_byte(&font5x7[chr-32][i]) << 1, LCD_DATA); lcd_send(0, LCD_DATA); // right empty separator line of 8 vertical pixels lcdCacheIdx += CHAR_WIDTH; } }
//updates the necessary pieces of the lcd void lcd_update_from_buffer( void ) { //when two neighbor is needed to refresh, the lcd base point don't need to be updated, as the lcd increments it automaticly unsigned char continous = 1; for( unsigned int buffer_index = 0; buffer_index < LCD_CACHE_SIZE; buffer_index++ ) { if( lcd_buffer_update_table[ buffer_index / 8 ] & ( 1<<(buffer_index%8) ) ) { if( !continous) lcd_base_addr( buffer_index ); lcd_send( lcd_buffer[ buffer_index ] , LCD_DATA); lcd_buffer_update_table[ buffer_index / 8 ] &= ~(1 << ( buffer_index % 8 )); continous = 1; } else { continous = 0; } } }