Files
tactility/TactilityKernel/source/drivers/display.cpp
T
Ken Van Hoeylandt 50c0a14a93 New kernel drivers and more (#560)
- Added kernel base drivers for: display, pointer (touch, mouse, etc.), keyboard, adc, power supply and backlight
- Implement new kernel driver modules: `st7789-module` and `gt911-module`
- Implement ESP32 ADC "oneshot" kernel driver
- Implement ESP32  backlight kernel driver with ledc API
- Implemented `battery-sense` driver that allows for voltage measurement and creates a power supply child device
- Updated github actions
- Updated flash scripts
- Fix for esp32 legacy driver conflict with ADC
- Created separate `lilygo-tdeck` and `lilygo-tdeck-plus` devices
- Created `lilygo-module` with LilyGO kernel drivers
- Fix for intermittent errors in build related to code generation of `devicetree.c`
- `lvgl-module` can now map kernel drivers onto LVGL devices
- Created `KernelDisplayApp` as a mirror of `HalDisplayApp` (formerly `DisplayApp`)
- Removed `struct` and `enum` prefix in a lot of kernel driver cpp source files
- `lilygo-tdeck` and `lilygo-tdeck-plus` are now fully relying on kernel drivers and don't use any of the old HAL
2026-07-12 00:29:12 +02:00

104 lines
3.5 KiB
C++

// SPDX-License-Identifier: Apache-2.0
#include <tactility/drivers/display.h>
#include <tactility/device.h>
#define DISPLAY_DRIVER_API(driver) ((struct DisplayApi*)driver->api)
extern "C" {
error_t display_reset(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->reset(device);
}
error_t display_init(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->init(device);
}
error_t display_draw_bitmap(Device* device, int32_t x_start, int32_t y_start, int32_t x_end, int32_t y_end, const void* color_data) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->draw_bitmap(device, x_start, y_start, x_end, y_end, color_data);
}
error_t display_mirror(Device* device, bool x_axis, bool y_axis) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->mirror(device, x_axis, y_axis);
}
error_t display_swap_xy(Device* device, bool swap_axes) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->swap_xy(device, swap_axes);
}
bool display_get_swap_xy(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_swap_xy(device);
}
bool display_get_mirror_x(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_mirror_x(device);
}
bool display_get_mirror_y(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_mirror_y(device);
}
error_t display_set_gap(Device* device, int32_t x_gap, int32_t y_gap) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->set_gap(device, x_gap, y_gap);
}
error_t display_invert_color(Device* device, bool invert_color_data) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->invert_color(device, invert_color_data);
}
error_t display_disp_on_off(Device* device, bool on_off) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->disp_on_off(device, on_off);
}
error_t display_disp_sleep(Device* device, bool sleep) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->disp_sleep(device, sleep);
}
enum DisplayColorFormat display_get_color_format(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_color_format(device);
}
uint16_t display_get_resolution_x(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_resolution_x(device);
}
uint16_t display_get_resolution_y(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_resolution_y(device);
}
void display_get_frame_buffer(Device* device, uint8_t index, void** out_buffer) {
const auto* driver = device_get_driver(device);
DISPLAY_DRIVER_API(driver)->get_frame_buffer(device, index, out_buffer);
}
uint8_t display_get_frame_buffer_count(Device* device) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_frame_buffer_count(device);
}
error_t display_get_backlight(Device* device, Device** backlight) {
const auto* driver = device_get_driver(device);
return DISPLAY_DRIVER_API(driver)->get_backlight(device, backlight);
}
const struct DeviceType DISPLAY_TYPE {
.name = "display"
};
}