Files
tactility_apps/Apps/MystifyDemo/main/Include/drivers/DisplayDriver.h
T
Ken Van Hoeylandt 4f635d38e3 Updates for removal of deprecated HAL (#37)
Update all apps to replace deprecated LVGL code and to use the new kernel APIs.
2026-07-26 12:47:03 +02:00

48 lines
1.0 KiB
C++

#pragma once
#include <tactility/device.h>
#include <tactility/drivers/display.h>
#include <Tactility/kernel/Kernel.h>
/**
* Wrapper for display_* device driver functions
*/
class DisplayDriver {
struct Device* device;
public:
explicit DisplayDriver(struct Device* device) : device(device) {
device_get(device);
}
~DisplayDriver() {
device_put(device);
}
bool lock(TickType_t timeout = tt::kernel::MAX_TICKS) const {
return device_try_lock(device, timeout);
}
void unlock() const {
device_unlock(device);
}
uint16_t getWidth() const {
return display_get_resolution_x(device);
}
uint16_t getHeight() const {
return display_get_resolution_y(device);
}
enum DisplayColorFormat getColorFormat() const {
return display_get_color_format(device);
}
void drawBitmap(int xStart, int yStart, int xEnd, int yEnd, const void* pixelData) const {
display_draw_bitmap(device, xStart, yStart, xEnd, yEnd, pixelData);
}
};