|
|
|
@ -13,10 +13,20 @@ |
|
|
|
|
#define FBSET 0xFF |
|
|
|
|
#define FBCLEAR 0x00 |
|
|
|
|
|
|
|
|
|
/// Width/height type
|
|
|
|
|
typedef uint16_t fbsize_t; |
|
|
|
|
/// Position type (X/Y)
|
|
|
|
|
typedef uint8_t fbpos_t; |
|
|
|
|
/// Color type
|
|
|
|
|
typedef uint8_t fbcolor_t; |
|
|
|
|
|
|
|
|
|
/// Bitmap struct
|
|
|
|
|
typedef struct { |
|
|
|
|
const uint8_t *data; |
|
|
|
|
fbsize_t width; |
|
|
|
|
fbsize_t height; |
|
|
|
|
} fb_bitmap_t; |
|
|
|
|
|
|
|
|
|
#define FB_LEN ((FBH / 8) * FBW) |
|
|
|
|
|
|
|
|
|
/// Framebuffer backing array.
|
|
|
|
@ -69,11 +79,22 @@ void fb_rect(fbpos_t x, fbpos_t y, fbpos_t w, fbpos_t h, fbcolor_t color); |
|
|
|
|
/// Draw a frame (unfilled rect)
|
|
|
|
|
void fb_frame(fbpos_t x, fbpos_t y, fbpos_t w, fbpos_t h, fbpos_t thickness, fbcolor_t color); |
|
|
|
|
|
|
|
|
|
#if IS_AVR |
|
|
|
|
/// Draw a bitmap from progmem
|
|
|
|
|
void fb_bitmap_P(fbpos_t x, fbpos_t y, fbpos_t w, fbpos_t h, const uint8_t *map, fbcolor_t color); |
|
|
|
|
#if IS_AVR |
|
|
|
|
void fb_bitmap_ex_P(fbpos_t x, fbpos_t y, fbpos_t w, fbpos_t h, const uint8_t *map, fbcolor_t color); |
|
|
|
|
#else |
|
|
|
|
void fb_bitmap(fbpos_t x, fbpos_t y, fbpos_t w, fbpos_t h, const uint8_t *map, fbcolor_t color); |
|
|
|
|
void fb_bitmap_ex(fbpos_t x, fbpos_t y, fbpos_t w, fbpos_t h, const uint8_t *map, fbcolor_t color); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/// Draw a bitmap using the bitmap struct
|
|
|
|
|
#if IS_AVR |
|
|
|
|
static inline void fb_bitmap_P(fbpos_t x, fbpos_t y, const fb_bitmap_t *bitmap) { |
|
|
|
|
fb_bitmap_ex_P(x, y, bitmap->width, bitmap->height, bitmap->data, 1); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
static inline void fb_bitmap(fbpos_t x, fbpos_t y, const fb_bitmap_t *bitmap) { |
|
|
|
|
fb_bitmap_ex(x, y, bitmap->width, bitmap->height, bitmap->data, 1); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
/// Draw a circle
|
|
|
|
|