avr-firmwares/drivers/framebuffer.h

29 lines
602 B
C

#include <stdint.h>
#include <string.h>
#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) { \
framebuffer[h][(w)>>3] |= (1 << ((w) & 7)); \
} else { \
framebuffer[h][(w)>>3] &= ~(1 << ((w) & 7)); \
}
#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
void fb_fill(uint8_t c);
void fb_shift();