-
Notifications
You must be signed in to change notification settings - Fork 2
/
fb.h
75 lines (52 loc) · 1.36 KB
/
fb.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef fb_h_INCLUDED
#define fb_h_INCLUDED
#include <stdint.h>
#include "rpi-mailbox-interface.h"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define SCREEN_DEPTH 16
#define COLOUR_DELTA 0.05
typedef struct{
uint16_t r;
uint16_t g;
uint16_t b;
uint16_t a;
}color_t;
extern unsigned char FONT[];
rpi_mailbox_property_t* mp;
#define RGB(r, g, b) ((((r) >> 3)<<11) | (((g)>>2)<<5) | ((b)>>3))
#define COLOR_BLACK RGB(0, 0, 0)
#define COLOR_GREEN RGB(0, 255, 0)
#define COLOR_CYAN RGB(0, 255, 255)
#define COLOR_RED RGB(255, 0, 0)
#define COLOR_YELLOW RGB(255, 255, 0)
#define COLOR_WHITE RGB(255, 255, 255)
#define CONSOLE_WHITE COLOR_WHITE
#define CONSOLE_BLACK COLOR_BLACK
#define CONSOLE_GREEN COLOR_GREEN
#define CONSOLE_CYAN COLOR_CYAN
#define CONSOLE_RED COLOR_RED
#define CONSOLE_YELLOW COLOR_YELLOW
typedef struct{
uint32_t width;
uint32_t height;
uint32_t vwidth;
uint32_t vheight;
uint32_t pitch;
uint32_t depth;
uint16_t fore;
uint16_t back;
uint32_t x;
uint32_t y;
uint32_t fb;
uint32_t size;
}fb_t;
fb_t fb;
void fb_init();
void console_drawc(int c);
void console_puts(const char *s);
void clear();
void newline();
void draw_char(const int c, const int x, int y, const uint16_t fore, uint16_t back);
void draw_pixel(const int x, const int y, const uint16_t color);
#endif // fb_h_INCLUDED