2018-10-03 02:53:55 +02:00
|
|
|
#include <stdint.h>
|
2018-10-03 09:16:54 +02:00
|
|
|
#include <string.h>
|
2018-10-03 02:53:55 +02:00
|
|
|
|
|
|
|
#define CEILDIV(x, y) (((x)+((y)-1))/(y))
|
|
|
|
|
|
|
|
#if FB_DEPTH==1
|
|
|
|
|
|
|
|
#define FB_WIDTH_BYTES CEILDIV(FB_WIDTH, 8)
|
|
|
|
#define FRAMEBUFFER uint8_t framebuffer[FB_HEIGHT][FB_WIDTH_BYTES];
|
|
|
|
#define FB_SET(w,h,c) if (c) { \
|
2018-10-03 09:16:54 +02:00
|
|
|
framebuffer[h][(w)>>3] |= (1 << ((w) & 7)); \
|
2018-10-03 02:53:55 +02:00
|
|
|
} else { \
|
2018-10-03 09:16:54 +02:00
|
|
|
framebuffer[h][(w)>>3] &= ~(1 << ((w) & 7)); \
|
2018-10-03 02:53:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#elif FB_DEPTH==8
|
|
|
|
|
|
|
|
#define FRAMEBUFFER uint8_t framebuffer][FB_HEIGHT][FB_WIDTH];
|
|
|
|
#define FB_SET(w,h,c) framebuffer[h][w] = c
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef DONT_DECLARE_FRAMEBUFFER
|
|
|
|
extern FRAMEBUFFER
|
|
|
|
#endif
|
2018-10-03 09:16:54 +02:00
|
|
|
|
|
|
|
void fb_fill(uint8_t c);
|
|
|
|
void fb_shift();
|
2018-10-06 16:28:04 +02:00
|
|
|
void fb_hline(uint8_t y, uint8_t x1, uint8_t x2, uint8_t c);
|
|
|
|
void fb_vline(uint8_t x, uint8_t y1, uint8_t y2, uint8_t c);
|
|
|
|
void fb_box(uint8_t ax, uint8_t ay, uint8_t bx, uint8_t by, uint8_t c);
|
|
|
|
void fb_area(uint8_t ax, uint8_t ay, uint8_t bx, uint8_t by, uint8_t c);
|