Exemplo n.º 1
0
void rtc_update_display(uint8_t pos, uint8_t time) 
{	
	char buffer[2];
	char temp;
	
	itoa_simple(buffer,time);
	
	//append zero
	if (time < 10) {
		temp = buffer[0];
		buffer[0] = '0';
		buffer[1] = temp;
	}
	
	//Clear old numbers
	if (pos == BOTTOM_HALF) {
		display_draw_filled_rect(0,0,16,8,0);
	} else {
		display_draw_filled_rect(0,7,16,9,0);
	}
	
	//Write new numbers
	display_draw_char(2,pos,buffer[0],1,1);
	display_draw_char(9,pos,buffer[1],1,1);
}
Exemplo n.º 2
0
void console_putch(u08 ch)
{
    // new line
    if(ch == '\n') {
        pos -= x;
        x = 0;
        if(y == ( CONSOLE_HEIGHT-1 )) {
            scroll_up();
        } else {
            y++;
            pos += CONSOLE_WIDTH;
        }
    } 
    // visible char
    else if(ch >= ' ') {
        buffer[pos] = ch;
        display_draw_char(x,y,ch);
        
        x++;
        pos++;
        if(x == CONSOLE_WIDTH) {
            x = 0;
            pos -= CONSOLE_WIDTH;
            if(y == ( CONSOLE_HEIGHT-1 )) {
                scroll_up();
            } else {
                y++;
                pos += CONSOLE_WIDTH;
            }
        }
    }
}
Exemplo n.º 3
0
static void redraw(void)
{
    u08 *ptr = buffer;
    for(u08 y=0;y<CONSOLE_HEIGHT;y++) {
        for(u08 x=0;x<CONSOLE_WIDTH;x++) {
            display_draw_char(x,y,*ptr);
            ptr++;
        }
    }
}