#ifndef RAYLIB_ESP32_H #define RAYLIB_ESP32_H #ifdef __cplusplus extern "C" { #endif #include "esp_err.h" #include "driver/spi_master.h" #include "raylib_esp32_displays.h" typedef struct { raylib_display_driver_e driver; spi_host_device_t spi_host; int pin_sclk; int pin_mosi; int pin_cs; int pin_dc; int pin_rst; int pin_bl; uint16_t width; uint16_t height; uint32_t spi_freq_hz; /* 0 → use driver default */ } raylib_esp32_display_config_t; /** * Initialize display hardware and the raylib port layer. * Must be called before InitWindow(). * * Sets up: SPI bus → panel driver → port layer (DMA flush, semaphores). * Also turns on the backlight via pin_bl (active-high). */ esp_err_t raylib_esp32_init(const raylib_esp32_display_config_t *config); /** * Mount a LittleFS partition so that raylib's LoadModel / LoadTexture / * LoadFont can read from it via standard fopen(). * * @param mount_point VFS path, e.g. "/data" * @param partition Partition label in the partition table (usually "spiffs") * @return ESP_OK on success */ esp_err_t raylib_esp32_mount_fs(const char *mount_point, const char *partition_label); /** * Tear down the port layer and free the display framebuffer. */ void raylib_esp32_deinit(void); #ifdef __cplusplus } #endif #endif /* RAYLIB_ESP32_H */