Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_SSD1325.h>
- #define OLED_CS 11
- #define OLED_RESET 10
- #define OLED_DC 12
- Adafruit_SSD1325 display(OLED_DC,OLED_RESET,OLED_CS);
- //61x64 Frost logo
- static const unsigned char PROGMEM img_logo[] = {0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1c,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x77,0xf0,0x0,0x0,0x0,0x0,0x0,0x7,0xf3,0xff,0x0,0x0,0x0,0x0,0x0,0x3d,0x90,0x87,0xe0,0x0,0x0,0x0,0x0,0xfc,0x88,0x40,0xf8,0x0,0x0,0x0,0x1,0xe4,0x48,0x20,0x3c,0x0,0x0,0x0,0x7,0xc4,0x48,0x18,0x1f,0x0,0x0,0x0,0xf,0x4,0x28,0xc,0x7,0x80,0x0,0x0,0x3e,0x4,0x18,0x6,0x3,0xe0,0x0,0x0,0x7c,0x4,0xc,0x83,0x1,0xf0,0x0,0x0,0xf8,0x4,0xc,0x41,0x80,0xf8,0x0,0x1,0xf0,0x42,0x4,0x60,0x80,0xfc,0x0,0x1,0xf0,0x63,0x84,0x20,0x40,0x7c,0x0,0x3,0xe0,0x5b,0x82,0x30,0x60,0x3e,0x0,0x7,0xc4,0x47,0xc2,0x78,0x20,0x1f,0x0,0xf,0xc6,0x20,0xfe,0x38,0x10,0x1f,0x80,0xf,0x8b,0x90,0x1,0x14,0x10,0xf,0x80,0x1f,0x8f,0x98,0x1,0x3c,0x10,0xf,0xc0,0x1f,0x80,0x70,0x0,0xbe,0x8,0xf,0xc0,0x3f,0x0,0xc0,0x0,0x9a,0xc,0x7,0xe0,0x3f,0x1,0x0,0x0,0x5e,0xe,0x7,0xe0,0x3f,0x2,0x40,0x8,0x2f,0xa,0x7,0xe0,0x7e,0x2,0xc1,0x98,0x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f,0xfc,0x0,0x0,0xff,0xe0,0x7,0x0,0x3f,0xf8,0x0,0x0,0x7f,0xf8,0x6,0x0,0xff,0xf0,0x0,0x0,0x3f,0xff,0x6,0x7,0xff,0xe0,0x0,0x0,0xf,0xff,0xf6,0x7f,0xff,0x80,0x0,0x0,0x7,0xff,0xff,0xff,0xff,0x0,0x0,0x0,0x3,0xff,0xff,0xff,0xfe,0x0,0x0,0x0,0x0,0xff,0xff,0xff,0xf8,0x0,0x0,0x0,0x0,0x3f,0xff,0xff,0xe0,0x0,0x0,0x0,0x0,0x7,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0xf8,0x0,0x0,0x0};
- #define BG_X (-1)
- #define BG_Y 22
- #define BG_WIDTH 68
- #define BG_HEIGHT 84
- static const unsigned char PROGMEM img_bg[] = {0x0,0x0,0x0,0x0,0x0,0x3,0x80,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xf,0xe0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1f,0xf0,0x0,0x0,0x0,0x0,0x0,0xc,0x0,0x1f,0xf8,0x0,0x0,0x0,0x0,0x0,0x1e,0x0,0x1f,0xf8,0x0,0x0,0x0,0x0,0x0,0x3f,0x0,0x3f,0xfc,0x0,0x0,0x0,0x0,0x0,0x7f,0x80,0x3f,0xfe,0x0,0x0,0x0,0x0,0x0,0x7f,0xc0,0x7f,0xfe,0x0,0x0,0x0,0x0,0x0,0xff,0xe3,0xff,0xff,0x0,0x0,0x0,0x0,0x0,0xff,0xe7,0xff,0xff,0x80,0x0,0x0,0x0,0x0,0xff,0xff,0xff,0xff,0x80,0x0,0x0,0x0,0x0,0xff,0xff,0xff,0xff,0xc0,0x0,0x0,0x0,0x1,0xff,0xff,0xff,0xff,0xc0,0x0,0x0,0x0,0x1,0xff,0xff,0xff,0xff,0xe0,0x0,0x0,0x0,0x1,0xff,0xff,0xff,0xff,0xe0,0x0,0x0,0x0,0x1,0xff,0xff,0xff,0xff,0xe0,0x0,0x0,0x0,0x3,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x0,0x3,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x0,0x3,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x0,0x3,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x0,0x7,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x0,0x7,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x0,0xf,0xff,0xff,0xff,0xff,0xf8,0x0,0x0,0x0,0xf,0xff,0xff,0xff,0xff,0xfc,0x0,0x0,0x0,0xf,0xff,0xff,0xff,0xff,0xfc,0x0,0x0,0x6,0xf,0xff,0xff,0xff,0xff,0xfc,0x0,0x3,0xcf,0xdf,0xff,0xff,0xff,0xff,0xfc,0x0,0x7,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0xe,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x4,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xfe,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xfc,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xf8,0x0,0x0,0x7f,0xff,0xff,0xff,0xff,0xff,0xf8,0x0,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xf0,0x0,0x0,0x3f,0xff,0xff,0xff,0xff,0xff,0xe7,0xc0,0x3e,0x1f,0xff,0xff,0xff,0xff,0xff,0xcf,0xe0,0x7f,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0xff,0xbf,0xff,0xff,0xff,0xff,0xff,0xff,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x80,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0x1f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x0,0xf,0xff,0xfb,0xff,0xff,0xff,0xff,0xff,0x0,0x7,0xff,0xf9,0xff,0xff,0xff,0xff,0xff,0x0,0x7,0xff,0xf9,0xff,0xff,0xff,0xff,0xff,0x0,0x3,0xff,0xf1,0xff,0xff,0xff,0xff,0xff,0x0,0x3,0xff,0xf1,0xff,0xff,0xff,0xff,0xff,0x0,0x1,0xff,0xe1,0xff,0xff,0xff,0xff,0xff,0x0,0x0,0xf3,0xc0,0xff,0xff,0xff,0xfc,0xfe,0x0,0x0,0x61,0x80,0x7f,0xff,0xff,0xf8,0x7c,0x0};
- #define FG_X (-2)
- #define FG_Y 21
- #define FG_WIDTH 70
- #define FG_HEIGHT 86
- static const unsigned char PROGMEM img_fg[] = {0x0,0x0,0x0,0x0,0x0,0x1,0xc0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x9,0xc8,0x0,0x0,0x0,0x0,0x0,0x6,0x0,0x13,0x64,0x0,0x0,0x0,0x0,0x0,0x9,0x0,0x12,0xb2,0x0,0x0,0x0,0x0,0x0,0x10,0x80,0x13,0x52,0x0,0x0,0x0,0x0,0x0,0x26,0x40,0x26,0xa9,0x0,0x0,0x0,0x0,0x0,0x4d,0x20,0x25,0x54,0x80,0x0,0x0,0x0,0x0,0x4a,0x91,0xca,0xac,0x80,0x0,0x0,0x0,0x0,0x95,0x4a,0xd,0x96,0x40,0x0,0x0,0x0,0x0,0x9a,0xcc,0xa,0x9b,0x20,0x0,0x0,0x0,0x0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0x10,0x1a,0x80,0x0,0x18,0x8,0x40,0x51,0xc0,0x0,0x1,0x3f,0xff,0xc3,0xc8,0x9f,0x24,0x1f,0x7c,0xf8,0x40,0x6,0x24,0x48,0x90,0x8a,0x21,0x42,0x88,0x40,0x5,0x18,0x90,0x90,0x89,0x21,0x42,0x88,0x40,0x5,0x0,0x90,0x48,0x50,0xc2,0x42,0x88,0x41,0xfc,0x80,0x90,0x48,0x60,0x2,0x42,0x88,0x42,0x0,0x81,0x20,0x26,0xaa,0xac,0x6a,0xa8,0x6b,0xfc,0x6b,0x20,0x25,0x55,0x54,0x56,0xd8,0x35,0x54,0x56,0x40,0x12,0xaa,0xa8,0x6a,0xa8,0x2a,0xac,0x2a,0x40,0x13,0x55,0x58,0x56,0xd8,0x35,0x54,0x36,0x40,0x9,0xaa,0xa8,0x6a,0xa8,0x2b,0xfc,0x2a,0x40,0x9,0xff,0xf2,0x7e,0xf8,0x3e,0x0,0x3e,0x40,0x4,0xff,0xf3,0x3e,0xff,0x7f,0xfc,0x3e,0x40,0x4,0xf9,0xf3,0x3e,0xff,0x7f,0xfe,0x3e,0x40,0x2,0x79,0xe5,0x3e,0xff,0x7f,0xfe,0x3e,0x40,0x2,0x78,0xe5,0x3e,0xff,0x7f,0xfe,0x3e,0x40,0x1,0x30,0xc9,0x3e,0xff,0x3f,0xfc,0x3e,0x40,0x0,0x86,0x10,0x80,0x0,0x0,0x1,0x80,0x80,0x0,0x49,0x20,0x40,0x0,0x0,0x2,0x41,0x0,0x0,0x30,0xc0,0x3f,0xff,0xff,0xfc,0x3e,0x0};
- #define LOGO_X 8
- #define LOGO_Y 30
- #define LOGO_WIDTH 48
- #define LOGO_HEIGHT 48
- //telegram
- static const unsigned char PROGMEM logo_tg[] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x7,0x0,0x0,0x0,0x0,0x0,0x3f,0x0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0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
- //instagram
- static const unsigned char PROGMEM logo_ig[] = {0x0,0x4f,0xff,0xff,0xff,0x0,0x2,0x4f,0xff,0xff,0xff,0xc0,0x2,0x4f,0xff,0xff,0xff,0xf0,0x12,0x4f,0xff,0xff,0xff,0xf8,0x32,0x4f,0xff,0xff,0xf0,0x3c,0x32,0x4f,0xff,0xff,0xe0,0x1c,0x72,0x4f,0xff,0xff,0xe0,0x1e,0x72,0x4f,0xff,0xff,0xe0,0x1e,0xf2,0x4f,0xff,0xff,0xe0,0x1f,0xf2,0x4f,0xff,0xff,0xe0,0x1f,0xf2,0x4f,0xff,0xff,0xe0,0x1f,0xf2,0x4f,0xff,0xff,0xf0,0x3f,0xff,0xff,0xf0,0xf,0xff,0xff,0xff,0xff,0xc0,0x3,0xff,0xff,0xff,0xff,0x0,0x0,0xff,0xff,0x0,0x0,0x7,0xe0,0x0,0x0,0x0,0x0,0x1f,0xf8,0x0,0x0,0xff,0xfc,0x3f,0xfc,0x3f,0xff,0xff,0xf8,0x7c,0x3e,0x1f,0xff,0xff,0xf8,0xf0,0xf,0x1f,0xff,0xff,0xf0,0xe0,0x7,0xf,0xff,0xff,0xf1,0xe0,0x7,0x8f,0xff,0xff,0xf1,0xc0,0x3,0x8f,0xff,0xff,0xf1,0xc0,0x3,0x8f,0xff,0xff,0xf1,0xc0,0x3,0x8f,0xff,0xff,0xf1,0xc0,0x3,0x8f,0xff,0xff,0xf1,0xe0,0x7,0x8f,0xff,0xff,0xf0,0xe0,0x7,0xf,0xff,0xff,0xf8,0xf0,0xf,0x1f,0xff,0xff,0xf8,0x7c,0x3e,0x1f,0xff,0xff,0xfc,0x3f,0xfc,0x3f,0xff,0xff,0xfc,0x1f,0xf8,0x3f,0xff,0xff,0xfe,0x7,0xe0,0x7f,0xff,0xff,0xff,0x0,0x0,0xff,0xff,0xff,0xff,0xc0,0x3,0xff,0xff,0xff,0xff,0xf0,0xf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0xfe,0x7f,0xff,0xff,0xff,0xff,0xfe,0x3f,0xff,0xff,0xff,0xff,0xfc,0x3f,0xff,0xff,0xff,0xff,0xfc,0x1f,0xff,0xff,0xff,0xff,0xf8,0xf,0xff,0xff,0xff,0xff,0xf0,0x3,0xff,0xff,0xff,0xff,0xc0,0x0,0xff,0xff,0xff,0xff,0x0};
- //furaffinity
- static const unsigned char PROGMEM logo_fa[] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xff,0xff,0xfe,0x7f,0xff,0x3,0xff,0xff,0xfe,0x7f,0xff,0xf,0xff,0xff,0xfe,0x7f,0xff,0x1f,0xff,0xff,0xfe,0x7,0xfe,0x3f,0xff,0xff,0xff,0x3,0xfe,0x3f,0xff,0xff,0xff,0xf3,0xfe,0x7f,0xff,0xff,0xff,0xf3,0xfc,0xff,0xe0,0x0,0xff,0xf3,0xfc,0xff,0x80,0x0,0x3f,0xf3,0xfc,0xff,0x80,0x0,0x1f,0xf0,0x7c,0xff,0x80,0x0,0x1f,0xf8,0x3c,0xff,0x80,0x0,0xf,0xff,0x3c,0xff,0xff,0xf8,0xf,0xff,0x3c,0xff,0xff,0xfc,0xf,0xff,0x0,0xff,0xff,0xfc,0xf,0xff,0x80,0xff,0xff,0xfc,0xf,0xff,0xfc,0xff,0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,0xff,0xe0,0xf7,0xff,0xff,0xff,0xff,0xe0,0xff,0xff,0xff,0xff,0xff,0xe0,0x7f,0xff,0xff,0xff,0xff,0xe0,0x3f,0xff,0xff,0xff,0xff,0xc0,0x3f,0xff,0xff,0xff,0xff,0xc0,0x1f,0xff,0xff,0xff,0xff,0xc0,0x1f,0xff,0xff,0xff,0xff,0xc0,0xf,0xff,0xff,0xff,0xff,0x80,0x3,0xff,0xff,0xff,0xff,0x80,0x0,0xff,0xff,0xff,0xff,0x0,0x7,0xff,0xff,0xff,0xff,0x0,0x7,0xff,0xff,0xff,0xfe,0x0,0x3,0xff,0xff,0xff,0xfe,0x0,0x3,0xff,0xff,0xff,0xfc,0x0,0x1,0xff,0xff,0xff,0xf8,0x0,0x0,0x7f,0xff,0xff,0xf0,0x0,0x0,0x1f,0xff,0xff,0xf0,0x0,0x0,0x7,0xff,0xff,0xe0,0x0,0x0,0x1f,0xff,0xff,0xc0,0x0,0x0,0x7f,0xff,0xff,0x80,0x0,0x3,0xff,0xff,0xfe,0x0,0x0,0xff,0xff,0xff,0xfc,0x0,0x0,0x3f,0xff,0xff,0xf0,0x0,0x0,0xf,0xff,0xff,0xc0,0x0,0x0,0x3,0xff,0xfe,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
- //sprites for background animation
- #define SPRITE_WIDTH 16
- #define SPRITE_HEIGHT 16
- #define SPRITE_PADDING 8
- #define SPRITE_SIZE (SPRITE_PADDING+SPRITE_WIDTH)
- static const unsigned char PROGMEM sprite_1up[] = {0x7,0xe0,0x1e,0x78,0x2e,0x74,0x4c,0x32,0x60,0x6,0xf3,0xcf,0xf7,0xef,0xf7,0xef,0xe3,0xc7,0x80,0x1,0x8f,0xf1,0x9d,0xb9,0x7d,0xbe,0x3f,0xfc,0x3f,0xfc,0x1f,0xf8};
- static const unsigned char PROGMEM sprite_block[] = {0x7f,0xfe,0x80,0x1,0xa0,0x5,0x87,0xc1,0x8c,0x61,0x8c,0x61,0x8c,0x61,0x80,0xe1,0x81,0x81,0x81,0x81,0x80,0x1,0x81,0x81,0x81,0x81,0xa0,0x5,0x80,0x1,0xff,0xff};
- static const unsigned char PROGMEM sprite_coin[] = {0x0,0x0,0x7,0xe0,0x8,0x30,0xb,0x30,0x14,0x98,0x14,0x98,0x14,0x98,0x14,0x98,0x14,0x98,0x14,0x98,0x14,0x98,0x14,0x98,0xb,0x30,0x8,0x30,0x7,0xe0,0x0,0x0};
- static const unsigned char PROGMEM sprite_goomba[] = {0x3,0xc0,0x7,0xe0,0xf,0xf0,0x1f,0xf8,0x27,0xe4,0x73,0xce,0x74,0x2e,0xf5,0xaf,0xf1,0x8f,0xff,0xff,0x7f,0xfe,0x8,0x10,0x8,0x1c,0x18,0x3e,0x1f,0xfe,0xe,0x7c};
- static const unsigned char PROGMEM sprite_mario[] = {0x7,0xc0,0xf,0xf8,0x9,0xa0,0x1b,0xb8,0x19,0xdc,0x1f,0x80,0x7,0xf0,0xf,0xd0,0x12,0x48,0x23,0xc4,0x35,0xac,0x37,0xec,0x37,0xec,0xe,0x70,0x14,0x28,0x3c,0x3c};
- static const unsigned char PROGMEM sprite_mushroom[] = {0x3,0xc0,0x4,0x60,0x8,0xf0,0x10,0xf8,0x20,0x74,0x5c,0x2,0x7e,0x2,0xbe,0xd,0xbe,0xf,0x9c,0x7,0x80,0x1,0x77,0xee,0xf,0xf0,0xf,0xd0,0xf,0xd0,0x7,0xa0};
- static const unsigned char PROGMEM sprite_shell[] = {0x0,0x0,0x7,0xe0,0xb,0xd0,0x14,0x28,0x18,0x18,0x30,0xc,0x28,0x14,0x44,0x22,0x43,0xc2,0xe4,0x27,0xf8,0x1f,0x18,0x18,0xc,0x30,0x7,0xe0,0x3,0xc0,0x0,0x0};
- static const unsigned char PROGMEM sprite_star[] = {0x1,0x80,0x1,0x80,0x3,0xc0,0x3,0xc0,0x7,0xe0,0x7f,0xfe,0x7d,0xbe,0x3d,0xbc,0x1d,0xb8,0xf,0xf0,0xf,0xf0,0x1f,0xf8,0x1f,0xf8,0x1e,0x78,0x38,0x1c,0x30,0xc};
- //battery, 27*5
- static const unsigned char PROGMEM bmp_battery[] = {0xce,0xee,0xee,0xa0,0xaa,0x44,0x8a,0xa0,0xce,0x44,0xcc,0x40,0xaa,0x44,0x8a,0x40,0xca,0x44,0xea,0x40};
- //sleep icon, 34*35
- static const unsigned char PROGMEM bmp_sleep[] = {0x0,0x1,0xe0,0x0,0x0,0x0,0x3,0xf0,0x0,0x0,0x0,0x3,0xf0,0x0,0x0,0x0,0x3,0xf0,0x0,0x0,0x0,0x3,0xf0,0x0,0x0,0x1,0xe3,0xf1,0xe0,0x0,0x3,0xe3,0xf1,0xf0,0x0,0x7,0xe3,0xf1,0xf8,0x0,0xf,0xe3,0xf1,0xfc,0x0,0x1f,0xc3,0xf0,0xfe,0x0,0x3f,0x83,0xf0,0x7f,0x0,0x3f,0x3,0xf0,0x3f,0x0,0x7e,0x3,0xf0,0x1f,0x80,0x7e,0x3,0xf0,0x1f,0x80,0x7c,0x3,0xf0,0xf,0x80,0xfc,0x3,0xf0,0xf,0xc0,0xf8,0x3,0xf0,0x7,0xc0,0xf8,0x3,0xf0,0x7,0xc0,0xf8,0x3,0xf0,0x7,0xc0,0xf8,0x1,0xe0,0x7,0xc0,0xf8,0x0,0x0,0x7,0xc0,0xf8,0x0,0x0,0x7,0xc0,0xfc,0x0,0x0,0xf,0xc0,0x7c,0x0,0x0,0xf,0x80,0x7e,0x0,0x0,0x1f,0x80,0x7e,0x0,0x0,0x1f,0x80,0x3f,0x0,0x0,0x3f,0x0,0x3f,0x80,0x0,0x7e,0x0,0x1f,0xc0,0x0,0xfe,0x0,0xf,0xf0,0x3,0xfc,0x0,0x7,0xff,0xff,0xf8,0x0,0x3,0xff,0xff,0xf0,0x0,0x1,0xff,0xff,0xe0,0x0,0x0,0x7f,0xff,0x80,0x0,0x0,0x1f,0xfe,0x0,0x0};
- #define BUTTON 5
- #define ANIM_STEPS 9
- #define NUM_SLIDES 3
- int8_t anim_x = 0;
- int8_t anim_y = 0;
- int8_t anim_xvel = 1;
- int8_t anim_yvel = 1;
- byte anim_spritesx[4] = {0,1,2,3};
- byte anim_spritesy[7] = {0,1,2,3,4,5,6};
- #define TABLE_SIZE 64
- #define FLOAT_SIZE 10
- byte acceltable[TABLE_SIZE];
- int8_t floattable[] = {0,1,2,2,1,0,-1,-2,-2,-1};
- #define SLEEP_TIME (5*24*60*1000)
- byte image = 0;
- unsigned long starttime,progstarttime,sleepstarttime;
- byte sleeping = 0;
- byte timeout = 0;
- byte offsetindex = 0;
- int8_t offset = 0;
- #define BKG_NONE 0
- #define BKG_STARS 1
- #define BKG_GRID 2
- byte bkg_anim = BKG_STARS;
- #define VOLT_LOW 3.5
- byte prevstate = 0;
- void setup()
- {
- Serial.begin(112500);
- pinMode(BUTTON,INPUT_PULLUP);
- display.begin();
- display.setRotation(3);
- display.clearDisplay();
- display.setTextColor(1);
- display.setTextSize(1);
- display.setTextWrap(false);
- display.drawBitmap(2,31,img_logo,61,64,1);
- display.setTextColor(0);
- display.display();
- for(byte i = 0; i < TABLE_SIZE; i++)
- {
- float curpos = float(map(i,0,TABLE_SIZE - 1,0,100)) / 100.0;
- acceltable[i] = pow(curpos,2) * 255;
- }
- delay(1000);
- display.clearDisplay();
- progstarttime = millis();
- sleepstarttime = millis();
- Serial.begin(112500);
- }
- void loop()
- {
- while(sleeping)
- {
- if(getButton())
- {
- while(getButton()) { delay(5); }
- sleeping = 0;
- sleepstarttime = millis();
- image = 0;
- prevstate = 0;
- }
- }
- smoothAnimation(63,0,offset,image,1,0); //image enter animation
- unsigned long floattime = millis();
- unsigned long starttime = millis();
- unsigned long presstime = 0;
- byte cont = 0;
- while(!cont)
- {
- if(getButton() > prevstate) { presstime = millis(); }
- else if(getButton() < prevstate) { cont = 1; }
- prevstate = getButton();
- if(millis() - starttime > SLEEP_TIME || (millis() - presstime > 3000 && getButton()))
- {
- sleepMode();
- return;
- }
- display.clearDisplay();
- updateAndDrawBkg(); //draw background animation
- drawImage(0,offset,image); //draw image overtop of animation
- display.display();
- if(millis() - floattime > 150)
- {
- offsetindex++;
- if(offsetindex > 9) { offsetindex = 0; }
- offset = floattable[offsetindex];
- floattime = millis();
- }
- if(image > 0) { image = ((millis() - starttime) / 1500) % 2 + 1; }
- }
- smoothAnimation(0,-63,offset,image,1,1); //image exit animation
- image = !image > 0;
- }
- void sleepMode()
- {
- sleeping = 1;
- for(byte i = 0; i < 64; i += 8)
- {
- display.fillRect(0,i,64,8,0);
- display.fillRect(0,128 - i,64,8,0);
- display.display();
- }
- display.clearDisplay();
- display.drawBitmap(15,47,bmp_sleep,34,35,1);
- const byte barwidth = 30;
- byte xpos = (64 - barwidth) / 2;
- display.drawBitmap(19,116,bmp_battery,27,5,1);
- display.drawRect(xpos,122,barwidth,6,1);
- display.fillRect(xpos + 2,124,map(getBatteryLevel(),0,101,1,barwidth - 3),2,1);
- display.display();
- display.setTextColor(0);
- delay(1000);
- while(getButton()) { delay(5); }
- display.clearDisplay();
- display.display();
- }
- void drawImage(int x,int y,byte image)
- {
- if(image == 0) //draw badge
- {
- display.drawBitmap(x + BG_X,y + BG_Y,img_bg,BG_WIDTH,BG_HEIGHT,1); //background
- display.drawBitmap(x + FG_X,y + FG_Y,img_fg,FG_WIDTH,FG_HEIGHT,0); //foreground
- }
- else //draw a logo
- {
- display.fillRoundRect(x + 3,y + 24,58,78,8,1);
- display.drawRoundRect(x + 2,y + 23,60,80,9,0);
- switch(image)
- {
- case 1: //telegram
- display.drawBitmap(x + LOGO_X,y + LOGO_Y,logo_tg,LOGO_WIDTH,LOGO_HEIGHT,0);
- break;
- case 2: //twitter
- display.drawBitmap(x + LOGO_X,y + LOGO_Y,logo_tw,LOGO_WIDTH,LOGO_HEIGHT,0);
- break;
- }
- display.setCursor(x + getCenterX(7) - 1,y + 81); display.print(F("username"));
- display.setCursor(x + getCenterX(7) + 2,y + 90); display.print(F("put here"));
- }
- }
- void smoothAnimation(int fromx,int tox,int yoffset,byte image,byte stars,byte accel)
- {
- for(int i = 0; i < ANIM_STEPS; i++)
- {
- display.clearDisplay();
- if(stars) { updateAndDrawBkg(); }
- int xpos = smoothCurve(map(i,0,ANIM_STEPS - 1,fromx,tox),fromx,tox,accel);
- drawImage(xpos,yoffset,image);
- display.display();
- }
- }
- void updateAndDrawBkg()
- {
- byte max_draw = 7 * SPRITE_SIZE;
- int draw_x,draw_y;
- byte draw_spr;
- for(byte x = 0; x < 4; x++)
- {
- for(byte y = 0; y < 7; y++)
- {
- draw_x = (anim_x - SPRITE_SIZE) + (SPRITE_SIZE * x);
- draw_y = (anim_y - SPRITE_SIZE) + (SPRITE_SIZE * y);
- draw_spr = (anim_spritesx[x] + anim_spritesy[y]) % 8;
- drawSprite(draw_x,draw_y,draw_spr);
- }
- }
- anim_x += anim_xvel;
- if(anim_x >= SPRITE_SIZE)
- {
- for(int i = 3; i >= 1; i--) { anim_spritesx[i] = anim_spritesx[i-1]; }
- anim_spritesx[0] = anim_spritesx[1] - 1;
- if(anim_spritesx[0] > 7) { anim_spritesx[0] = 7; }
- anim_x %= SPRITE_SIZE;
- }
- anim_y += anim_yvel;
- if(anim_y >= SPRITE_SIZE)
- {
- for(int i = 6; i >= 1; i--) { anim_spritesy[i] = anim_spritesy[i-1]; }
- anim_spritesy[0] = anim_spritesy[1] - 1;
- if(anim_spritesy[0] > 7) { anim_spritesy[0] = 7; }
- anim_y %= SPRITE_SIZE;
- }
- }
- void drawSprite(int x,int y,byte s)
- {
- switch(s)
- {
- case 0: display.drawBitmap(x,y,sprite_1up,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- case 1: display.drawBitmap(x,y,sprite_block,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- case 2: display.drawBitmap(x,y,sprite_coin,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- case 3: display.drawBitmap(x,y,sprite_goomba,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- case 4: display.drawBitmap(x,y,sprite_mario,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- case 5: display.drawBitmap(x,y,sprite_mushroom,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- case 6: display.drawBitmap(x,y,sprite_shell,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- case 7: display.drawBitmap(x,y,sprite_star,SPRITE_WIDTH,SPRITE_HEIGHT,1); break;
- }
- }
- byte getButton()
- {
- return !digitalRead(BUTTON);
- }
- void waitForButtonUp()
- {
- while(getButton()) { delay(5); }
- }
- float getVoltage()
- {
- float measuredvbat = analogRead(A7);
- measuredvbat *= 2; // we divided by 2, so multiply back
- measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage
- measuredvbat /= 1024; // convert to voltage
- return measuredvbat;
- }
- byte getBatteryLevel()
- {
- const byte tablesize = 3;
- const int leveltable[3] = {320,370,420};
- const byte target[3] = {5,50,100};
- for(byte i = 0; i < tablesize - 1; i++)
- {
- int volt = getVoltage() * 100.0;
- if(volt < leveltable[i + 1])
- {
- return constrain(map(volt,leveltable[i],leveltable[i + 1] - 1,target[i],target[i + 1]),0,100);
- }
- }
- return 100;
- }
- int smoothCurve(int cur,int lower,int upper,byte accel)
- {
- int pos;
- byte curvevalue;
- if(accel)
- {
- pos = map(cur,lower,upper,0,TABLE_SIZE - 1);
- curvevalue = acceltable[pos];
- }
- else
- {
- pos = map(cur,lower,upper,TABLE_SIZE - 1,0);
- curvevalue = 255 - acceltable[pos];
- }
- return map(curvevalue,0,255,lower,upper);
- }
- int getCenterX(byte chars)
- {
- return (64 - (chars * 6)) / 2;
- }
Advertisement
Add Comment
Please, Sign In to add comment