Commit 16dda79a authored by Mateusz Zalega's avatar Mateusz Zalega
Browse files

faultscreen: switched to RLE-encoded graphics


Signed-off-by: Mateusz Zalega's avatarMateusz Zalega <mateusz@appliedsourcery.com>
parent a233e5c1
This diff is collapsed.
#ifndef BOMB_H
#define BOMB_H
extern char bomb_pic_data[];
#endif
......@@ -2,9 +2,9 @@
#include <stdio.h>
#include "Fonts/fonts.h"
#include "faultsplash.h"
#include "display.h"
#include "gfx.h"
#include "bomb.h"
#include "max32665.h"
#include "nvic_table.h"
......@@ -27,20 +27,6 @@ struct regs_t {
"=r" (regs.sp) \
)
static void draw_bomb() {
gfx_clear(&display_screen);
Color black = gfx_color(&display_screen, BLACK);
Color white = gfx_color(&display_screen, WHITE);
for (int y = 0; y < display_screen.height; y++) {
for (int x = 0; x < display_screen.width; x++) {
Color color = bomb_pic_data[y * display_screen.width + x]
? white : black;
gfx_setpixel(&display_screen, x, y, color);
}
}
}
static void generic_handler(const char *reason) {
char lines[3][64];
......@@ -51,7 +37,8 @@ static void generic_handler(const char *reason) {
snprintf(lines[1], sizeof(lines[1]), "sp: 0x%08x", regs.sp);
snprintf(lines[2], sizeof(lines[2]), "lr: 0x%08x", regs.lr);
draw_bomb();
gfx_copy_region(&display_screen, 0, 0, 160, 80, GFX_RLE_MONO,
faultsplash_rle_len, faultsplash_rle);
Color black = gfx_color(&display_screen, BLACK);
Color white = gfx_color(&display_screen, WHITE);
......
#include "faultsplash.h"
const unsigned char faultsplash_rle[] = {
0x7f, 0x50, 0x83, 0x0f, 0x82, 0x7f, 0x0d, 0x83, 0x0f, 0x82, 0x7f, 0x1d,
0x82, 0x7f, 0x1f, 0x82, 0x7f, 0x1f, 0x82, 0x7f, 0x12, 0x82, 0x09, 0x82,
0x7f, 0x14, 0x82, 0x09, 0x82, 0x7f, 0x09, 0x82, 0x11, 0x83, 0x7f, 0x0b,
0x82, 0x11, 0x83, 0x7f, 0x0f, 0x82, 0x07, 0x82, 0x7f, 0x16, 0x82, 0x07,
0x82, 0x7f, 0x16, 0x82, 0x07, 0x82, 0x7f, 0x1a, 0x83, 0x7f, 0x1e, 0x83,
0x7f, 0x0a, 0x8b, 0x17, 0x82, 0x02, 0x82, 0x02, 0x83, 0x73, 0x8c, 0x16,
0x82, 0x02, 0x82, 0x02, 0x83, 0x72, 0x81, 0x0c, 0x84, 0x07, 0x85, 0x7f,
0x03, 0x82, 0x0c, 0x84, 0x07, 0x86, 0x7f, 0x02, 0x82, 0x0c, 0x84, 0x07,
0x86, 0x7f, 0x82, 0x12, 0x87, 0x7f, 0x06, 0x82, 0x12, 0x87, 0x7f, 0x06,
0x82, 0x24, 0x82, 0x78, 0x82, 0x24, 0x82, 0x78, 0x82, 0x24, 0x82, 0x78,
0x82, 0x16, 0x83, 0x04, 0x82, 0x07, 0x82, 0x76, 0x82, 0x16, 0x83, 0x04,
0x82, 0x07, 0x82, 0x70, 0x8f, 0x0d, 0x82, 0x12, 0x82, 0x6e, 0x8f, 0x0d,
0x82, 0x12, 0x82, 0x6e, 0x8f, 0x0b, 0x82, 0x09, 0x82, 0x0b, 0x82, 0x6c,
0x8f, 0x0b, 0x82, 0x09, 0x82, 0x0b, 0x82, 0x6c, 0x8f, 0x0b, 0x82, 0x09,
0x82, 0x0b, 0x82, 0x6c, 0x8f, 0x7f, 0x12, 0x8f, 0x7f, 0x0d, 0x98, 0x12,
0x82, 0x74, 0x98, 0x12, 0x82, 0x70, 0xa1, 0x7f, 0xa1, 0x7f, 0xa1, 0x7f,
0xa1, 0x7f, 0xa1, 0x7d, 0xa5, 0x7b, 0xa5, 0x7b, 0xa5, 0x7b, 0xa5, 0x7a,
0xa6, 0x78, 0x89, 0x02, 0x9f, 0x76, 0x89, 0x02, 0x9f, 0x76, 0xaa, 0x76,
0xaa, 0x76, 0x87, 0x02, 0xa1, 0x76, 0x87, 0x02, 0xa1, 0x76, 0x87, 0x02,
0xa1, 0x76, 0x87, 0x02, 0xa1, 0x76, 0x87, 0x02, 0xa1, 0x76, 0x87, 0x02,
0xa1, 0x76, 0x87, 0x02, 0xa1, 0x76, 0xaa, 0x76, 0xaa, 0x76, 0xaa, 0x76,
0x89, 0x02, 0x9f, 0x76, 0x89, 0x02, 0x9f, 0x79, 0xa5, 0x7b, 0xa5, 0x7b,
0xa5, 0x7b, 0x8b, 0x02, 0x98, 0x7b, 0x8b, 0x02, 0x98, 0x7d, 0xa1, 0x7f,
0xa1, 0x7f, 0xa1, 0x7f, 0xa1, 0x7f, 0xa1, 0x7f, 0x04, 0x98, 0x7f, 0x09,
0x98, 0x7f, 0x0e, 0x8f, 0x7f, 0x12, 0x8f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f,
0x7f, 0x06
};
const size_t faultsplash_rle_len = 302;
const size_t faultsplash_width = 160;
const size_t faultsplash_height = 80;
#ifndef FAULTSPLASH_H
#define FAULTSPLASH_H
#include <stddef.h>
extern const unsigned char faultsplash_rle[];
extern const size_t faultsplash_rle_len;
extern const size_t faultsplash_width;
extern const size_t faultsplash_height;
#endif
......@@ -11,7 +11,7 @@ sources = files(
'pb.c',
'display.c',
'faultscreen.c',
'bomb.c'
'faultsplash.c'
)
deps = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment