You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.6 KiB
71 lines
1.6 KiB
/**
|
|
* Empty battery
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include "ssd1306.h"
|
|
#include "user_interface.h"
|
|
|
|
void show_empty_battery()
|
|
{
|
|
ssd1306_clearScreen();
|
|
|
|
// *********
|
|
// **** *
|
|
// **** x *
|
|
// **** *
|
|
// *********
|
|
|
|
#define capwid 6
|
|
#define hei 24
|
|
#define caphei 12
|
|
#define wid 50
|
|
#define thic 2
|
|
#define inpad 2
|
|
#define charge 2
|
|
|
|
#define ofsx ((DISPLAY_W - capwid - wid)/2)
|
|
#define ofsy ((DISPLAY_H - hei)/2)
|
|
|
|
const uint8_t rects[6][4] = {
|
|
// cap
|
|
{
|
|
0, (hei - caphei) / 2,
|
|
capwid - 1, hei - (hei - caphei) / 2 - 1
|
|
},
|
|
// left line
|
|
{
|
|
capwid, 0,
|
|
capwid+thic - 1, hei - 1
|
|
},
|
|
// top line
|
|
{
|
|
capwid + thic, 0,
|
|
capwid + wid - thic - 1, thic - 1
|
|
},
|
|
// right line
|
|
{
|
|
capwid + wid - thic, 0,
|
|
capwid + wid - 1, hei - 1
|
|
},
|
|
// "remaining charge" line
|
|
{
|
|
capwid + wid - thic - inpad - charge, thic + inpad,
|
|
capwid + wid - thic - inpad - 1, hei - thic - inpad - 1
|
|
},
|
|
// bottom line
|
|
{
|
|
capwid + thic, hei - thic,
|
|
capwid + wid - thic - 1, hei - 1
|
|
}
|
|
};
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
ssd1306_fillRect(
|
|
ofsx + rects[i][0],
|
|
ofsy + rects[i][1],
|
|
ofsx + rects[i][2],
|
|
ofsy + rects[i][3]
|
|
);
|
|
}
|
|
}
|
|
|