blob: a804d1475b750b50a46480ee1ae80db243c461a3 (
plain)
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
|
#include <string.h>
#include "ssd1306_display_driver.h"
#include "paint.h"
#include "br24t_eeprom_driver.h"
#define TWOD_INDEX(x, y) ((y * SCREEN_RES_Y) / 8) + x //TODO rename to insinuate /8
//
/** I'm not using the screen's buffer as a standard 2d array,
* this is because of how pixels are represented in the display's GDRAM.
*
* While it would be nicer to just resort the array every time it's updated,
* keeping driver abstractions in it's own file (like we should),
* this way we don't have to resort every time we redraw.
*
* Some operations may not need a resort, for example, images/videos optmimized
* for GDRAM. Doing it in each function helps us prevent unnessesary calculations
* while doing real time operations like videos.
*/
void screen_clear() { memset(&screen_buffer, 0, sizeof(screen_buffer)); }
//images are optimized to follow page formatting
void draw_image(EEPROM_ADDR image) {
for(int on_pix = 0; on_pix < (SCREEN_RES_X * SCREEN_RES_Y) / 8; on_pix++)
screen_buffer[on_pix] = EEPROM_READBYTE(image + on_pix);
}
//however here we need to compensate
void draw_hline(int pos_y) {
for(int on_pix = 0; on_pix < SCREEN_RES_X; on_pix++)
screen_buffer[((pos_y / 8) * 8) + on_pix] |= (1 << (pos_y % 8));
}
void draw_text(char *text, int x, int y, EEPROM_ADDR font) {
}
|