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.
56 lines
955 B
56 lines
955 B
/**
|
|
* Loading
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "ssd1306.h"
|
|
#include "user_interface.h"
|
|
|
|
|
|
void show_loading_screen(uint8_t progress_percent, bool clear)
|
|
{
|
|
if (clear) {
|
|
ssd1306_clearScreen();
|
|
}
|
|
|
|
// bar in a box
|
|
|
|
#define hei 16
|
|
#define wid DISPLAY_W
|
|
|
|
#define ofsx ((DISPLAY_W - wid)/2)
|
|
#define ofsy 8
|
|
|
|
ssd1306_setColor(0xFFFF);
|
|
|
|
lcdint_t xx = (uint8_t)(((uint16_t)wid * (uint16_t)progress_percent)/(uint16_t)100);
|
|
|
|
ssd1306_fillRect(
|
|
ofsx,
|
|
ofsy,
|
|
ofsx + xx,
|
|
ofsy + hei
|
|
);
|
|
|
|
ssd1306_fillRect(
|
|
ofsx + xx + 1,
|
|
ofsy,
|
|
ofsx + wid - 2,
|
|
ofsy
|
|
);
|
|
|
|
ssd1306_fillRect(
|
|
ofsx + xx + 1,
|
|
ofsy + hei,
|
|
ofsx + wid - 2,
|
|
ofsy + hei
|
|
);
|
|
|
|
ssd1306_fillRect(
|
|
ofsx + wid - 1,
|
|
ofsy,
|
|
ofsx + wid - 1,
|
|
ofsy + hei
|
|
);
|
|
}
|
|
|