esphome 2025.8.3__py3-none-any.whl → 2025.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/__main__.py +177 -105
- esphome/components/absolute_humidity/absolute_humidity.cpp +3 -5
- esphome/components/adc/__init__.py +1 -26
- esphome/components/adc/adc_sensor_esp32.cpp +29 -6
- esphome/components/adc/sensor.py +20 -0
- esphome/components/ade7880/ade7880.cpp +1 -1
- esphome/components/ags10/ags10.cpp +3 -18
- esphome/components/ags10/ags10.h +2 -12
- esphome/components/aht10/aht10.cpp +3 -3
- esphome/components/airthings_ble/__init__.py +2 -2
- esphome/components/alarm_control_panel/__init__.py +2 -2
- esphome/components/am2315c/am2315c.cpp +1 -17
- esphome/components/am2315c/am2315c.h +2 -3
- esphome/components/api/__init__.py +2 -2
- esphome/components/api/api_connection.cpp +38 -34
- esphome/components/api/api_connection.h +20 -40
- esphome/components/api/api_frame_helper.cpp +25 -25
- esphome/components/api/api_frame_helper.h +3 -3
- esphome/components/api/api_frame_helper_noise.cpp +75 -40
- esphome/components/api/api_frame_helper_noise.h +3 -7
- esphome/components/api/api_frame_helper_plaintext.cpp +17 -4
- esphome/components/api/api_frame_helper_plaintext.h +1 -4
- esphome/components/api/api_pb2.cpp +12 -2
- esphome/components/api/api_pb2.h +144 -143
- esphome/components/api/api_pb2_dump.cpp +6 -1
- esphome/components/api/api_pb2_service.cpp +0 -14
- esphome/components/api/api_pb2_service.h +1 -3
- esphome/components/api/client.py +5 -3
- esphome/components/api/proto.cpp +33 -37
- esphome/components/async_tcp/__init__.py +2 -2
- esphome/components/atm90e26/sensor.py +2 -0
- esphome/components/atm90e32/sensor.py +4 -2
- esphome/components/audio_adc/__init__.py +2 -2
- esphome/components/audio_dac/__init__.py +2 -2
- esphome/components/axs15231/touchscreen/axs15231_touchscreen.cpp +1 -1
- esphome/components/bedjet/bedjet_hub.cpp +1 -1
- esphome/components/binary_sensor/__init__.py +2 -2
- esphome/components/binary_sensor/binary_sensor.cpp +13 -0
- esphome/components/binary_sensor/binary_sensor.h +4 -7
- esphome/components/bl0940/__init__.py +6 -1
- esphome/components/bl0940/bl0940.cpp +178 -41
- esphome/components/bl0940/bl0940.h +121 -76
- esphome/components/bl0940/button/__init__.py +27 -0
- esphome/components/bl0940/button/calibration_reset_button.cpp +20 -0
- esphome/components/bl0940/button/calibration_reset_button.h +19 -0
- esphome/components/bl0940/number/__init__.py +94 -0
- esphome/components/bl0940/number/calibration_number.cpp +29 -0
- esphome/components/bl0940/number/calibration_number.h +26 -0
- esphome/components/bl0940/sensor.py +151 -2
- esphome/components/bl0942/bl0942.cpp +1 -1
- esphome/components/ble_client/output/__init__.py +4 -4
- esphome/components/bluetooth_proxy/__init__.py +1 -1
- esphome/components/bluetooth_proxy/bluetooth_connection.h +1 -1
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +15 -7
- esphome/components/bluetooth_proxy/bluetooth_proxy.h +6 -3
- esphome/components/button/__init__.py +2 -2
- esphome/components/button/button.cpp +13 -0
- esphome/components/button/button.h +4 -7
- esphome/components/camera/buffer.h +18 -0
- esphome/components/camera/buffer_impl.cpp +20 -0
- esphome/components/camera/buffer_impl.h +26 -0
- esphome/components/camera/camera.h +43 -0
- esphome/components/camera/encoder.h +69 -0
- esphome/components/camera_encoder/__init__.py +62 -0
- esphome/components/camera_encoder/encoder_buffer_impl.cpp +23 -0
- esphome/components/camera_encoder/encoder_buffer_impl.h +25 -0
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.cpp +82 -0
- esphome/components/camera_encoder/esp32_camera_jpeg_encoder.h +39 -0
- esphome/components/captive_portal/__init__.py +2 -2
- esphome/components/captive_portal/captive_index.h +77 -97
- esphome/components/captive_portal/captive_portal.cpp +35 -12
- esphome/components/captive_portal/captive_portal.h +3 -3
- esphome/components/ccs811/ccs811.cpp +3 -3
- esphome/components/climate/__init__.py +2 -2
- esphome/components/climate/climate.cpp +1 -1
- esphome/components/cover/__init__.py +5 -5
- esphome/components/cover/cover.cpp +1 -1
- esphome/components/cover/cover.h +2 -2
- esphome/components/dallas_temp/dallas_temp.cpp +2 -2
- esphome/components/datetime/__init__.py +2 -2
- esphome/components/datetime/date_entity.h +2 -2
- esphome/components/datetime/datetime_entity.h +2 -2
- esphome/components/datetime/time_entity.h +2 -2
- esphome/components/debug/debug_esp32.cpp +1 -1
- esphome/components/display/__init__.py +4 -4
- esphome/components/duty_time/duty_time_sensor.cpp +1 -1
- esphome/components/esp32/__init__.py +0 -5
- esphome/components/esp32/gpio.cpp +27 -23
- esphome/components/esp32/gpio.h +26 -11
- esphome/components/esp32/preferences.cpp +8 -4
- esphome/components/esp32_ble/__init__.py +7 -2
- esphome/components/esp32_ble/ble_uuid.cpp +30 -9
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +4 -3
- esphome/components/esp32_ble_client/ble_client_base.cpp +7 -3
- esphome/components/esp32_ble_client/ble_client_base.h +8 -5
- esphome/components/esp32_ble_tracker/__init__.py +2 -2
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +11 -47
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.h +2 -14
- esphome/components/esp8266/__init__.py +2 -2
- esphome/components/esp8266/core.cpp +2 -2
- esphome/components/esp8266/gpio.py +4 -4
- esphome/components/esp8266/preferences.cpp +30 -28
- esphome/components/esphome/ota/__init__.py +2 -2
- esphome/components/esphome/ota/ota_esphome.cpp +21 -19
- esphome/components/esphome/ota/ota_esphome.h +6 -5
- esphome/components/ethernet/__init__.py +18 -2
- esphome/components/ethernet/ethernet_component.cpp +53 -3
- esphome/components/ethernet/ethernet_component.h +4 -0
- esphome/components/event/__init__.py +2 -2
- esphome/components/event/event.h +4 -4
- esphome/components/factory_reset/button/factory_reset_button.cpp +18 -1
- esphome/components/factory_reset/button/factory_reset_button.h +6 -1
- esphome/components/factory_reset/switch/factory_reset_switch.cpp +18 -1
- esphome/components/factory_reset/switch/factory_reset_switch.h +5 -1
- esphome/components/fan/__init__.py +2 -2
- esphome/components/fan/fan.cpp +2 -1
- esphome/components/gdk101/gdk101.cpp +4 -4
- esphome/components/globals/__init__.py +2 -2
- esphome/components/gpio/binary_sensor/gpio_binary_sensor.cpp +19 -18
- esphome/components/gpio_expander/cached_gpio.h +36 -16
- esphome/components/grove_gas_mc_v2/grove_gas_mc_v2.cpp +5 -5
- esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +1 -1
- esphome/components/haier/haier_base.cpp +1 -1
- esphome/components/haier/hon_climate.cpp +1 -1
- esphome/components/hlw8012/hlw8012.cpp +5 -5
- esphome/components/honeywellabp2_i2c/honeywellabp2.cpp +4 -4
- esphome/components/host/preferences.h +3 -2
- esphome/components/hte501/hte501.cpp +3 -21
- esphome/components/hte501/hte501.h +2 -3
- esphome/components/http_request/ota/__init__.py +2 -2
- esphome/components/i2c/__init__.py +2 -2
- esphome/components/i2c/i2c.cpp +13 -9
- esphome/components/i2c/i2c_bus.h +36 -6
- esphome/components/i2s_audio/__init__.py +8 -2
- esphome/components/i2s_audio/media_player/__init__.py +1 -1
- esphome/components/i2s_audio/microphone/__init__.py +1 -1
- esphome/components/i2s_audio/speaker/__init__.py +1 -1
- esphome/components/ina2xx_base/__init__.py +4 -2
- esphome/components/inkplate/__init__.py +1 -0
- esphome/components/inkplate/const.py +105 -0
- esphome/components/inkplate/display.py +238 -0
- esphome/components/{inkplate6 → inkplate}/inkplate.cpp +156 -74
- esphome/components/{inkplate6 → inkplate}/inkplate.h +28 -68
- esphome/components/inkplate6/__init__.py +0 -1
- esphome/components/inkplate6/display.py +2 -211
- esphome/components/integration/integration_sensor.cpp +1 -1
- esphome/components/json/__init__.py +2 -2
- esphome/components/kmeteriso/kmeteriso.cpp +1 -1
- esphome/components/lc709203f/lc709203f.cpp +4 -17
- esphome/components/lc709203f/lc709203f.h +2 -3
- esphome/components/ld2420/text_sensor/{text_sensor.cpp → ld2420_text_sensor.cpp} +1 -1
- esphome/components/ld2450/ld2450.cpp +1 -1
- esphome/components/libretiny/preferences.cpp +13 -5
- esphome/components/light/__init__.py +2 -2
- esphome/components/light/addressable_light_effect.h +7 -0
- esphome/components/light/base_light_effects.h +8 -0
- esphome/components/light/light_call.cpp +22 -20
- esphome/components/light/light_effect.cpp +36 -0
- esphome/components/light/light_effect.h +14 -0
- esphome/components/light/light_json_schema.cpp +9 -1
- esphome/components/light/light_state.cpp +2 -2
- esphome/components/light/light_state.h +39 -0
- esphome/components/lock/__init__.py +2 -2
- esphome/components/lock/lock.h +2 -2
- esphome/components/logger/__init__.py +2 -2
- esphome/components/logger/logger.cpp +25 -4
- esphome/components/logger/logger.h +1 -1
- esphome/components/logger/logger_esp32.cpp +16 -8
- esphome/components/logger/logger_esp8266.cpp +11 -3
- esphome/components/logger/logger_libretiny.cpp +13 -3
- esphome/components/logger/logger_rp2040.cpp +14 -3
- esphome/components/logger/logger_zephyr.cpp +15 -4
- esphome/components/lvgl/defines.py +1 -0
- esphome/components/lvgl/hello_world.py +96 -33
- esphome/components/lvgl/number/lvgl_number.h +1 -1
- esphome/components/lvgl/select/lvgl_select.h +1 -1
- esphome/components/lvgl/widgets/__init__.py +0 -1
- esphome/components/lvgl/widgets/spinbox.py +20 -11
- esphome/components/m5stack_8angle/binary_sensor/m5stack_8angle_binary_sensor.cpp +1 -1
- esphome/components/m5stack_8angle/sensor/m5stack_8angle_sensor.cpp +1 -1
- esphome/components/mapping/__init__.py +13 -5
- esphome/components/mapping/mapping.h +69 -0
- esphome/components/max17043/max17043.cpp +2 -2
- esphome/components/mcp23016/__init__.py +1 -0
- esphome/components/mcp23016/mcp23016.cpp +20 -5
- esphome/components/mcp23016/mcp23016.h +10 -4
- esphome/components/mcp23x08_base/mcp23x08_base.cpp +1 -1
- esphome/components/mcp23x17_base/mcp23x17_base.cpp +2 -2
- esphome/components/md5/md5.cpp +3 -2
- esphome/components/mdns/__init__.py +2 -2
- esphome/components/mdns/mdns_component.cpp +145 -54
- esphome/components/media_player/__init__.py +2 -2
- esphome/components/micro_wake_word/__init__.py +2 -2
- esphome/components/microphone/__init__.py +2 -2
- esphome/components/mipi/__init__.py +77 -33
- esphome/components/mipi_rgb/__init__.py +2 -0
- esphome/components/mipi_rgb/display.py +321 -0
- esphome/components/mipi_rgb/mipi_rgb.cpp +388 -0
- esphome/components/mipi_rgb/mipi_rgb.h +127 -0
- esphome/components/mipi_rgb/models/guition.py +24 -0
- esphome/components/mipi_rgb/models/lilygo.py +228 -0
- esphome/components/mipi_rgb/models/rpi.py +9 -0
- esphome/components/mipi_rgb/models/st7701s.py +214 -0
- esphome/components/mipi_rgb/models/waveshare.py +64 -0
- esphome/components/mipi_spi/models/jc.py +229 -0
- esphome/components/mlx90614/mlx90614.cpp +1 -16
- esphome/components/mlx90614/mlx90614.h +0 -1
- esphome/components/mqtt/__init__.py +2 -2
- esphome/components/mqtt/mqtt_client.cpp +1 -1
- esphome/components/mqtt/mqtt_sensor.cpp +7 -2
- esphome/components/ms5611/ms5611.cpp +7 -6
- esphome/components/network/__init__.py +2 -2
- esphome/components/nextion/nextion_upload.cpp +4 -1
- esphome/components/nrf52/__init__.py +49 -6
- esphome/components/nrf52/const.py +1 -0
- esphome/components/nrf52/dfu.cpp +51 -0
- esphome/components/nrf52/dfu.h +24 -0
- esphome/components/ntc/ntc.cpp +1 -1
- esphome/components/number/__init__.py +2 -2
- esphome/components/number/automation.cpp +1 -1
- esphome/components/number/number.cpp +21 -0
- esphome/components/number/number.h +4 -13
- esphome/components/opentherm/hub.h +6 -6
- esphome/components/opentherm/number/{number.cpp → opentherm_number.cpp} +2 -2
- esphome/components/opentherm/output/{output.cpp → opentherm_output.cpp} +1 -1
- esphome/components/opentherm/switch/{switch.cpp → opentherm_switch.cpp} +1 -1
- esphome/components/openthread/openthread.cpp +41 -7
- esphome/components/openthread/openthread.h +11 -0
- esphome/components/ota/__init__.py +2 -2
- esphome/components/pca6416a/__init__.py +1 -0
- esphome/components/pca6416a/pca6416a.cpp +20 -5
- esphome/components/pca6416a/pca6416a.h +12 -5
- esphome/components/pca9554/__init__.py +2 -1
- esphome/components/pca9554/pca9554.cpp +12 -18
- esphome/components/pca9554/pca9554.h +10 -9
- esphome/components/pcf8574/__init__.py +1 -0
- esphome/components/pcf8574/pcf8574.cpp +14 -5
- esphome/components/pcf8574/pcf8574.h +13 -6
- esphome/components/pi4ioe5v6408/pi4ioe5v6408.cpp +7 -7
- esphome/components/pipsolar/__init__.py +3 -3
- esphome/components/pipsolar/output/__init__.py +4 -4
- esphome/components/pulse_width/pulse_width.cpp +2 -2
- esphome/components/qmp6988/qmp6988.cpp +81 -126
- esphome/components/qmp6988/qmp6988.h +31 -37
- esphome/components/radon_eye_ble/__init__.py +2 -2
- esphome/components/remote_base/__init__.py +6 -8
- esphome/components/rotary_encoder/rotary_encoder.cpp +1 -1
- esphome/components/rp2040/__init__.py +2 -2
- esphome/components/runtime_stats/runtime_stats.cpp +10 -23
- esphome/components/runtime_stats/runtime_stats.h +4 -10
- esphome/components/safe_mode/__init__.py +2 -2
- esphome/components/safe_mode/safe_mode.cpp +33 -31
- esphome/components/script/script.cpp +6 -0
- esphome/components/script/script.h +19 -5
- esphome/components/sdm_meter/sensor.py +3 -1
- esphome/components/select/__init__.py +2 -2
- esphome/components/select/select.cpp +3 -3
- esphome/components/select/select.h +2 -2
- esphome/components/select/select_call.cpp +1 -1
- esphome/components/sen5x/sen5x.cpp +58 -55
- esphome/components/sen5x/sen5x.h +21 -15
- esphome/components/sen5x/sensor.py +67 -44
- esphome/components/sensirion_common/i2c_sensirion.cpp +18 -47
- esphome/components/sensirion_common/i2c_sensirion.h +39 -55
- esphome/components/sensor/__init__.py +2 -2
- esphome/components/sensor/automation.h +1 -1
- esphome/components/sensor/sensor.cpp +34 -6
- esphome/components/sensor/sensor.h +4 -21
- esphome/components/sgp30/sgp30.cpp +34 -35
- esphome/components/sgp30/sgp30.h +11 -10
- esphome/components/sgp4x/sgp4x.cpp +2 -2
- esphome/components/shelly_dimmer/light.py +7 -7
- esphome/components/sht4x/sht4x.cpp +1 -1
- esphome/components/sntp/sntp_component.cpp +36 -9
- esphome/components/sntp/sntp_component.h +7 -0
- esphome/components/sound_level/sound_level.cpp +1 -1
- esphome/components/speaker/__init__.py +2 -2
- esphome/components/speaker/media_player/__init__.py +2 -2
- esphome/components/speaker/media_player/speaker_media_player.cpp +1 -1
- esphome/components/spi/__init__.py +2 -2
- esphome/components/sprinkler/sprinkler.cpp +1 -1
- esphome/components/sps30/sps30.cpp +18 -23
- esphome/components/sps30/sps30.h +3 -3
- esphome/components/status_led/__init__.py +2 -2
- esphome/components/stepper/__init__.py +2 -2
- esphome/components/switch/__init__.py +2 -2
- esphome/components/switch/switch.cpp +5 -5
- esphome/components/sx1509/__init__.py +1 -1
- esphome/components/sx1509/sx1509.cpp +12 -7
- esphome/components/sx1509/sx1509.h +11 -4
- esphome/components/tca9555/tca9555.cpp +5 -5
- esphome/components/tee501/tee501.cpp +2 -21
- esphome/components/tee501/tee501.h +2 -4
- esphome/components/template/alarm_control_panel/template_alarm_control_panel.cpp +1 -1
- esphome/components/template/datetime/template_date.cpp +1 -1
- esphome/components/template/datetime/template_datetime.cpp +2 -2
- esphome/components/template/datetime/template_time.cpp +1 -1
- esphome/components/template/number/template_number.cpp +1 -1
- esphome/components/template/select/template_select.cpp +1 -1
- esphome/components/template/text/template_text.cpp +1 -1
- esphome/components/text/__init__.py +2 -2
- esphome/components/text/text.h +2 -2
- esphome/components/text_sensor/__init__.py +2 -2
- esphome/components/text_sensor/text_sensor.h +4 -4
- esphome/components/thermostat/climate.py +11 -7
- esphome/components/thermostat/thermostat_climate.cpp +237 -206
- esphome/components/thermostat/thermostat_climate.h +52 -41
- esphome/components/time/__init__.py +2 -2
- esphome/components/tmp1075/tmp1075.cpp +1 -1
- esphome/components/total_daily_energy/total_daily_energy.cpp +1 -1
- esphome/components/touchscreen/__init__.py +2 -2
- esphome/components/tuya/number/tuya_number.cpp +1 -1
- esphome/components/udp/udp_component.cpp +3 -3
- esphome/components/ufire_ec/ufire_ec.cpp +4 -4
- esphome/components/ufire_ise/ufire_ise.cpp +4 -4
- esphome/components/update/__init__.py +2 -2
- esphome/components/usb_uart/usb_uart.cpp +1 -1
- esphome/components/valve/__init__.py +5 -5
- esphome/components/valve/valve.cpp +1 -1
- esphome/components/valve/valve.h +2 -2
- esphome/components/wake_on_lan/wake_on_lan.cpp +2 -2
- esphome/components/waveshare_epaper/waveshare_213v3.cpp +1 -1
- esphome/components/web_server/__init__.py +2 -2
- esphome/components/web_server/ota/__init__.py +2 -2
- esphome/components/web_server/ota/ota_web_server.cpp +11 -0
- esphome/components/web_server/server_index_v2.h +149 -149
- esphome/components/web_server/web_server.cpp +58 -12
- esphome/components/web_server_base/__init__.py +2 -2
- esphome/components/wifi/__init__.py +5 -5
- esphome/components/wifi/wifi_component.cpp +4 -4
- esphome/components/wifi/wifi_component_esp_idf.cpp +2 -0
- esphome/components/wifi_info/wifi_info_text_sensor.h +3 -2
- esphome/config_validation.py +2 -2
- esphome/const.py +3 -1
- esphome/core/__init__.py +1 -0
- esphome/core/application.cpp +89 -51
- esphome/core/application.h +1 -0
- esphome/core/component.cpp +41 -19
- esphome/core/component.h +17 -13
- esphome/core/config.py +7 -7
- esphome/core/defines.h +5 -0
- esphome/core/entity_base.cpp +22 -8
- esphome/core/entity_base.h +43 -0
- esphome/core/helpers.cpp +34 -20
- esphome/core/helpers.h +33 -3
- esphome/core/ring_buffer.cpp +6 -2
- esphome/core/ring_buffer.h +2 -1
- esphome/core/scheduler.cpp +178 -97
- esphome/core/scheduler.h +67 -36
- esphome/core/time.cpp +6 -20
- esphome/coroutine.py +80 -3
- esphome/cpp_generator.py +13 -0
- esphome/cpp_helpers.py +2 -2
- esphome/dashboard/web_server.py +69 -15
- esphome/espota2.py +13 -6
- esphome/helpers.py +68 -83
- esphome/resolver.py +67 -0
- esphome/util.py +9 -6
- esphome/wizard.py +81 -34
- esphome/writer.py +13 -0
- {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/METADATA +9 -9
- {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/RECORD +370 -339
- /esphome/components/ld2420/text_sensor/{text_sensor.h → ld2420_text_sensor.h} +0 -0
- /esphome/components/opentherm/number/{number.h → opentherm_number.h} +0 -0
- /esphome/components/opentherm/output/{output.h → opentherm_output.h} +0 -0
- /esphome/components/opentherm/switch/{switch.h → opentherm_switch.h} +0 -0
- {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/WHEEL +0 -0
- {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/entry_points.txt +0 -0
- {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/licenses/LICENSE +0 -0
- {esphome-2025.8.3.dist-info → esphome-2025.9.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,388 @@
|
|
1
|
+
#ifdef USE_ESP32_VARIANT_ESP32S3
|
2
|
+
#include "mipi_rgb.h"
|
3
|
+
#include "esphome/core/log.h"
|
4
|
+
#include "esphome/core/hal.h"
|
5
|
+
#include "esp_lcd_panel_rgb.h"
|
6
|
+
|
7
|
+
namespace esphome {
|
8
|
+
namespace mipi_rgb {
|
9
|
+
|
10
|
+
static const uint8_t DELAY_FLAG = 0xFF;
|
11
|
+
static constexpr uint8_t MADCTL_MY = 0x80; // Bit 7 Bottom to top
|
12
|
+
static constexpr uint8_t MADCTL_MX = 0x40; // Bit 6 Right to left
|
13
|
+
static constexpr uint8_t MADCTL_MV = 0x20; // Bit 5 Swap axes
|
14
|
+
static constexpr uint8_t MADCTL_ML = 0x10; // Bit 4 Refresh bottom to top
|
15
|
+
static constexpr uint8_t MADCTL_BGR = 0x08; // Bit 3 Blue-Green-Red pixel order
|
16
|
+
static constexpr uint8_t MADCTL_XFLIP = 0x02; // Mirror the display horizontally
|
17
|
+
static constexpr uint8_t MADCTL_YFLIP = 0x01; // Mirror the display vertically
|
18
|
+
|
19
|
+
void MipiRgb::setup_enables_() {
|
20
|
+
if (!this->enable_pins_.empty()) {
|
21
|
+
for (auto *pin : this->enable_pins_) {
|
22
|
+
pin->setup();
|
23
|
+
pin->digital_write(true);
|
24
|
+
}
|
25
|
+
delay(10);
|
26
|
+
}
|
27
|
+
if (this->reset_pin_ != nullptr) {
|
28
|
+
this->reset_pin_->setup();
|
29
|
+
this->reset_pin_->digital_write(true);
|
30
|
+
delay(5);
|
31
|
+
this->reset_pin_->digital_write(false);
|
32
|
+
delay(5);
|
33
|
+
this->reset_pin_->digital_write(true);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
#ifdef USE_SPI
|
38
|
+
void MipiRgbSpi::setup() {
|
39
|
+
this->setup_enables_();
|
40
|
+
this->spi_setup();
|
41
|
+
this->write_init_sequence_();
|
42
|
+
this->common_setup_();
|
43
|
+
}
|
44
|
+
void MipiRgbSpi::write_command_(uint8_t value) {
|
45
|
+
this->enable();
|
46
|
+
if (this->dc_pin_ == nullptr) {
|
47
|
+
this->write(value, 9);
|
48
|
+
} else {
|
49
|
+
this->dc_pin_->digital_write(false);
|
50
|
+
this->write_byte(value);
|
51
|
+
this->dc_pin_->digital_write(true);
|
52
|
+
}
|
53
|
+
this->disable();
|
54
|
+
}
|
55
|
+
|
56
|
+
void MipiRgbSpi::write_data_(uint8_t value) {
|
57
|
+
this->enable();
|
58
|
+
if (this->dc_pin_ == nullptr) {
|
59
|
+
this->write(value | 0x100, 9);
|
60
|
+
} else {
|
61
|
+
this->dc_pin_->digital_write(true);
|
62
|
+
this->write_byte(value);
|
63
|
+
}
|
64
|
+
this->disable();
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* this relies upon the init sequence being well-formed, which is guaranteed by the Python init code.
|
69
|
+
*/
|
70
|
+
|
71
|
+
void MipiRgbSpi::write_init_sequence_() {
|
72
|
+
size_t index = 0;
|
73
|
+
auto &vec = this->init_sequence_;
|
74
|
+
while (index != vec.size()) {
|
75
|
+
if (vec.size() - index < 2) {
|
76
|
+
this->mark_failed("Malformed init sequence");
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
uint8_t cmd = vec[index++];
|
80
|
+
uint8_t x = vec[index++];
|
81
|
+
if (x == DELAY_FLAG) {
|
82
|
+
ESP_LOGD(TAG, "Delay %dms", cmd);
|
83
|
+
delay(cmd);
|
84
|
+
} else {
|
85
|
+
uint8_t num_args = x & 0x7F;
|
86
|
+
if (vec.size() - index < num_args) {
|
87
|
+
this->mark_failed("Malformed init sequence");
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
if (cmd == SLEEP_OUT) {
|
91
|
+
delay(120); // NOLINT
|
92
|
+
}
|
93
|
+
const auto *ptr = vec.data() + index;
|
94
|
+
ESP_LOGD(TAG, "Write command %02X, length %d, byte(s) %s", cmd, num_args,
|
95
|
+
format_hex_pretty(ptr, num_args, '.', false).c_str());
|
96
|
+
index += num_args;
|
97
|
+
this->write_command_(cmd);
|
98
|
+
while (num_args-- != 0)
|
99
|
+
this->write_data_(*ptr++);
|
100
|
+
if (cmd == SLEEP_OUT)
|
101
|
+
delay(10);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
// this->spi_teardown(); // SPI not needed after this
|
105
|
+
this->init_sequence_.clear();
|
106
|
+
delay(10);
|
107
|
+
}
|
108
|
+
|
109
|
+
void MipiRgbSpi::dump_config() {
|
110
|
+
MipiRgb::dump_config();
|
111
|
+
LOG_PIN(" CS Pin: ", this->cs_);
|
112
|
+
LOG_PIN(" DC Pin: ", this->dc_pin_);
|
113
|
+
ESP_LOGCONFIG(TAG,
|
114
|
+
" SPI Data rate: %uMHz"
|
115
|
+
"\n Mirror X: %s"
|
116
|
+
"\n Mirror Y: %s"
|
117
|
+
"\n Swap X/Y: %s"
|
118
|
+
"\n Color Order: %s",
|
119
|
+
(unsigned) (this->data_rate_ / 1000000), YESNO(this->madctl_ & (MADCTL_XFLIP | MADCTL_MX)),
|
120
|
+
YESNO(this->madctl_ & (MADCTL_YFLIP | MADCTL_MY | MADCTL_ML)), YESNO(this->madctl_ & MADCTL_MV),
|
121
|
+
this->madctl_ & MADCTL_BGR ? "BGR" : "RGB");
|
122
|
+
}
|
123
|
+
|
124
|
+
#endif // USE_SPI
|
125
|
+
|
126
|
+
void MipiRgb::setup() {
|
127
|
+
this->setup_enables_();
|
128
|
+
this->common_setup_();
|
129
|
+
}
|
130
|
+
|
131
|
+
void MipiRgb::common_setup_() {
|
132
|
+
esp_lcd_rgb_panel_config_t config{};
|
133
|
+
config.flags.fb_in_psram = 1;
|
134
|
+
config.bounce_buffer_size_px = this->width_ * 10;
|
135
|
+
config.num_fbs = 1;
|
136
|
+
config.timings.h_res = this->width_;
|
137
|
+
config.timings.v_res = this->height_;
|
138
|
+
config.timings.hsync_pulse_width = this->hsync_pulse_width_;
|
139
|
+
config.timings.hsync_back_porch = this->hsync_back_porch_;
|
140
|
+
config.timings.hsync_front_porch = this->hsync_front_porch_;
|
141
|
+
config.timings.vsync_pulse_width = this->vsync_pulse_width_;
|
142
|
+
config.timings.vsync_back_porch = this->vsync_back_porch_;
|
143
|
+
config.timings.vsync_front_porch = this->vsync_front_porch_;
|
144
|
+
config.timings.flags.pclk_active_neg = this->pclk_inverted_;
|
145
|
+
config.timings.pclk_hz = this->pclk_frequency_;
|
146
|
+
config.clk_src = LCD_CLK_SRC_PLL160M;
|
147
|
+
size_t data_pin_count = sizeof(this->data_pins_) / sizeof(this->data_pins_[0]);
|
148
|
+
for (size_t i = 0; i != data_pin_count; i++) {
|
149
|
+
config.data_gpio_nums[i] = this->data_pins_[i]->get_pin();
|
150
|
+
}
|
151
|
+
config.data_width = data_pin_count;
|
152
|
+
config.disp_gpio_num = -1;
|
153
|
+
config.hsync_gpio_num = this->hsync_pin_->get_pin();
|
154
|
+
config.vsync_gpio_num = this->vsync_pin_->get_pin();
|
155
|
+
if (this->de_pin_) {
|
156
|
+
config.de_gpio_num = this->de_pin_->get_pin();
|
157
|
+
} else {
|
158
|
+
config.de_gpio_num = -1;
|
159
|
+
}
|
160
|
+
config.pclk_gpio_num = this->pclk_pin_->get_pin();
|
161
|
+
esp_err_t err = esp_lcd_new_rgb_panel(&config, &this->handle_);
|
162
|
+
if (err == ESP_OK)
|
163
|
+
err = esp_lcd_panel_reset(this->handle_);
|
164
|
+
if (err == ESP_OK)
|
165
|
+
err = esp_lcd_panel_init(this->handle_);
|
166
|
+
if (err != ESP_OK) {
|
167
|
+
auto msg = str_sprintf("lcd setup failed: %s", esp_err_to_name(err));
|
168
|
+
this->mark_failed(msg.c_str());
|
169
|
+
}
|
170
|
+
ESP_LOGCONFIG(TAG, "MipiRgb setup complete");
|
171
|
+
}
|
172
|
+
|
173
|
+
void MipiRgb::loop() {
|
174
|
+
if (this->handle_ != nullptr)
|
175
|
+
esp_lcd_rgb_panel_restart(this->handle_);
|
176
|
+
}
|
177
|
+
|
178
|
+
void MipiRgb::update() {
|
179
|
+
if (this->is_failed())
|
180
|
+
return;
|
181
|
+
if (this->auto_clear_enabled_) {
|
182
|
+
this->clear();
|
183
|
+
}
|
184
|
+
if (this->show_test_card_) {
|
185
|
+
this->test_card();
|
186
|
+
} else if (this->page_ != nullptr) {
|
187
|
+
this->page_->get_writer()(*this);
|
188
|
+
} else if (this->writer_.has_value()) {
|
189
|
+
(*this->writer_)(*this);
|
190
|
+
} else {
|
191
|
+
this->stop_poller();
|
192
|
+
}
|
193
|
+
if (this->buffer_ == nullptr || this->x_low_ > this->x_high_ || this->y_low_ > this->y_high_)
|
194
|
+
return;
|
195
|
+
ESP_LOGV(TAG, "x_low %d, y_low %d, x_high %d, y_high %d", this->x_low_, this->y_low_, this->x_high_, this->y_high_);
|
196
|
+
int w = this->x_high_ - this->x_low_ + 1;
|
197
|
+
int h = this->y_high_ - this->y_low_ + 1;
|
198
|
+
this->write_to_display_(this->x_low_, this->y_low_, w, h, reinterpret_cast<const uint8_t *>(this->buffer_),
|
199
|
+
this->x_low_, this->y_low_, this->width_ - w - this->x_low_);
|
200
|
+
// invalidate watermarks
|
201
|
+
this->x_low_ = this->width_;
|
202
|
+
this->y_low_ = this->height_;
|
203
|
+
this->x_high_ = 0;
|
204
|
+
this->y_high_ = 0;
|
205
|
+
}
|
206
|
+
|
207
|
+
void MipiRgb::draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
208
|
+
display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) {
|
209
|
+
if (w <= 0 || h <= 0 || this->is_failed())
|
210
|
+
return;
|
211
|
+
// if color mapping is required, pass the buck.
|
212
|
+
// note that endianness is not considered here - it is assumed to match!
|
213
|
+
if (bitness != display::COLOR_BITNESS_565) {
|
214
|
+
Display::draw_pixels_at(x_start, y_start, w, h, ptr, order, bitness, big_endian, x_offset, y_offset, x_pad);
|
215
|
+
this->write_to_display_(x_start, y_start, w, h, reinterpret_cast<const uint8_t *>(this->buffer_), x_start, y_start,
|
216
|
+
this->width_ - w - x_start);
|
217
|
+
} else {
|
218
|
+
this->write_to_display_(x_start, y_start, w, h, ptr, x_offset, y_offset, x_pad);
|
219
|
+
}
|
220
|
+
}
|
221
|
+
|
222
|
+
void MipiRgb::write_to_display_(int x_start, int y_start, int w, int h, const uint8_t *ptr, int x_offset, int y_offset,
|
223
|
+
int x_pad) {
|
224
|
+
esp_err_t err = ESP_OK;
|
225
|
+
auto stride = (x_offset + w + x_pad) * 2;
|
226
|
+
ptr += y_offset * stride + x_offset * 2; // skip to the first pixel
|
227
|
+
// x_ and y_offset are offsets into the source buffer, unrelated to our own offsets into the display.
|
228
|
+
if (x_offset == 0 && x_pad == 0) {
|
229
|
+
err = esp_lcd_panel_draw_bitmap(this->handle_, x_start, y_start, x_start + w, y_start + h, ptr);
|
230
|
+
} else {
|
231
|
+
// draw line by line
|
232
|
+
for (int y = 0; y != h; y++) {
|
233
|
+
err = esp_lcd_panel_draw_bitmap(this->handle_, x_start, y + y_start, x_start + w, y + y_start + 1, ptr);
|
234
|
+
if (err != ESP_OK)
|
235
|
+
break;
|
236
|
+
ptr += stride; // next line
|
237
|
+
}
|
238
|
+
}
|
239
|
+
if (err != ESP_OK)
|
240
|
+
ESP_LOGE(TAG, "lcd_lcd_panel_draw_bitmap failed: %s", esp_err_to_name(err));
|
241
|
+
}
|
242
|
+
|
243
|
+
bool MipiRgb::check_buffer_() {
|
244
|
+
if (this->is_failed())
|
245
|
+
return false;
|
246
|
+
if (this->buffer_ != nullptr)
|
247
|
+
return true;
|
248
|
+
// this is dependent on the enum values.
|
249
|
+
RAMAllocator<uint16_t> allocator;
|
250
|
+
this->buffer_ = allocator.allocate(this->height_ * this->width_);
|
251
|
+
if (this->buffer_ == nullptr) {
|
252
|
+
this->mark_failed("Could not allocate buffer for display!");
|
253
|
+
return false;
|
254
|
+
}
|
255
|
+
return true;
|
256
|
+
}
|
257
|
+
|
258
|
+
void MipiRgb::draw_pixel_at(int x, int y, Color color) {
|
259
|
+
if (!this->get_clipping().inside(x, y) || this->is_failed())
|
260
|
+
return;
|
261
|
+
|
262
|
+
switch (this->rotation_) {
|
263
|
+
case display::DISPLAY_ROTATION_0_DEGREES:
|
264
|
+
break;
|
265
|
+
case display::DISPLAY_ROTATION_90_DEGREES:
|
266
|
+
std::swap(x, y);
|
267
|
+
x = this->width_ - x - 1;
|
268
|
+
break;
|
269
|
+
case display::DISPLAY_ROTATION_180_DEGREES:
|
270
|
+
x = this->width_ - x - 1;
|
271
|
+
y = this->height_ - y - 1;
|
272
|
+
break;
|
273
|
+
case display::DISPLAY_ROTATION_270_DEGREES:
|
274
|
+
std::swap(x, y);
|
275
|
+
y = this->height_ - y - 1;
|
276
|
+
break;
|
277
|
+
}
|
278
|
+
if (x >= this->get_width_internal() || x < 0 || y >= this->get_height_internal() || y < 0) {
|
279
|
+
return;
|
280
|
+
}
|
281
|
+
if (!this->check_buffer_())
|
282
|
+
return;
|
283
|
+
size_t pos = (y * this->width_) + x;
|
284
|
+
uint8_t hi_byte = static_cast<uint8_t>(color.r & 0xF8) | (color.g >> 5);
|
285
|
+
uint8_t lo_byte = static_cast<uint8_t>((color.g & 0x1C) << 3) | (color.b >> 3);
|
286
|
+
uint16_t new_color = hi_byte | (lo_byte << 8); // big endian
|
287
|
+
if (this->buffer_[pos] == new_color)
|
288
|
+
return;
|
289
|
+
this->buffer_[pos] = new_color;
|
290
|
+
// low and high watermark may speed up drawing from buffer
|
291
|
+
if (x < this->x_low_)
|
292
|
+
this->x_low_ = x;
|
293
|
+
if (y < this->y_low_)
|
294
|
+
this->y_low_ = y;
|
295
|
+
if (x > this->x_high_)
|
296
|
+
this->x_high_ = x;
|
297
|
+
if (y > this->y_high_)
|
298
|
+
this->y_high_ = y;
|
299
|
+
}
|
300
|
+
void MipiRgb::fill(Color color) {
|
301
|
+
if (!this->check_buffer_())
|
302
|
+
return;
|
303
|
+
auto *ptr_16 = reinterpret_cast<uint16_t *>(this->buffer_);
|
304
|
+
uint8_t hi_byte = static_cast<uint8_t>(color.r & 0xF8) | (color.g >> 5);
|
305
|
+
uint8_t lo_byte = static_cast<uint8_t>((color.g & 0x1C) << 3) | (color.b >> 3);
|
306
|
+
uint16_t new_color = lo_byte | (hi_byte << 8); // little endian
|
307
|
+
std::fill_n(ptr_16, this->width_ * this->height_, new_color);
|
308
|
+
}
|
309
|
+
|
310
|
+
int MipiRgb::get_width() {
|
311
|
+
switch (this->rotation_) {
|
312
|
+
case display::DISPLAY_ROTATION_90_DEGREES:
|
313
|
+
case display::DISPLAY_ROTATION_270_DEGREES:
|
314
|
+
return this->get_height_internal();
|
315
|
+
case display::DISPLAY_ROTATION_0_DEGREES:
|
316
|
+
case display::DISPLAY_ROTATION_180_DEGREES:
|
317
|
+
default:
|
318
|
+
return this->get_width_internal();
|
319
|
+
}
|
320
|
+
}
|
321
|
+
|
322
|
+
int MipiRgb::get_height() {
|
323
|
+
switch (this->rotation_) {
|
324
|
+
case display::DISPLAY_ROTATION_0_DEGREES:
|
325
|
+
case display::DISPLAY_ROTATION_180_DEGREES:
|
326
|
+
return this->get_height_internal();
|
327
|
+
case display::DISPLAY_ROTATION_90_DEGREES:
|
328
|
+
case display::DISPLAY_ROTATION_270_DEGREES:
|
329
|
+
default:
|
330
|
+
return this->get_width_internal();
|
331
|
+
}
|
332
|
+
}
|
333
|
+
|
334
|
+
static std::string get_pin_name(GPIOPin *pin) {
|
335
|
+
if (pin == nullptr)
|
336
|
+
return "None";
|
337
|
+
return pin->dump_summary();
|
338
|
+
}
|
339
|
+
|
340
|
+
void MipiRgb::dump_pins_(uint8_t start, uint8_t end, const char *name, uint8_t offset) {
|
341
|
+
for (uint8_t i = start; i != end; i++) {
|
342
|
+
ESP_LOGCONFIG(TAG, " %s pin %d: %s", name, offset++, this->data_pins_[i]->dump_summary().c_str());
|
343
|
+
}
|
344
|
+
}
|
345
|
+
|
346
|
+
void MipiRgb::dump_config() {
|
347
|
+
ESP_LOGCONFIG(TAG,
|
348
|
+
"MIPI_RGB LCD"
|
349
|
+
"\n Model: %s"
|
350
|
+
"\n Width: %u"
|
351
|
+
"\n Height: %u"
|
352
|
+
"\n Rotation: %d degrees"
|
353
|
+
"\n HSync Pulse Width: %u"
|
354
|
+
"\n HSync Back Porch: %u"
|
355
|
+
"\n HSync Front Porch: %u"
|
356
|
+
"\n VSync Pulse Width: %u"
|
357
|
+
"\n VSync Back Porch: %u"
|
358
|
+
"\n VSync Front Porch: %u"
|
359
|
+
"\n Invert Colors: %s"
|
360
|
+
"\n Pixel Clock: %dMHz"
|
361
|
+
"\n Reset Pin: %s"
|
362
|
+
"\n DE Pin: %s"
|
363
|
+
"\n PCLK Pin: %s"
|
364
|
+
"\n HSYNC Pin: %s"
|
365
|
+
"\n VSYNC Pin: %s",
|
366
|
+
this->model_, this->width_, this->height_, this->rotation_, this->hsync_pulse_width_,
|
367
|
+
this->hsync_back_porch_, this->hsync_front_porch_, this->vsync_pulse_width_, this->vsync_back_porch_,
|
368
|
+
this->vsync_front_porch_, YESNO(this->invert_colors_), this->pclk_frequency_ / 1000000,
|
369
|
+
get_pin_name(this->reset_pin_).c_str(), get_pin_name(this->de_pin_).c_str(),
|
370
|
+
get_pin_name(this->pclk_pin_).c_str(), get_pin_name(this->hsync_pin_).c_str(),
|
371
|
+
get_pin_name(this->vsync_pin_).c_str());
|
372
|
+
|
373
|
+
if (this->madctl_ & MADCTL_BGR) {
|
374
|
+
this->dump_pins_(8, 13, "Blue", 0);
|
375
|
+
this->dump_pins_(13, 16, "Green", 0);
|
376
|
+
this->dump_pins_(0, 3, "Green", 3);
|
377
|
+
this->dump_pins_(3, 8, "Red", 0);
|
378
|
+
} else {
|
379
|
+
this->dump_pins_(8, 13, "Red", 0);
|
380
|
+
this->dump_pins_(13, 16, "Green", 0);
|
381
|
+
this->dump_pins_(0, 3, "Green", 3);
|
382
|
+
this->dump_pins_(3, 8, "Blue", 0);
|
383
|
+
}
|
384
|
+
}
|
385
|
+
|
386
|
+
} // namespace mipi_rgb
|
387
|
+
} // namespace esphome
|
388
|
+
#endif // USE_ESP32_VARIANT_ESP32S3
|
@@ -0,0 +1,127 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#ifdef USE_ESP32_VARIANT_ESP32S3
|
4
|
+
#include "esphome/core/gpio.h"
|
5
|
+
#include "esphome/components/display/display.h"
|
6
|
+
#include "esp_lcd_panel_ops.h"
|
7
|
+
#ifdef USE_SPI
|
8
|
+
#include "esphome/components/spi/spi.h"
|
9
|
+
#endif
|
10
|
+
|
11
|
+
namespace esphome {
|
12
|
+
namespace mipi_rgb {
|
13
|
+
|
14
|
+
constexpr static const char *const TAG = "display.mipi_rgb";
|
15
|
+
const uint8_t SW_RESET_CMD = 0x01;
|
16
|
+
const uint8_t SLEEP_OUT = 0x11;
|
17
|
+
const uint8_t SDIR_CMD = 0xC7;
|
18
|
+
const uint8_t MADCTL_CMD = 0x36;
|
19
|
+
const uint8_t INVERT_OFF = 0x20;
|
20
|
+
const uint8_t INVERT_ON = 0x21;
|
21
|
+
const uint8_t DISPLAY_ON = 0x29;
|
22
|
+
const uint8_t CMD2_BKSEL = 0xFF;
|
23
|
+
const uint8_t CMD2_BK0[5] = {0x77, 0x01, 0x00, 0x00, 0x10};
|
24
|
+
|
25
|
+
class MipiRgb : public display::Display {
|
26
|
+
public:
|
27
|
+
MipiRgb(int width, int height) : width_(width), height_(height) {}
|
28
|
+
void setup() override;
|
29
|
+
void loop() override;
|
30
|
+
void update() override;
|
31
|
+
void fill(Color color);
|
32
|
+
void draw_pixels_at(int x_start, int y_start, int w, int h, const uint8_t *ptr, display::ColorOrder order,
|
33
|
+
display::ColorBitness bitness, bool big_endian, int x_offset, int y_offset, int x_pad) override;
|
34
|
+
void write_to_display_(int x_start, int y_start, int w, int h, const uint8_t *ptr, int x_offset, int y_offset,
|
35
|
+
int x_pad);
|
36
|
+
bool check_buffer_();
|
37
|
+
|
38
|
+
display::ColorOrder get_color_mode() { return this->color_mode_; }
|
39
|
+
void set_color_mode(display::ColorOrder color_mode) { this->color_mode_ = color_mode; }
|
40
|
+
void set_invert_colors(bool invert_colors) { this->invert_colors_ = invert_colors; }
|
41
|
+
void set_madctl(uint8_t madctl) { this->madctl_ = madctl; }
|
42
|
+
|
43
|
+
void add_data_pin(InternalGPIOPin *data_pin, size_t index) { this->data_pins_[index] = data_pin; };
|
44
|
+
void set_de_pin(InternalGPIOPin *de_pin) { this->de_pin_ = de_pin; }
|
45
|
+
void set_pclk_pin(InternalGPIOPin *pclk_pin) { this->pclk_pin_ = pclk_pin; }
|
46
|
+
void set_vsync_pin(InternalGPIOPin *vsync_pin) { this->vsync_pin_ = vsync_pin; }
|
47
|
+
void set_hsync_pin(InternalGPIOPin *hsync_pin) { this->hsync_pin_ = hsync_pin; }
|
48
|
+
void set_reset_pin(GPIOPin *reset_pin) { this->reset_pin_ = reset_pin; }
|
49
|
+
void set_width(uint16_t width) { this->width_ = width; }
|
50
|
+
void set_pclk_frequency(uint32_t pclk_frequency) { this->pclk_frequency_ = pclk_frequency; }
|
51
|
+
void set_pclk_inverted(bool inverted) { this->pclk_inverted_ = inverted; }
|
52
|
+
void set_model(const char *model) { this->model_ = model; }
|
53
|
+
int get_width() override;
|
54
|
+
int get_height() override;
|
55
|
+
void set_hsync_back_porch(uint16_t hsync_back_porch) { this->hsync_back_porch_ = hsync_back_porch; }
|
56
|
+
void set_hsync_front_porch(uint16_t hsync_front_porch) { this->hsync_front_porch_ = hsync_front_porch; }
|
57
|
+
void set_hsync_pulse_width(uint16_t hsync_pulse_width) { this->hsync_pulse_width_ = hsync_pulse_width; }
|
58
|
+
void set_vsync_pulse_width(uint16_t vsync_pulse_width) { this->vsync_pulse_width_ = vsync_pulse_width; }
|
59
|
+
void set_vsync_back_porch(uint16_t vsync_back_porch) { this->vsync_back_porch_ = vsync_back_porch; }
|
60
|
+
void set_vsync_front_porch(uint16_t vsync_front_porch) { this->vsync_front_porch_ = vsync_front_porch; }
|
61
|
+
void set_enable_pins(std::vector<GPIOPin *> enable_pins) { this->enable_pins_ = std::move(enable_pins); }
|
62
|
+
display::DisplayType get_display_type() override { return display::DisplayType::DISPLAY_TYPE_COLOR; }
|
63
|
+
int get_width_internal() override { return this->width_; }
|
64
|
+
int get_height_internal() override { return this->height_; }
|
65
|
+
void dump_pins_(uint8_t start, uint8_t end, const char *name, uint8_t offset);
|
66
|
+
void dump_config() override;
|
67
|
+
void draw_pixel_at(int x, int y, Color color) override;
|
68
|
+
|
69
|
+
// this will be horribly slow.
|
70
|
+
protected:
|
71
|
+
void setup_enables_();
|
72
|
+
void common_setup_();
|
73
|
+
InternalGPIOPin *de_pin_{nullptr};
|
74
|
+
InternalGPIOPin *pclk_pin_{nullptr};
|
75
|
+
InternalGPIOPin *hsync_pin_{nullptr};
|
76
|
+
InternalGPIOPin *vsync_pin_{nullptr};
|
77
|
+
GPIOPin *reset_pin_{nullptr};
|
78
|
+
InternalGPIOPin *data_pins_[16] = {};
|
79
|
+
uint16_t hsync_pulse_width_ = 10;
|
80
|
+
uint16_t hsync_back_porch_ = 10;
|
81
|
+
uint16_t hsync_front_porch_ = 20;
|
82
|
+
uint16_t vsync_pulse_width_ = 10;
|
83
|
+
uint16_t vsync_back_porch_ = 10;
|
84
|
+
uint16_t vsync_front_porch_ = 10;
|
85
|
+
uint32_t pclk_frequency_ = 16 * 1000 * 1000;
|
86
|
+
bool pclk_inverted_{true};
|
87
|
+
uint8_t madctl_{};
|
88
|
+
const char *model_{"Unknown"};
|
89
|
+
bool invert_colors_{};
|
90
|
+
display::ColorOrder color_mode_{display::COLOR_ORDER_BGR};
|
91
|
+
size_t width_;
|
92
|
+
size_t height_;
|
93
|
+
uint16_t *buffer_{nullptr};
|
94
|
+
std::vector<GPIOPin *> enable_pins_{};
|
95
|
+
uint16_t x_low_{1};
|
96
|
+
uint16_t y_low_{1};
|
97
|
+
uint16_t x_high_{0};
|
98
|
+
uint16_t y_high_{0};
|
99
|
+
|
100
|
+
esp_lcd_panel_handle_t handle_{};
|
101
|
+
};
|
102
|
+
|
103
|
+
#ifdef USE_SPI
|
104
|
+
class MipiRgbSpi : public MipiRgb,
|
105
|
+
public spi::SPIDevice<spi::BIT_ORDER_MSB_FIRST, spi::CLOCK_POLARITY_LOW, spi::CLOCK_PHASE_LEADING,
|
106
|
+
spi::DATA_RATE_1MHZ> {
|
107
|
+
public:
|
108
|
+
MipiRgbSpi(int width, int height) : MipiRgb(width, height) {}
|
109
|
+
|
110
|
+
void set_init_sequence(const std::vector<uint8_t> &init_sequence) { this->init_sequence_ = init_sequence; }
|
111
|
+
void set_dc_pin(GPIOPin *dc_pin) { this->dc_pin_ = dc_pin; }
|
112
|
+
void setup() override;
|
113
|
+
|
114
|
+
protected:
|
115
|
+
void write_command_(uint8_t value);
|
116
|
+
void write_data_(uint8_t value);
|
117
|
+
void write_init_sequence_();
|
118
|
+
void dump_config();
|
119
|
+
|
120
|
+
GPIOPin *dc_pin_{nullptr};
|
121
|
+
std::vector<uint8_t> init_sequence_;
|
122
|
+
};
|
123
|
+
#endif
|
124
|
+
|
125
|
+
} // namespace mipi_rgb
|
126
|
+
} // namespace esphome
|
127
|
+
#endif
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from .st7701s import st7701s
|
2
|
+
|
3
|
+
st7701s.extend(
|
4
|
+
"GUITION-4848S040",
|
5
|
+
width=480,
|
6
|
+
height=480,
|
7
|
+
data_rate="2MHz",
|
8
|
+
cs_pin=39,
|
9
|
+
de_pin=18,
|
10
|
+
hsync_pin=16,
|
11
|
+
vsync_pin=17,
|
12
|
+
pclk_pin=21,
|
13
|
+
pclk_frequency="12MHz",
|
14
|
+
pixel_mode="18bit",
|
15
|
+
mirror_x=True,
|
16
|
+
mirror_y=True,
|
17
|
+
data_pins={
|
18
|
+
"red": [11, 12, 13, 14, 0],
|
19
|
+
"green": [8, 20, 3, 46, 9, 10],
|
20
|
+
"blue": [4, 5, 6, 7, 15],
|
21
|
+
},
|
22
|
+
# Additional configuration for Guition 4848S040, 16 bit bus config
|
23
|
+
add_init_sequence=((0xCD, 0x00),),
|
24
|
+
)
|