-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patholed_test.cpp
More file actions
49 lines (40 loc) · 1.14 KB
/
Copy patholed_test.cpp
File metadata and controls
49 lines (40 loc) · 1.14 KB
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
#include "pico/stdlib.h"
#include "font.h"
#include "oled_ssd1309.h"
#ifndef OLED_VARIANT_LABEL
#define OLED_VARIANT_LABEL "ORIGINAL"
#endif
static void draw_text(uint8_t page, uint8_t col, const char *text) {
while (*text && page < OLED_PAGES && col < OLED_WIDTH - 5) {
oled_write(page, col, (const uint8_t *)font[(uint8_t)*text], 6);
col += 6;
text++;
}
}
static void draw_checkerboard() {
uint8_t row[OLED_WIDTH];
for (int page = 0; page < OLED_PAGES; page++) {
for (int col = 0; col < OLED_WIDTH; col++) {
bool even_block = (((col / 8) + page) & 1) == 0;
row[col] = even_block ? 0xAA : 0x55;
}
oled_write(page, 0, row, sizeof(row));
}
}
int main() {
oled_init();
while (true) {
draw_checkerboard();
sleep_ms(1500);
oled_clear();
draw_text(0, 22, "FZ-1 OLED TEST");
draw_text(2, 13, OLED_VARIANT_LABEL);
draw_text(4, 13, "SSD1309 SPI OK");
draw_text(6, 19, "CHECK CONTRAST");
sleep_ms(2500);
oled_fill(0xFF);
sleep_ms(800);
oled_clear();
sleep_ms(500);
}
}