clear screen on startup

This commit is contained in:
Crispy 2024-04-12 22:36:16 +02:00
parent ea55972ff9
commit 63179fb3f5

View file

@ -16,6 +16,7 @@
void decode_next_frame();
void refresh_screen();
void clear_screen();
u32 reader = 0;
u32 frame[WIDTH];
@ -33,6 +34,7 @@ int main()
uint8_t *cmd_list = (uint8_t *)ssd1306_init_array;
while (*cmd_list != SSD1306_TERMINATE_CMDS)
ssd1306_cmd(*cmd_list++);
clear_screen();
while (1)
{
@ -77,6 +79,18 @@ void refresh_screen()
}
}
void clear_screen()
{
ssd1306_cmd(SSD1306_COLUMNADDR);
ssd1306_cmd(0); // Column start address (0 = reset)
ssd1306_cmd(127); // Column end address (127 = reset)
ssd1306_cmd(SSD1306_PAGEADDR);
ssd1306_cmd(0); // Page start address (0 = reset)
ssd1306_cmd(7); // Page end address
for (u32 i = 0; i < 32 * 8; i++)
ssd1306_data(frame, SSD1306_PSZ);
}
u8 next_byte()
{
u8 byte = video[reader];