|
|
|
@ -2,18 +2,14 @@ |
|
|
|
|
// Created by MightyPork on 2022/11/12.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "user_interface.h" |
|
|
|
|
#include "framebuffer.h" |
|
|
|
|
#include "ssd1306.h" |
|
|
|
|
|
|
|
|
|
/* Tiny framebuffer */ |
|
|
|
|
#define FBW DISPLAY_W |
|
|
|
|
#define FBH DISPLAY_H |
|
|
|
|
|
|
|
|
|
#define MIN(a,b) ((a)>(b)?(b):(a)) |
|
|
|
|
#define MAX(a,b) ((a)>(b)?(a):(b)) |
|
|
|
|
|
|
|
|
|
static uint8_t fb[(FBH/8)*FBW]; |
|
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
|
|
uint8_t fb[(FBH / 8) * FBW]; |
|
|
|
|
|
|
|
|
|
/** Fill with a vertical pattern, 1 byte */ |
|
|
|
|
void fb_fill(uint8_t pattern) { |
|
|
|
@ -245,7 +241,7 @@ void fb_bitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, u |
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
for (uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = (map[i + mapc0] & (0xFF << (8 - rowrem))) >> rowrem; |
|
|
|
|
uint8_t mask = (map[i + mapc0] & (0xFF << (8 - rowrem))) >> (8 - rowrem); |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
@ -260,42 +256,6 @@ void fb_bitmap(uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *map, u |
|
|
|
|
} |
|
|
|
|
mapc0 += w0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
// Middle
|
|
|
|
|
uint8_t whole_cells = h / 8; |
|
|
|
|
h -= whole_cells * 8; |
|
|
|
|
for(uint8_t j = 0; j < whole_cells; j++) { |
|
|
|
|
cell += FBW; |
|
|
|
|
mapc0 += w0; |
|
|
|
|
for(uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = map[i + mapc0]; |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
|
fb[cell + i] &= ~mask; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
mapc0 += w0; |
|
|
|
|
cell += FBW; |
|
|
|
|
|
|
|
|
|
// last
|
|
|
|
|
for(uint8_t i = 0; i < w; i++) { |
|
|
|
|
uint8_t mask = map[i + mapc0] & (0xFF >> (8-h)); |
|
|
|
|
if (color) { |
|
|
|
|
fb[cell + i] |= mask; |
|
|
|
|
} else { |
|
|
|
|
fb[cell + i] &= ~mask; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void fb_blit() { |
|
|
|
|
ssd1306_drawBuffer(0, 0, FBW, FBH, fb); |
|
|
|
|
} |
|
|
|
|