mirror of
https://github.com/esphome/esphome.git
synced 2026-05-31 17:06:40 +08:00
[mipi_rgb] Allow use on P4 (#13740)
This commit is contained in:
@@ -11,7 +11,7 @@ from esphome.components.const import (
|
|||||||
CONF_DRAW_ROUNDING,
|
CONF_DRAW_ROUNDING,
|
||||||
)
|
)
|
||||||
from esphome.components.display import CONF_SHOW_TEST_CARD
|
from esphome.components.display import CONF_SHOW_TEST_CARD
|
||||||
from esphome.components.esp32 import VARIANT_ESP32S3, only_on_variant
|
from esphome.components.esp32 import VARIANT_ESP32P4, VARIANT_ESP32S3, only_on_variant
|
||||||
from esphome.components.mipi import (
|
from esphome.components.mipi import (
|
||||||
COLOR_ORDERS,
|
COLOR_ORDERS,
|
||||||
CONF_DE_PIN,
|
CONF_DE_PIN,
|
||||||
@@ -225,7 +225,7 @@ def _config_schema(config):
|
|||||||
return cv.All(
|
return cv.All(
|
||||||
schema,
|
schema,
|
||||||
cv.only_on_esp32,
|
cv.only_on_esp32,
|
||||||
only_on_variant(supported=[VARIANT_ESP32S3]),
|
only_on_variant(supported=[VARIANT_ESP32S3, VARIANT_ESP32P4]),
|
||||||
)(config)
|
)(config)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#ifdef USE_ESP32_VARIANT_ESP32S3
|
#if defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32P4)
|
||||||
#include "mipi_rgb.h"
|
#include "mipi_rgb.h"
|
||||||
#include "esphome/core/gpio.h"
|
#include "esphome/core/gpio.h"
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
@@ -401,4 +401,4 @@ void MipiRgb::dump_config() {
|
|||||||
|
|
||||||
} // namespace mipi_rgb
|
} // namespace mipi_rgb
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
#endif // USE_ESP32_VARIANT_ESP32S3
|
#endif // defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32P4)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef USE_ESP32_VARIANT_ESP32S3
|
#if defined(USE_ESP32_VARIANT_ESP32S3) || defined(USE_ESP32_VARIANT_ESP32P4)
|
||||||
#include "esphome/core/gpio.h"
|
#include "esphome/core/gpio.h"
|
||||||
#include "esphome/components/display/display.h"
|
#include "esphome/components/display/display.h"
|
||||||
#include "esp_lcd_panel_ops.h"
|
#include "esp_lcd_panel_ops.h"
|
||||||
@@ -28,7 +28,7 @@ class MipiRgb : public display::Display {
|
|||||||
void setup() override;
|
void setup() override;
|
||||||
void loop() override;
|
void loop() override;
|
||||||
void update() override;
|
void update() override;
|
||||||
void fill(Color color);
|
void fill(Color color) override;
|
||||||
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
||||||
display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override;
|
display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override;
|
||||||
void write_to_display_(int x_start, int y_start, int w, int h, const uint8_t *ptr, int x_offset, int y_offset,
|
void write_to_display_(int x_start, int y_start, int w, int h, const uint8_t *ptr, int x_offset, int y_offset,
|
||||||
@@ -115,7 +115,7 @@ class MipiRgbSpi : public MipiRgb,
|
|||||||
void write_command_(uint8_t value);
|
void write_command_(uint8_t value);
|
||||||
void write_data_(uint8_t value);
|
void write_data_(uint8_t value);
|
||||||
void write_init_sequence_();
|
void write_init_sequence_();
|
||||||
void dump_config();
|
void dump_config() override;
|
||||||
|
|
||||||
GPIOPin *dc_pin_{nullptr};
|
GPIOPin *dc_pin_{nullptr};
|
||||||
std::vector<uint8_t> init_sequence_;
|
std::vector<uint8_t> init_sequence_;
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
display:
|
||||||
|
- platform: mipi_rgb
|
||||||
|
spi_id: spi_bus
|
||||||
|
model: ZX2D10GE01R-V4848
|
||||||
|
update_interval: 1s
|
||||||
|
color_order: BGR
|
||||||
|
draw_rounding: 2
|
||||||
|
pixel_mode: 18bit
|
||||||
|
invert_colors: false
|
||||||
|
use_axis_flips: true
|
||||||
|
pclk_frequency: 15000000.0
|
||||||
|
pclk_inverted: true
|
||||||
|
byte_order: big_endian
|
||||||
|
hsync_pulse_width: 10
|
||||||
|
hsync_back_porch: 10
|
||||||
|
hsync_front_porch: 10
|
||||||
|
vsync_pulse_width: 2
|
||||||
|
vsync_back_porch: 12
|
||||||
|
vsync_front_porch: 14
|
||||||
|
data_pins:
|
||||||
|
red:
|
||||||
|
- number: 10
|
||||||
|
- number: 16
|
||||||
|
- number: 9
|
||||||
|
- number: 15
|
||||||
|
- number: 46
|
||||||
|
green:
|
||||||
|
- number: 8
|
||||||
|
- number: 13
|
||||||
|
- number: 18
|
||||||
|
- number: 12
|
||||||
|
- number: 11
|
||||||
|
- number: 17
|
||||||
|
blue:
|
||||||
|
- number: 47
|
||||||
|
- number: 1
|
||||||
|
- number: 0
|
||||||
|
- number: 42
|
||||||
|
- number: 14
|
||||||
|
de_pin:
|
||||||
|
number: 39
|
||||||
|
pclk_pin:
|
||||||
|
number: 45
|
||||||
|
hsync_pin:
|
||||||
|
number: 38
|
||||||
|
vsync_pin:
|
||||||
|
number: 48
|
||||||
|
data_rate: 1000000.0
|
||||||
|
spi_mode: MODE0
|
||||||
|
cs_pin:
|
||||||
|
number: 21
|
||||||
|
show_test_card: true
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
packages:
|
||||||
|
spi: !include ../../test_build_components/common/spi/esp32-p4-idf.yaml
|
||||||
|
|
||||||
|
psram:
|
||||||
|
|
||||||
|
<<: !include common.yaml
|
||||||
@@ -4,58 +4,4 @@ packages:
|
|||||||
psram:
|
psram:
|
||||||
mode: octal
|
mode: octal
|
||||||
|
|
||||||
display:
|
<<: !include common.yaml
|
||||||
- platform: mipi_rgb
|
|
||||||
spi_id: spi_bus
|
|
||||||
model: ZX2D10GE01R-V4848
|
|
||||||
update_interval: 1s
|
|
||||||
color_order: BGR
|
|
||||||
draw_rounding: 2
|
|
||||||
pixel_mode: 18bit
|
|
||||||
invert_colors: false
|
|
||||||
use_axis_flips: true
|
|
||||||
pclk_frequency: 15000000.0
|
|
||||||
pclk_inverted: true
|
|
||||||
byte_order: big_endian
|
|
||||||
hsync_pulse_width: 10
|
|
||||||
hsync_back_porch: 10
|
|
||||||
hsync_front_porch: 10
|
|
||||||
vsync_pulse_width: 2
|
|
||||||
vsync_back_porch: 12
|
|
||||||
vsync_front_porch: 14
|
|
||||||
data_pins:
|
|
||||||
red:
|
|
||||||
- number: 10
|
|
||||||
- number: 16
|
|
||||||
- number: 9
|
|
||||||
- number: 15
|
|
||||||
- number: 46
|
|
||||||
ignore_strapping_warning: true
|
|
||||||
green:
|
|
||||||
- number: 8
|
|
||||||
- number: 13
|
|
||||||
- number: 18
|
|
||||||
- number: 12
|
|
||||||
- number: 11
|
|
||||||
- number: 17
|
|
||||||
blue:
|
|
||||||
- number: 47
|
|
||||||
- number: 1
|
|
||||||
- number: 0
|
|
||||||
ignore_strapping_warning: true
|
|
||||||
- number: 42
|
|
||||||
- number: 14
|
|
||||||
de_pin:
|
|
||||||
number: 39
|
|
||||||
pclk_pin:
|
|
||||||
number: 45
|
|
||||||
ignore_strapping_warning: true
|
|
||||||
hsync_pin:
|
|
||||||
number: 38
|
|
||||||
vsync_pin:
|
|
||||||
number: 48
|
|
||||||
data_rate: 1000000.0
|
|
||||||
spi_mode: MODE0
|
|
||||||
cs_pin:
|
|
||||||
number: 21
|
|
||||||
show_test_card: true
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Common SPI configuration for ESP32-P4 IDF tests
|
||||||
|
|
||||||
|
substitutions:
|
||||||
|
clk_pin: GPIO36
|
||||||
|
mosi_pin: GPIO32
|
||||||
|
miso_pin: GPIO33
|
||||||
|
|
||||||
|
spi:
|
||||||
|
- id: spi_bus
|
||||||
|
clk_pin: ${clk_pin}
|
||||||
|
mosi_pin: ${mosi_pin}
|
||||||
|
miso_pin: ${miso_pin}
|
||||||
Reference in New Issue
Block a user