Files
cardboy/Firmware/main/include/disp_tools.hpp
2025-10-07 01:14:38 +02:00

51 lines
1.4 KiB
C++

//
// Created by Stepan Usatiuk on 02.03.2025.
//
#ifndef CB_DISP_TOOLS_HPP
#define CB_DISP_TOOLS_HPP
#include <display.hpp>
namespace DispTools {
static void clear() {
for (int y = 0; y < DISP_HEIGHT; y++) {
for (int x = 0; x < DISP_WIDTH; x++) {
SMD::set_pixel(x, y, true);
}
}
}
static bool get_pixel(int x, int y) {
if (x < 0 || x >= DISP_WIDTH || y < 0 || y >= DISP_HEIGHT)
assert(false);
assert(false); // Not implemented
return true;
// return disp_frame[y][x];
}
static void reset_pixel(int x, int y) {
if (x < 0 || x >= DISP_WIDTH || y < 0 || y >= DISP_HEIGHT)
assert(false);
SMD::set_pixel(x, y, false);
}
static void set_pixel(int x, int y) {
if (x < 0 || x >= DISP_WIDTH || y < 0 || y >= DISP_HEIGHT)
assert(false);
SMD::set_pixel(x, y, true);
}
static void set_pixel(int x, int y, bool on) {
if (on) {
set_pixel(x, y);
} else {
reset_pixel(x, y);
}
}
static void draw_to_display() { SMD::draw(); }
static void draw_to_display_async_start() { SMD::draw_async_start(); }
static void draw_to_display_async_wait() { SMD::draw_async_wait(); }
static bool draw_to_display_async_busy() { return SMD::draw_async_busy(); }
};
#endif // DISP_TOOLS_HPP