Skip to content
Snippets Groups Projects
Commit 7ec9a3d7 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

framebuffer: add scroll function

parent 8d928138
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ class Framebuffer : public OutputStream
constexpr static unsigned int const height = CONFIG_framebuffer_height;
void clear();
void scroll();
void fillBox(unsigned int x, unsigned int y, unsigned int w, unsigned int h);
void drawAt(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned char *image);
void setFont(const glyph_t *font) { this->font = font; }
......
......@@ -71,6 +71,19 @@ void Framebuffer::drawAt(unsigned int x, unsigned int y, unsigned int w, unsigne
}
}
void Framebuffer::scroll()
{
for (unsigned int pos_x = 0; pos_x < width; pos_x++) {
for (unsigned int pos_y = 1; pos_y < height/8; pos_y++) {
data[pos_x * (height/8) + pos_y - 1] = data[pos_x * (height/8) + pos_y];
}
data[pos_x * (height/8) + height/8 - 1] = 0;
}
if (fontY >= 8) {
fontY -= 8;
}
}
void Framebuffer::put(char c)
{
if (font == 0) {
......@@ -96,7 +109,7 @@ void Framebuffer::put(char c)
put('\n');
}
if (fontY >= height) {
return;
scroll();
}
for (unsigned char i = 0; i < glyph_w; i++) {
#ifdef MULTIPASS_ARCH_arduino_nano
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment