23#include <idfxx/i2c/master>
24#include <idfxx/spi/master>
26#include <esp_lcd_panel_io.h>
27#include <frequency/frequency>
111#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
140#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
177 [[nodiscard]] esp_lcd_panel_io_handle_t
idf_handle()
const {
return _handle; }
182 struct callback_state {
186 panel_io(esp_lcd_panel_io_handle_t handle, std::unique_ptr<callback_state> callbacks);
189 on_color_transfer_done(esp_lcd_panel_io_handle_t handle, esp_lcd_panel_io_event_data_t* edata,
void* user_ctx);
191 esp_lcd_panel_io_handle_t _handle =
nullptr;
192 std::unique_ptr<callback_state> _callbacks;
Type-safe set of flags from a scoped enum.
static constexpr gpio nc()
Returns a GPIO representing "not connected".
I2C master bus controller with thread-safe device access.
Panel I/O interface for SPI- and I2C-connected displays.
panel_io(const panel_io &)=delete
esp_lcd_panel_io_handle_t idf_handle() const
Returns the underlying ESP-IDF handle.
std::move_only_function< bool(esp_lcd_panel_io_event_data_t *edata)> color_transfer_done_callback
Callback type invoked when color data transfer has finished.
static result< panel_io > make(idfxx::spi::master_bus &spi_bus, spi_config config)
Creates a new panel I/O interface.
panel_io(panel_io &&other) noexcept
panel_io(idfxx::i2c::master_bus &i2c_bus, i2c_config config)
Creates a new panel I/O interface.
panel_io & operator=(const panel_io &)=delete
panel_io(idfxx::spi::master_bus &spi_bus, spi_config config)
Creates a new panel I/O interface.
panel_io & operator=(panel_io &&other) noexcept
static result< panel_io > make(idfxx::i2c::master_bus &i2c_bus, i2c_config config)
Creates a new panel I/O interface.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
I2C-based panel I/O configuration.
unsigned int disable_control_phase
If enabled, the control phase isn't used.
size_t control_phase_bytes
Number of bytes the panel encodes control information (e.g.
int lcd_param_bits
Bit-width of LCD parameter.
uint16_t device_address
7-bit I2C device address (e.g. 0x3C for a typical SSD1306)
int lcd_cmd_bits
Bit-width of LCD command.
unsigned int dc_bit_offset
Offset of the D/C selection bit in the control phase.
freq::hertz scl_speed
I2C SCL frequency.
color_transfer_done_callback on_color_transfer_done
Callback invoked when color data transfer has finished.
unsigned int dc_low_on_data
If enabled, DC bit = 0 indicates data transfer and DC bit = 1 indicates command transfer; vice versa ...
SPI-based panel I/O configuration.
int lcd_cmd_bits
Bit-width of LCD command.
unsigned int dc_low_on_param
If enabled, DC level = 0 indicates parameter transfer.
unsigned int quad_mode
transmit with quad mode (4 data lines), this mode is useful when transmitting LCD parameters (Only us...
int lcd_param_bits
Bit-width of LCD parameter.
gpio dc_gpio
GPIO used to select the D/C line, set to gpio::nc() if not used.
unsigned int dc_low_on_data
If enabled, DC level = 0 indicates color data transfer.
uint8_t cs_enable_posttrans
Amount of SPI bit-cycles the cs should stay active after the transmission (0-16)
unsigned int cs_high_active
CS line is high active.
int spi_mode
Traditional SPI mode (0~3)
uint8_t cs_enable_pretrans
Amount of SPI bit-cycles the cs should be activated before the transmission (0-16)
size_t trans_queue_depth
Size of internal transaction queue.
gpio cs_gpio
GPIO used for CS line.
unsigned int dc_high_on_cmd
If enabled, DC level = 1 indicates command transfer.
unsigned int sio_mode
Read and write through a single data line (MOSI)
unsigned int lsb_first
transmit LSB bit first
color_transfer_done_callback on_color_transfer_done
Callback invoked when color data transfer has finished.
freq::hertz pclk_freq
Frequency of pixel clock.
unsigned int octal_mode
transmit with octal mode (8 data lines), this mode is used to simulate Intel 8080 timing