TB2026-YDS Firmware
Toggle main menu visibility
Loading...
Searching...
No Matches
gfx.h
Go to the documentation of this file.
1
9
#pragma once
10
11
#include <stdint.h>
12
19
20
#define GFX_W 176
21
#define GFX_H 176
22
23
typedef
uint16_t
gfx_color_t
;
24
30
static
inline
gfx_color_t
gfx_rgb(uint8_t r, uint8_t g, uint8_t b)
31
{
32
return
(
gfx_color_t
)(((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3));
33
}
34
35
#define GFX_BLACK ((gfx_color_t)0x0000)
36
#define GFX_WHITE ((gfx_color_t)0xFFFF)
37
38
/* Built-in 5x7 font, drawn in a 6x8 cell (1px gap). Multiply by scale for size. */
39
#define GFX_CHAR_W 6
40
#define GFX_CHAR_H 8
41
43
void
gfx_clear
(
gfx_color_t
color);
44
46
void
gfx_pixel
(
int
x,
int
y,
gfx_color_t
color);
47
49
void
gfx_fill_rect
(
int
x,
int
y,
int
w,
int
h,
gfx_color_t
color);
50
52
void
gfx_draw_rect
(
int
x,
int
y,
int
w,
int
h,
gfx_color_t
color);
53
61
void
gfx_draw_text
(
int
x,
int
y,
const
char
*s,
gfx_color_t
color,
int
scale);
62
76
void
gfx_blit_1bpp
(
int
x,
int
y,
int
w,
int
h,
const
uint8_t *bitmap,
gfx_color_t
color);
77
79
void
gfx_flush
(
void
);
80
85
const
gfx_color_t
*
gfx_buffer
(
void
);
86
gfx_color_t
uint16_t gfx_color_t
Definition
gfx.h:23
gfx_pixel
void gfx_pixel(int x, int y, gfx_color_t color)
Set one pixel; off-canvas coordinates are ignored.
Definition
gfx.c:27
gfx_buffer
const gfx_color_t * gfx_buffer(void)
Read-only access to the framebuffer (GFX_W*GFX_H pixels).
Definition
gfx.c:17
gfx_draw_rect
void gfx_draw_rect(int x, int y, int w, int h, gfx_color_t color)
Draw a 1px rectangle outline.
Definition
gfx.c:46
gfx_clear
void gfx_clear(gfx_color_t color)
Fill the whole framebuffer with one color.
Definition
gfx.c:22
gfx_blit_1bpp
void gfx_blit_1bpp(int x, int y, int w, int h, const uint8_t *bitmap, gfx_color_t color)
Draw a 1-bpp bitmap; set bits are drawn in color, clear bits are skipped.
Definition
gfx.c:110
gfx_flush
void gfx_flush(void)
Blit the framebuffer to the OLED over SPI.
Definition
gfx.c:121
gfx_draw_text
void gfx_draw_text(int x, int y, const char *s, gfx_color_t color, int scale)
Draw an ASCII string (0x20..0x7E) left to right.
Definition
gfx.c:94
gfx_fill_rect
void gfx_fill_rect(int x, int y, int w, int h, gfx_color_t color)
Fill a rectangle, clipped to the canvas.
Definition
gfx.c:33
components
ui
gfx.h
Generated by
1.17.0