summaryrefslogtreecommitdiff
path: root/src/os/object/framebuffer.cc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-11-29 20:39:46 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-11-29 20:39:46 +0100
commit1b1952efc21d1b243e25e3c6f3d92ddefb419977 (patch)
tree474afb0ee5da91f72feb70b4666895d142edc6bd /src/os/object/framebuffer.cc
parent392aec889cff9400d512970868a6dcfba3b72ce1 (diff)
framebuffer: battery: show charging indicator
Diffstat (limited to 'src/os/object/framebuffer.cc')
-rw-r--r--src/os/object/framebuffer.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/os/object/framebuffer.cc b/src/os/object/framebuffer.cc
index 82f26e3..1a22320 100644
--- a/src/os/object/framebuffer.cc
+++ b/src/os/object/framebuffer.cc
@@ -71,15 +71,24 @@ void Framebuffer::drawAt(unsigned int x, unsigned int y, unsigned int w, unsigne
}
}
-void Framebuffer::drawBattery(unsigned int x, unsigned int y, unsigned char percent)
+void Framebuffer::drawBattery(unsigned int x, unsigned int y, unsigned char percent, bool charging)
{
for (unsigned char i = 0; i < 13; i++) {
- data[(x+i) * (height/8) + y] = 0x81 | (0xff * (percent >= (i*8)));
+ data[(x+i) * (height/8) + y] = 0x81 | (0xff * (percent*2 >= i*15));
}
data[(x+11) * (height/8) + y/8] |= 0xe7;
data[(x+12) * (height/8) + y/8] &= ~0x81;
data[(x+12) * (height/8) + y/8] |= 0x24;
data[(x+13) * (height/8) + y/8] = 0x3c;
+
+ if (charging) {
+ data[(x+2) * (height/8) + y/8] ^= 0x7e;
+ data[(x+3) * (height/8) + y/8] ^= 0x3c;
+ data[(x+4) * (height/8) + y/8] ^= 0x18;
+ data[(x+7) * (height/8) + y/8] ^= 0x7e;
+ data[(x+8) * (height/8) + y/8] ^= 0x3c;
+ data[(x+9) * (height/8) + y/8] ^= 0x18;
+ }
}
void Framebuffer::scroll()