Update
This commit is contained in:
parent
3516804e8c
commit
78316566d3
|
@ -1,6 +1,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "stm32f4xx_hal.h"
|
#include "stm32f4xx_hal.h"
|
||||||
|
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "sprites.h"
|
#include "sprites.h"
|
||||||
|
@ -8,10 +9,8 @@
|
||||||
#define MINIZ_NO_ARCHIVE_APIS
|
#define MINIZ_NO_ARCHIVE_APIS
|
||||||
#define MINIZ_NO_STDIO
|
#define MINIZ_NO_STDIO
|
||||||
#define MINIZ_NO_TIME
|
#define MINIZ_NO_TIME
|
||||||
|
|
||||||
#include "miniz.h"
|
#include "miniz.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef ssd1306
|
#ifndef ssd1306
|
||||||
#define ssd1306
|
#define ssd1306
|
||||||
|
|
||||||
|
|
157
Src/sprites.c
157
Src/sprites.c
|
@ -1,113 +1,86 @@
|
||||||
#include "sprites.h"
|
#include "sprites.h"
|
||||||
|
|
||||||
uint8_t sprite_0_Buf[185] = {
|
uint8_t frame0_data[185] = {
|
||||||
0x78, 0x9c, 0x8d, 0xd0, 0xbb, 0x0d, 0x83, 0x30, 0x10, 0x00,
|
0x78, 0x9c, 0x8d, 0xd0, 0xbb, 0x0d, 0x83, 0x30, 0x10, 0x00, 0xd0, 0xb3, 0x4e, 0x22, 0x8d,
|
||||||
0xd0, 0xb3, 0x4e, 0x22, 0x8d, 0x85, 0xdb, 0x74, 0x59, 0x81,
|
0x85, 0xdb, 0x74, 0x59, 0x81, 0x0d, 0x58, 0x85, 0x11, 0x28, 0xe9, 0x4c, 0x14, 0x89, 0x19,
|
||||||
0x0d, 0x58, 0x85, 0x11, 0x28, 0xe9, 0x4c, 0x14, 0x89, 0x19,
|
0x3c, 0x8e, 0x3d, 0x81, 0x57, 0xf0, 0x08, 0xd0, 0x51, 0x71, 0x39, 0x63, 0x1c, 0xa1, 0x60,
|
||||||
0x3c, 0x8e, 0x3d, 0x81, 0x57, 0xf0, 0x08, 0xd0, 0x51, 0x71,
|
0x45, 0x79, 0x95, 0x75, 0xf2, 0x7d, 0x01, 0xbe, 0x8c, 0xd1, 0xe9, 0x6d, 0x4c, 0xc8, 0x3e,
|
||||||
0x39, 0x63, 0x1c, 0xa1, 0x60, 0x45, 0x79, 0x95, 0x75, 0xf2,
|
0xf1, 0x5f, 0x9c, 0x73, 0x44, 0x5b, 0x42, 0xbb, 0x36, 0x23, 0x5a, 0xd7, 0x3f, 0x2a, 0x80,
|
||||||
0x7d, 0x01, 0xbe, 0x8c, 0xd1, 0xe9, 0x6d, 0x4c, 0xc8, 0x3e,
|
0xf7, 0x31, 0xcd, 0x7b, 0x8f, 0x98, 0x02, 0x52, 0x4a, 0x80, 0xa6, 0xb1, 0xb6, 0x6d, 0x4b,
|
||||||
0xf1, 0x5f, 0x9c, 0x73, 0x44, 0x5b, 0x42, 0xbb, 0x36, 0x23,
|
0xff, 0x43, 0xb8, 0x47, 0x53, 0xf6, 0x64, 0x7b, 0xe7, 0x6d, 0x5b, 0x59, 0x08, 0x5d, 0xd7,
|
||||||
0x5a, 0xd7, 0x3f, 0x2a, 0x80, 0xf7, 0x31, 0xcd, 0x7b, 0x8f,
|
0x19, 0x53, 0x55, 0x42, 0x94, 0xfb, 0x09, 0x51, 0x47, 0x82, 0x2d, 0x0b, 0x5d, 0x38, 0x67,
|
||||||
0x98, 0x02, 0x52, 0x4a, 0x80, 0xa6, 0xb1, 0xb6, 0x6d, 0x4b,
|
0xad, 0x55, 0xaa, 0x61, 0x75, 0xcd, 0x5b, 0x15, 0x2a, 0xf0, 0x9d, 0xfa, 0x5e, 0x4a, 0x44,
|
||||||
0xff, 0x43, 0xb8, 0x47, 0x53, 0xf6, 0x64, 0x7b, 0xe7, 0x6d,
|
0xa5, 0xb4, 0xd6, 0xa7, 0xdc, 0x79, 0x26, 0xda, 0xcf, 0x86, 0xf8, 0x62, 0x79, 0xa1, 0xb3,
|
||||||
0x5b, 0x59, 0x08, 0x5d, 0xd7, 0x19, 0x53, 0x55, 0x42, 0x94,
|
0x61, 0x98, 0x26, 0x91, 0x46, 0x4b, 0x63, 0x56, 0x37, 0xf6, 0x88, 0xf4, 0x51, 0xec, 0x38,
|
||||||
0xfb, 0x09, 0x51, 0x47, 0x82, 0x2d, 0x0b, 0x5d, 0x38, 0x67,
|
0xa6, 0xd6, 0xe5, 0xf9, 0x11, 0x65, 0x76, 0x6d, 0x80, 0x18, 0xa7, 0x62, 0xa5, 0xde, 0x00,
|
||||||
0xad, 0x55, 0xaa, 0x61, 0x75, 0xcd, 0x5b, 0x15, 0x2a, 0xf0,
|
|
||||||
0x9d, 0xfa, 0x5e, 0x4a, 0x44, 0xa5, 0xb4, 0xd6, 0xa7, 0xdc,
|
|
||||||
0x79, 0x26, 0xda, 0xcf, 0x86, 0xf8, 0x62, 0x79, 0xa1, 0xb3,
|
|
||||||
0x61, 0x98, 0x26, 0x91, 0x46, 0x4b, 0x63, 0x56, 0x37, 0xf6,
|
|
||||||
0x88, 0xf4, 0x51, 0xec, 0x38, 0xa6, 0xd6, 0xe5, 0xf9, 0x11,
|
|
||||||
0x65, 0x76, 0x6d, 0x80, 0x18, 0xa7, 0x62, 0xa5, 0xde, 0x00,
|
|
||||||
0x6f, 0x90, 0x66, 0x8d, 0xa6,
|
0x6f, 0x90, 0x66, 0x8d, 0xa6,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t sprite_1_Buf[152] = {
|
uint8_t frame1_data[152] = {
|
||||||
0x78, 0x9c, 0xb5, 0xd0, 0x31, 0x0e, 0x84, 0x20, 0x10, 0x05,
|
0x78, 0x9c, 0xb5, 0xd0, 0x31, 0x0e, 0x84, 0x20, 0x10, 0x05, 0x50, 0x27, 0x26, 0xd0, 0x6c,
|
||||||
0x50, 0x27, 0x26, 0xd0, 0x6c, 0xa4, 0xb5, 0xe3, 0x0a, 0x78,
|
0xa4, 0xb5, 0xe3, 0x0a, 0x78, 0x01, 0xce, 0x02, 0x37, 0xf0, 0x00, 0x26, 0x83, 0x37, 0xe3,
|
||||||
0x01, 0xce, 0x02, 0x37, 0xf0, 0x00, 0x26, 0x83, 0x37, 0xe3,
|
0x28, 0x1e, 0x81, 0xc4, 0x86, 0x82, 0xc8, 0x0e, 0x66, 0xd7, 0xb5, 0xda, 0xa9, 0x7c, 0x05,
|
||||||
0x28, 0x1e, 0x81, 0xc4, 0x86, 0x82, 0xc8, 0x0e, 0x66, 0xd7,
|
0xa1, 0x98, 0xcf, 0x07, 0xba, 0xee, 0x11, 0xc6, 0x98, 0xf4, 0x55, 0x48, 0xfd, 0x29, 0x25,
|
||||||
0xb5, 0xda, 0xa9, 0x7c, 0x05, 0xa1, 0x98, 0xcf, 0x07, 0xba,
|
0x46, 0x36, 0x2f, 0x84, 0x40, 0x6c, 0xd3, 0x88, 0xa8, 0xb5, 0x24, 0x00, 0xde, 0x7b, 0x80,
|
||||||
0xee, 0x11, 0xc6, 0x98, 0xf4, 0x55, 0x48, 0xfd, 0x29, 0x25,
|
0x75, 0x95, 0xb2, 0x56, 0x36, 0x4f, 0xb5, 0xd6, 0x2a, 0x62, 0xad, 0x4d, 0x29, 0xc6, 0x56,
|
||||||
0x46, 0x36, 0x2f, 0x84, 0x40, 0x6c, 0xd3, 0x88, 0xa8, 0xb5,
|
0xd9, 0xd6, 0x38, 0x4d, 0xc3, 0x00, 0xc0, 0xa6, 0xa9, 0xb6, 0x6d, 0x42, 0xb8, 0xee, 0x8e,
|
||||||
0x24, 0x00, 0xde, 0x7b, 0x80, 0x75, 0x95, 0xb2, 0x56, 0x36,
|
0x48, 0xa7, 0xcd, 0x73, 0x08, 0x6c, 0xf7, 0x71, 0x68, 0xed, 0x9c, 0xdb, 0xb6, 0x9c, 0x3f,
|
||||||
0x4f, 0xb5, 0xd6, 0x2a, 0x62, 0xad, 0x4d, 0x29, 0xc6, 0x56,
|
0x4f, 0xd6, 0x24, 0xe7, 0xb1, 0x91, 0x92, 0xcd, 0x2b, 0x75, 0x7e, 0xde, 0xbe, 0x5f, 0x5f,
|
||||||
0xd9, 0xd6, 0x38, 0x4d, 0xc3, 0x00, 0xc0, 0xa6, 0xa9, 0xb6,
|
0xf6, 0x22, 0x7d, 0xcf, 0x06, 0x6f, 0xf0, 0x66, 0x59, 0xfe, 0x0c, 0xbe, 0x01, 0xd8, 0x2e,
|
||||||
0x6d, 0x42, 0xb8, 0xee, 0x8e, 0x48, 0xa7, 0xcd, 0x73, 0x08,
|
|
||||||
0x6c, 0xf7, 0x71, 0x68, 0xed, 0x9c, 0xdb, 0xb6, 0x9c, 0x3f,
|
|
||||||
0x4f, 0xd6, 0x24, 0xe7, 0xb1, 0x91, 0x92, 0xcd, 0x2b, 0x75,
|
|
||||||
0x7e, 0xde, 0xbe, 0x5f, 0x5f, 0xf6, 0x22, 0x7d, 0xcf, 0x06,
|
|
||||||
0x6f, 0xf0, 0x66, 0x59, 0xfe, 0x0c, 0xbe, 0x01, 0xd8, 0x2e,
|
|
||||||
0x6a, 0x70,
|
0x6a, 0x70,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t sprite_2_Buf[156] = {
|
uint8_t frame2_data[156] = {
|
||||||
0x78, 0x9c, 0x8d, 0xd0, 0xb1, 0x09, 0xc5, 0x20, 0x10, 0x06,
|
0x78, 0x9c, 0x8d, 0xd0, 0xb1, 0x09, 0xc5, 0x20, 0x10, 0x06, 0xe0, 0x48, 0xc0, 0xd7, 0x48,
|
||||||
0xe0, 0x48, 0xc0, 0xd7, 0x48, 0x6c, 0x5f, 0xe7, 0x0a, 0xd9,
|
0x6c, 0x5f, 0xe7, 0x0a, 0xd9, 0xc0, 0x59, 0xb2, 0x41, 0x20, 0x4d, 0xba, 0x73, 0x12, 0x67,
|
||||||
0xc0, 0x59, 0xb2, 0x41, 0x20, 0x4d, 0xba, 0x73, 0x12, 0x67,
|
0x11, 0x5c, 0x24, 0x23, 0x5c, 0x99, 0x42, 0xf4, 0x99, 0x4b, 0x24, 0xcd, 0x13, 0xfd, 0x0a,
|
||||||
0x11, 0x5c, 0x24, 0x23, 0x5c, 0x99, 0x42, 0xf4, 0x99, 0x4b,
|
0xe1, 0x8e, 0xfb, 0xf1, 0x74, 0x18, 0xba, 0x38, 0xd7, 0x37, 0x57, 0x08, 0x21, 0x42, 0xc0,
|
||||||
0x24, 0xcd, 0x13, 0xfd, 0x0a, 0xe1, 0x8e, 0xfb, 0xf1, 0x74,
|
0x5b, 0x20, 0xa9, 0xb8, 0xfa, 0xcd, 0x3c, 0xe7, 0x1c, 0xe0, 0x09, 0x00, 0x28, 0xf5, 0xc9,
|
||||||
0x18, 0xba, 0x38, 0xd7, 0x37, 0x57, 0x08, 0x21, 0x42, 0xc0,
|
0x18, 0x63, 0xcb, 0x92, 0x0f, 0x96, 0x52, 0xc7, 0xbe, 0x0e, 0x51, 0xde, 0x10, 0x73, 0xe5,
|
||||||
0x5b, 0x20, 0xa9, 0xb8, 0xfa, 0xcd, 0x3c, 0xe7, 0x1c, 0xe0,
|
0x9e, 0xf6, 0x3c, 0x4f, 0x13, 0x63, 0x8d, 0xb4, 0x31, 0x74, 0x31, 0xa2, 0x31, 0x54, 0x03,
|
||||||
0x09, 0x00, 0x28, 0xf5, 0xc9, 0x18, 0x63, 0xcb, 0x92, 0x0f,
|
0xac, 0xeb, 0xb6, 0x01, 0x40, 0x73, 0x73, 0x63, 0x8e, 0xe3, 0x3c, 0xd3, 0x2b, 0xc6, 0xb8,
|
||||||
0x96, 0x52, 0xc7, 0xbe, 0x0e, 0x51, 0xde, 0x10, 0x73, 0xe5,
|
0xef, 0x5f, 0x62, 0xad, 0x05, 0xa8, 0x2f, 0x4c, 0x1f, 0x55, 0x62, 0xfa, 0x22, 0xa5, 0xd6,
|
||||||
0x9e, 0xf6, 0x3c, 0x4f, 0x13, 0x63, 0x8d, 0xb4, 0x31, 0x74,
|
0xde, 0x7b, 0x47, 0x8f, 0x11, 0x62, 0x1c, 0xc7, 0x5a, 0x5a, 0x29, 0x78, 0xd5, 0xc7, 0xfe,
|
||||||
0x31, 0xa2, 0x31, 0x54, 0x03, 0xac, 0xeb, 0xb6, 0x01, 0x40,
|
|
||||||
0x73, 0x73, 0x63, 0x8e, 0xe3, 0x3c, 0xd3, 0x2b, 0xc6, 0xb8,
|
|
||||||
0xef, 0x5f, 0x62, 0xad, 0x05, 0xa8, 0x2f, 0x4c, 0x1f, 0x55,
|
|
||||||
0x62, 0xfa, 0x22, 0xa5, 0xd6, 0xde, 0x7b, 0x47, 0x8f, 0x11,
|
|
||||||
0x62, 0x1c, 0xc7, 0x5a, 0x5a, 0x29, 0x78, 0xd5, 0xc7, 0xfe,
|
|
||||||
0xf8, 0x01, 0x4a, 0xd2, 0x77, 0x8c,
|
0xf8, 0x01, 0x4a, 0xd2, 0x77, 0x8c,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t sprite_3_Buf[171] = {
|
uint8_t frame3_data[171] = {
|
||||||
0x78, 0x9c, 0xb5, 0xd0, 0xd1, 0x09, 0x83, 0x30, 0x10, 0x06,
|
0x78, 0x9c, 0xb5, 0xd0, 0xd1, 0x09, 0x83, 0x30, 0x10, 0x06, 0x60, 0x43, 0x20, 0x7d, 0x39,
|
||||||
0x60, 0x43, 0x20, 0x7d, 0x39, 0x74, 0x01, 0xc1, 0x15, 0x6e,
|
0x74, 0x01, 0xc1, 0x15, 0x6e, 0x80, 0x82, 0xab, 0x54, 0x5c, 0x40, 0xf0, 0x55, 0xb8, 0x40,
|
||||||
0x80, 0x82, 0xab, 0x54, 0x5c, 0x40, 0xf0, 0x55, 0xb8, 0x40,
|
0x06, 0x71, 0x95, 0x4c, 0xe0, 0x18, 0x3e, 0x67, 0x80, 0x60, 0x9a, 0x98, 0x26, 0x96, 0x52,
|
||||||
0x06, 0x71, 0x95, 0x4c, 0xe0, 0x18, 0x3e, 0x67, 0x80, 0x60,
|
0xeb, 0x53, 0xbf, 0x87, 0x3c, 0xe4, 0xf8, 0xef, 0x72, 0x29, 0x8a, 0xbf, 0x40, 0x44, 0x93,
|
||||||
0x9a, 0x98, 0x26, 0x96, 0x52, 0xeb, 0x53, 0xbf, 0x87, 0x3c,
|
0x58, 0xcf, 0x1d, 0xac, 0x35, 0xe6, 0x32, 0x2f, 0x84, 0x20, 0x7a, 0x05, 0x88, 0x9a, 0xe6,
|
||||||
0xe4, 0xf8, 0xef, 0x72, 0x29, 0x8a, 0xbf, 0x40, 0x44, 0x93,
|
0xe6, 0x31, 0xc6, 0xba, 0xce, 0x1f, 0xcc, 0xb9, 0x1f, 0x49, 0xad, 0x11, 0xcb, 0x72, 0x59,
|
||||||
0x58, 0xcf, 0x1d, 0xac, 0x35, 0xe6, 0x32, 0x2f, 0x84, 0x20,
|
0x96, 0x6d, 0x73, 0xae, 0x6d, 0xab, 0xaa, 0x42, 0xd4, 0x5e, 0xa8, 0xe8, 0x58, 0x64, 0xec,
|
||||||
0x7a, 0x05, 0x88, 0x9a, 0xe6, 0xe6, 0x31, 0xc6, 0xba, 0xce,
|
0x7b, 0x74, 0x9a, 0x26, 0xa5, 0x86, 0x01, 0x20, 0xbf, 0x35, 0xef, 0x20, 0x25, 0xe7, 0xbe,
|
||||||
0x1f, 0xcc, 0xb9, 0x1f, 0x49, 0xad, 0x11, 0xcb, 0x72, 0x59,
|
0x15, 0x80, 0x52, 0xe3, 0x08, 0x70, 0x3a, 0x3d, 0xb4, 0x96, 0x72, 0x9e, 0xe9, 0x4d, 0x6c,
|
||||||
0x96, 0x6d, 0x73, 0xae, 0x6d, 0xab, 0xaa, 0x42, 0xd4, 0x5e,
|
0xb5, 0xae, 0x22, 0x38, 0x9b, 0x9d, 0x19, 0x13, 0x3f, 0xc9, 0xde, 0x93, 0xb8, 0x06, 0xe7,
|
||||||
0xa8, 0xe8, 0x58, 0x64, 0xec, 0x7b, 0x74, 0x9a, 0x26, 0xa5,
|
0x00, 0x10, 0x56, 0xb9, 0xc8, 0xf3, 0xdd, 0xe7, 0x5d, 0x5d, 0x3f, 0x92, 0xbe, 0x27, 0x3a,
|
||||||
0x86, 0x01, 0x20, 0xbf, 0x35, 0xef, 0x20, 0x25, 0xe7, 0xbe,
|
0x4a, 0x4f, 0x63, 0xe8, 0x75, 0xd5,
|
||||||
0x15, 0x80, 0x52, 0xe3, 0x08, 0x70, 0x3a, 0x3d, 0xb4, 0x96,
|
|
||||||
0x72, 0x9e, 0xe9, 0x4d, 0x6c, 0xb5, 0xae, 0x22, 0x38, 0x9b,
|
|
||||||
0x9d, 0x19, 0x13, 0x3f, 0xc9, 0xde, 0x93, 0xb8, 0x06, 0xe7,
|
|
||||||
0x00, 0x10, 0x56, 0xb9, 0xc8, 0xf3, 0xdd, 0xe7, 0x5d, 0x5d,
|
|
||||||
0x3f, 0x92, 0xbe, 0x27, 0x3a, 0x4a, 0x4f, 0x63, 0xe8, 0x75,
|
|
||||||
0xd5,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t sprite_4_Buf[143] = {
|
uint8_t frame4_data[143] = {
|
||||||
0x78, 0x9c, 0x8d, 0xd0, 0xc1, 0x0d, 0xc3, 0x20, 0x0c, 0x05,
|
0x78, 0x9c, 0x8d, 0xd0, 0xc1, 0x0d, 0xc3, 0x20, 0x0c, 0x05, 0xd0, 0x58, 0x48, 0xf4, 0x82,
|
||||||
0xd0, 0x58, 0x48, 0xf4, 0x82, 0xd2, 0x11, 0x98, 0x21, 0x77,
|
0xd2, 0x11, 0x98, 0x21, 0x77, 0x44, 0x56, 0x29, 0x62, 0x10, 0x37, 0x8b, 0x64, 0x16, 0x8f,
|
||||||
0x44, 0x56, 0x29, 0x62, 0x10, 0x37, 0x8b, 0x64, 0x16, 0x8f,
|
0xc4, 0x00, 0x56, 0xa9, 0x81, 0x10, 0xa9, 0x87, 0x0a, 0xde, 0x0d, 0x64, 0xfb, 0x1b, 0x96,
|
||||||
0xc4, 0x00, 0x56, 0xa9, 0x81, 0x10, 0xa9, 0x87, 0x0a, 0xde,
|
0x65, 0x0a, 0xd1, 0x5c, 0x5d, 0x67, 0x8c, 0x61, 0x4e, 0x0d, 0x57, 0xb9, 0x63, 0x9e, 0x18,
|
||||||
0x0d, 0x64, 0xfb, 0x1b, 0x96, 0x65, 0x0a, 0xd1, 0x5c, 0x5d,
|
0xa6, 0xb5, 0x46, 0x2c, 0xd5, 0x88, 0x68, 0xed, 0x43, 0x00, 0x84, 0x10, 0x00, 0x8e, 0x03,
|
||||||
0x67, 0x8c, 0x61, 0x4e, 0x0d, 0x57, 0xb9, 0x63, 0x9e, 0x18,
|
0x20, 0xe7, 0x61, 0xbf, 0xc4, 0x7a, 0xff, 0x14, 0xde, 0xfb, 0x94, 0x88, 0xae, 0x48, 0xa2,
|
||||||
0xa6, 0xb5, 0x46, 0x2c, 0xd5, 0x88, 0x68, 0xed, 0x43, 0x00,
|
0x6d, 0x5b, 0x57, 0x80, 0x41, 0xf7, 0xb5, 0xe7, 0x5b, 0xc8, 0x49, 0xa9, 0x32, 0xa8, 0xde,
|
||||||
0x84, 0x10, 0x00, 0x8e, 0x03, 0x20, 0xe7, 0x61, 0xbf, 0xc4,
|
0x0d, 0x73, 0x1b, 0x6b, 0xb1, 0xfb, 0x34, 0xe7, 0x59, 0x5e, 0x30, 0xca, 0xfd, 0xd9, 0xdf,
|
||||||
0x7a, 0xff, 0x14, 0xde, 0xfb, 0x94, 0x88, 0xae, 0x48, 0xa2,
|
0x89, 0xfb, 0xdb, 0xf6, 0xdd, 0xb9, 0xe9, 0x66, 0x21, 0xc9, 0xaf, 0x2a, 0xc6, 0x88, 0xa8,
|
||||||
0x6d, 0x5b, 0x57, 0x80, 0x41, 0xf7, 0xb5, 0xe7, 0x5b, 0xc8,
|
0xd4, 0xdf, 0xc2, 0x2f, 0xb5, 0x13, 0x61, 0x67,
|
||||||
0x49, 0xa9, 0x32, 0xa8, 0xde, 0x0d, 0x73, 0x1b, 0x6b, 0xb1,
|
|
||||||
0xfb, 0x34, 0xe7, 0x59, 0x5e, 0x30, 0xca, 0xfd, 0xd9, 0xdf,
|
|
||||||
0x89, 0xfb, 0xdb, 0xf6, 0xdd, 0xb9, 0xe9, 0x66, 0x21, 0xc9,
|
|
||||||
0xaf, 0x2a, 0xc6, 0x88, 0xa8, 0xd4, 0xdf, 0xc2, 0x2f, 0xb5,
|
|
||||||
0x13, 0x61, 0x67,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AnimationDef animation = {
|
AnimationDef animation = {
|
||||||
.width = 64,
|
.width = 64,
|
||||||
.height = 64,
|
.height = 64,
|
||||||
.frames = 5,
|
.frames = 5,
|
||||||
.buffer = {
|
.buffer = {
|
||||||
sprite_0_Buf,
|
frame0_data,
|
||||||
sprite_1_Buf,
|
frame1_data,
|
||||||
sprite_2_Buf,
|
frame2_data,
|
||||||
sprite_3_Buf,
|
frame3_data,
|
||||||
sprite_4_Buf,
|
frame4_data,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -135,7 +135,7 @@ void ssd1306_Anim(void) {
|
||||||
anim++;
|
anim++;
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
if (anim == 5) {
|
if (anim == animation.frames) {
|
||||||
anim = 1;
|
anim = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# convert gnaa.png +dither -monochrome -colors 2 image.bmp
|
# convert gnaa.png +dither -monochrome -colors 2 image.bmp
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import math
|
import math
|
||||||
import zlib
|
import zlib
|
||||||
|
@ -20,7 +21,7 @@ def set_bit(value, bit):
|
||||||
def clear_bit(value, bit):
|
def clear_bit(value, bit):
|
||||||
return value & ~(1<<bit)
|
return value & ~(1<<bit)
|
||||||
|
|
||||||
def print_array(name, buf, bytes_per_line = 10):
|
def print_array(name, buf, bytes_per_line = 15):
|
||||||
c = 0
|
c = 0
|
||||||
|
|
||||||
print("uint8_t " + name + "[" + str(len(buf)) + "] = {")
|
print("uint8_t " + name + "[" + str(len(buf)) + "] = {")
|
||||||
|
@ -29,7 +30,10 @@ def print_array(name, buf, bytes_per_line = 10):
|
||||||
if c == 0:
|
if c == 0:
|
||||||
print(" ", end='')
|
print(" ", end='')
|
||||||
|
|
||||||
print(format(v, '#04x') + ", ", end='')
|
if c > 0 and c < bytes_per_line:
|
||||||
|
print(' ', end='')
|
||||||
|
|
||||||
|
print(format(v, '#04x') + ",", end='')
|
||||||
c = c + 1
|
c = c + 1
|
||||||
if (c == bytes_per_line):
|
if (c == bytes_per_line):
|
||||||
print()
|
print()
|
||||||
|
@ -40,17 +44,23 @@ def print_array(name, buf, bytes_per_line = 10):
|
||||||
print("};")
|
print("};")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def print_sprites(name, height, width):
|
|
||||||
print("SpriteDef " + name +" = {" + str(height) + ", " + str(width) + ", " + name + '_Buf' + "};")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if (len(sys.argv) < 2):
|
#if (len(sys.argv) < 2):
|
||||||
sys.exit()
|
# sys.exit()
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Convert images to the SSD1306 display.')
|
||||||
|
parser.add_argument("--files", nargs="*", type=str,
|
||||||
|
help="List of files to convert",
|
||||||
|
default=None)
|
||||||
|
parser.add_argument("--header", help="Print header instead of source", action='store_true')
|
||||||
|
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
frames = []
|
frames = []
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
for file in sys.argv[1:]:
|
for file in args.files:
|
||||||
im = Image.open(file)
|
im = Image.open(file)
|
||||||
width, height = im.size
|
width, height = im.size
|
||||||
|
|
||||||
|
@ -59,8 +69,6 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
banks = math.ceil(height / 8);
|
banks = math.ceil(height / 8);
|
||||||
|
|
||||||
#print(banks)
|
|
||||||
|
|
||||||
buf = []
|
buf = []
|
||||||
|
|
||||||
for bank in range(0, banks):
|
for bank in range(0, banks):
|
||||||
|
@ -69,11 +77,9 @@ if __name__ == "__main__":
|
||||||
if (invert == 1):
|
if (invert == 1):
|
||||||
value = 255
|
value = 255
|
||||||
c = 7
|
c = 7
|
||||||
#print("OI")
|
|
||||||
for y in range( (bank * 8 ) + 7, (bank * 8) - 1, -1):
|
for y in range( (bank * 8 ) + 7, (bank * 8) - 1, -1):
|
||||||
#print(bank, x, y)
|
#print(bank, x, y)
|
||||||
b = im.getpixel((x,y))
|
b = im.getpixel((x,y))
|
||||||
|
|
||||||
if (b == 1 or b == 255):
|
if (b == 1 or b == 255):
|
||||||
value = set_bit(value, c)
|
value = set_bit(value, c)
|
||||||
if (invert == 1):
|
if (invert == 1):
|
||||||
|
@ -81,14 +87,37 @@ if __name__ == "__main__":
|
||||||
c = c - 1
|
c = c - 1
|
||||||
buf.append(value)
|
buf.append(value)
|
||||||
|
|
||||||
#buffer = zlib.compress(bytes(buffer))
|
frames.append({'name': 'frame' + str(counter), 'buf': zlib.compress(bytes(buf))})
|
||||||
frames.append({'name': 'sprite_' + str(counter), 'buf': zlib.compress(bytes(buf))})
|
|
||||||
counter = counter + 1
|
counter = counter + 1
|
||||||
|
|
||||||
|
|
||||||
print('#include "sprites.h"')
|
if args.header:
|
||||||
print()
|
print('#include "stm32f4xx_hal.h"')
|
||||||
for item in frames:
|
print()
|
||||||
print_array(item['name'] + "_Buf", item['buf'])
|
print('typedef struct {')
|
||||||
for item in frames:
|
print(' uint8_t width;')
|
||||||
print_sprites(item['name'], height, width)
|
print(' uint8_t height;')
|
||||||
|
print(' uint8_t *buffer;')
|
||||||
|
print('} SpriteDef;')
|
||||||
|
print()
|
||||||
|
print('typedef struct {')
|
||||||
|
print(' uint8_t width;')
|
||||||
|
print(' uint8_t height;')
|
||||||
|
print(' uint8_t frames;')
|
||||||
|
print(' uint8_t *buffer[' + str(len(frames)) + '];')
|
||||||
|
print('} AnimationDef;')
|
||||||
|
print()
|
||||||
|
print('extern AnimationDef animation;')
|
||||||
|
else:
|
||||||
|
print('#include "sprites.h"')
|
||||||
|
print()
|
||||||
|
for item in frames:
|
||||||
|
print_array(item['name'] + "_data", item['buf'])
|
||||||
|
print('AnimationDef animation = {')
|
||||||
|
print(' .width = ' + str(width) + ',')
|
||||||
|
print(' .height = ' + str(height) + ',')
|
||||||
|
print(' .frames = ' + str(len(frames)) + ',')
|
||||||
|
print(' .buffer = {')
|
||||||
|
for item in frames:
|
||||||
|
print(' ' + item['name'] + '_data,')
|
||||||
|
print(' }')
|
||||||
|
print('};')
|
||||||
|
|
Loading…
Reference in New Issue