# driver_lcd
C++ base class for LCD panel drivers on ESP32-P4, designed for the [ESP-IDF Component Registry](https://components.espressif.com/).
Provides the abstract `Ragot::DriverLCD` class with a common interface that concrete drivers (EK79007, ST7262, ST7789, etc.) inherit from.
## Features
- Panel initialization / deinitialization with reset and backlight GPIO control
- Per-pixel drawing (`set_pixel`)
- Full frame buffer submission (`send_frame_buffer`)
- Accessors for width, height, pixel format, and the underlying `esp_lcd_panel_handle_t`
- MIPI DSI support on ESP32-P4
## Requirements
- ESP-IDF **>= 5.4.1**
- Target: **ESP32-P4**
## Installation
Add the dependency to your project's `idf_component.yml`:
```yaml
dependencies:
andresragot/driver_lcd: "^1.0.0"
```
Then run `idf.py build` — the component manager will download it automatically.
## Usage
```cpp
#include "driver_lcd.hpp"
// Inherit from DriverLCD to implement a concrete driver
class MyDriver : public Ragot::DriverLCD
{
public:
esp_err_t init(gpio_num_t reset_pin, gpio_num_t bk_pin) override;
esp_err_t deinit() override;
esp_err_t set_pixel(uint32_t x, uint32_t y, uint32_t color) override;
esp_err_t send_frame_buffer(const void * frame_buffer) override;
};
```
## API
| Method | Description |
|---|---|
| `init(reset_pin, bk_pin)` | Initialize the panel (pure virtual) |
| `deinit()` | Release panel resources (pure virtual) |
| `set_pixel(x, y, color)` | Draw a single pixel (pure virtual) |
| `send_frame_buffer(buf)` | Send a full frame to the panel (pure virtual) |
| `get_width()` | Panel width in pixels |
| `get_height()` | Panel height in pixels |
| `get_pixel_format()` | Current `lcd_color_format_t` |
| `get_handler()` | Underlying `esp_lcd_panel_handle_t` |
| `is_initialized()` | Whether `init()` has been called successfully |
## Related Components
- [`andresragot/driver_ek79007`](https://github.com/andresragot/driver_ek79007) — EK79007 MIPI DSI driver (1024×600)
- [`andresragot/driver_st7262`](https://github.com/andresragot/driver_st7262) — ST7262 RGB driver
- [`andresragot/driver_st7789`](https://github.com/andresragot/driver_st7789) — ST7789 RGB driver
## License
MIT — see [LICENSE](LICENSE) for details.
idf.py add-dependency "andresragot/driver_lcd^1.0.0"