mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-17 23:55:04 +00:00
Compare commits
11 Commits
24aed54671
...
7273b4069a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7273b4069a | ||
|
|
ee0f45cd27 | ||
|
|
d67d051268 | ||
|
|
b9ac840db4 | ||
|
|
722280379a | ||
|
|
6772fd5059 | ||
|
|
6986cbd1c5 | ||
|
|
822a7a2fd4 | ||
|
|
387ed31087 | ||
|
|
3d125ccd87 | ||
|
|
14251f3b90 |
@ -46,7 +46,7 @@
|
||||
pin = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -82,8 +82,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 27 GPIO_FLAG_NONE>;
|
||||
period-ns = <1953125>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
pin = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -67,8 +67,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 27 GPIO_FLAG_NONE>;
|
||||
period-ns = <1953125>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
pin = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -66,8 +66,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
period-ns = <1953125>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
rgb_led_pwm {
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
pin = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -76,8 +76,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
period-ns = <1953125>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
pin = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -82,8 +82,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 27 GPIO_FLAG_NONE>;
|
||||
period-ns = <33333>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
pin = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -92,8 +92,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 27 GPIO_FLAG_NONE>;
|
||||
period-ns = <33333>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
pin = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -67,8 +67,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
period-ns = <1953125>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
pin = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -93,8 +93,8 @@
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 27 GPIO_FLAG_NONE>;
|
||||
period-ns = <25000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <0>;
|
||||
ledc-timer = <1>;
|
||||
ledc-channel = <3>;
|
||||
};
|
||||
|
||||
display_backlight {
|
||||
|
||||
@ -2,5 +2,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
REQUIRES TactilityKernel driver
|
||||
REQUIRES TactilityKernel
|
||||
)
|
||||
|
||||
@ -2,5 +2,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
REQUIRES TactilityKernel driver
|
||||
REQUIRES TactilityKernel
|
||||
)
|
||||
|
||||
@ -2,5 +2,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
REQUIRES TactilityKernel driver
|
||||
REQUIRES TactilityKernel
|
||||
)
|
||||
|
||||
@ -2,5 +2,5 @@ file(GLOB_RECURSE SOURCE_FILES source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
REQUIRES TactilityKernel driver
|
||||
REQUIRES TactilityKernel
|
||||
)
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_wifi_pinned.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_pwm_ledc.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/esp32_wifi_pinned.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/rgb_led_pwm.h>
|
||||
|
||||
@ -76,13 +77,12 @@
|
||||
pin-rx = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
|
||||
rgb_led_channel_red {
|
||||
compatible = "espressif,esp32-pwm-ledc";
|
||||
pin = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <1>;
|
||||
ledc-channel = <0>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -91,7 +91,7 @@
|
||||
pin = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <2>;
|
||||
ledc-channel = <1>;
|
||||
inverted;
|
||||
};
|
||||
|
||||
@ -100,11 +100,8 @@
|
||||
pin = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
period-ns = <500000>;
|
||||
ledc-timer = <0>;
|
||||
ledc-channel = <3>;
|
||||
ledc-channel = <2>;
|
||||
inverted;
|
||||
// Default is red, and we want to reset it to off by default
|
||||
default-color = <0 0 0>;
|
||||
enabled;
|
||||
};
|
||||
|
||||
rgb_led_pwm {
|
||||
@ -112,5 +109,8 @@
|
||||
pwm-red = <&rgb_led_channel_red>;
|
||||
pwm-green = <&rgb_led_channel_green>;
|
||||
pwm-blue = <&rgb_led_channel_blue>;
|
||||
// Default is red, and we want to reset it to off by default
|
||||
default-color = <0 0 0>;
|
||||
enabled;
|
||||
};
|
||||
};
|
||||
|
||||
@ -105,22 +105,27 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<Cst816sInternal*>(device_get_driver_data(device));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
// esp_lcd_touch_del() only releases the touch-side resources; the panel IO handle is owned
|
||||
// separately and needs its own deletion.
|
||||
if (internal->touch_handle != nullptr) {
|
||||
if (esp_lcd_touch_del(internal->touch_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete touch handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->touch_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
free(internal);
|
||||
return ok ? ERROR_NONE : ERROR_RESOURCE;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -105,22 +105,27 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<Ft5x06Internal*>(device_get_driver_data(device));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
// esp_lcd_touch_del() only releases the touch-side resources; the panel IO handle is owned
|
||||
// separately and needs its own deletion.
|
||||
if (internal->touch_handle != nullptr) {
|
||||
if (esp_lcd_touch_del(internal->touch_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete touch handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->touch_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
free(internal);
|
||||
return ok ? ERROR_NONE : ERROR_RESOURCE;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -105,22 +105,27 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<Ft6x36Internal*>(device_get_driver_data(device));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
// esp_lcd_touch_del() only releases the touch-side resources; the panel IO handle is owned
|
||||
// separately and needs its own deletion.
|
||||
if (internal->touch_handle != nullptr) {
|
||||
if (esp_lcd_touch_del(internal->touch_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete touch handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->touch_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
free(internal);
|
||||
return ok ? ERROR_NONE : ERROR_RESOURCE;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -114,22 +114,27 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<Gt911Internal*>(device_get_driver_data(device));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
// esp_lcd_touch_del() only releases the touch-side resources; the panel IO handle is owned
|
||||
// separately and needs its own deletion.
|
||||
if (internal->touch_handle != nullptr) {
|
||||
if (esp_lcd_touch_del(internal->touch_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete touch handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->touch_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
free(internal);
|
||||
return ok ? ERROR_NONE : ERROR_RESOURCE;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -165,20 +165,26 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<Ili9341Internal*>(device_get_driver_data(device));
|
||||
|
||||
error_t result = ERROR_NONE;
|
||||
|
||||
if (internal->panel_handle != nullptr) {
|
||||
if (esp_lcd_panel_del(internal->panel_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel");
|
||||
result = ERROR_RESOURCE;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->panel_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO");
|
||||
result = ERROR_RESOURCE;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
vSemaphoreDelete(internal->draw_done_semaphore);
|
||||
free(internal);
|
||||
return result;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -161,17 +161,25 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<Ili9488Internal*>(device_get_driver_data(device));
|
||||
|
||||
if (internal->panel_handle != nullptr) {
|
||||
if (esp_lcd_panel_del(internal->panel_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel");
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->panel_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO");
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
vSemaphoreDelete(internal->draw_done_semaphore);
|
||||
free(internal);
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -256,15 +256,17 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<RgbDisplayInternal*>(device_get_driver_data(device));
|
||||
|
||||
if (internal->panel_handle != nullptr) {
|
||||
if (esp_lcd_panel_del(internal->panel_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel");
|
||||
vSemaphoreDelete(internal->frame_complete_semaphore);
|
||||
free(internal);
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->panel_handle = nullptr;
|
||||
}
|
||||
|
||||
vSemaphoreDelete(internal->frame_complete_semaphore);
|
||||
free(internal);
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -204,20 +204,26 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<St7789I8080Internal*>(device_get_driver_data(device));
|
||||
|
||||
error_t result = ERROR_NONE;
|
||||
|
||||
if (internal->panel_handle != nullptr) {
|
||||
if (esp_lcd_panel_del(internal->panel_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel");
|
||||
result = ERROR_RESOURCE;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->panel_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO");
|
||||
result = ERROR_RESOURCE;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
vSemaphoreDelete(internal->draw_done_semaphore);
|
||||
free(internal);
|
||||
return result;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -165,17 +165,25 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<St7789Internal*>(device_get_driver_data(device));
|
||||
|
||||
if (internal->panel_handle != nullptr) {
|
||||
if (esp_lcd_panel_del(internal->panel_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel");
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->panel_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO");
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
vSemaphoreDelete(internal->draw_done_semaphore);
|
||||
free(internal);
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -165,20 +165,26 @@ static error_t start(Device* device) {
|
||||
static error_t stop(Device* device) {
|
||||
auto* internal = static_cast<St7796Internal*>(device_get_driver_data(device));
|
||||
|
||||
error_t result = ERROR_NONE;
|
||||
|
||||
if (internal->panel_handle != nullptr) {
|
||||
if (esp_lcd_panel_del(internal->panel_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel");
|
||||
result = ERROR_RESOURCE;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->panel_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO");
|
||||
result = ERROR_RESOURCE;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
vSemaphoreDelete(internal->draw_done_semaphore);
|
||||
free(internal);
|
||||
return result;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -239,24 +239,30 @@ static error_t stop(Device* device) {
|
||||
|
||||
if (internal->power_supply_device != nullptr) {
|
||||
destroy_power_supply_child(internal->power_supply_device);
|
||||
internal->power_supply_device = nullptr;
|
||||
}
|
||||
|
||||
bool ok = true;
|
||||
|
||||
// esp_lcd_touch_del() only releases the touch-side resources; the panel IO handle is owned
|
||||
// separately and needs its own deletion.
|
||||
if (internal->touch_handle != nullptr) {
|
||||
if (esp_lcd_touch_del(internal->touch_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete touch handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->touch_handle = nullptr;
|
||||
}
|
||||
|
||||
if (internal->io_handle != nullptr) {
|
||||
if (esp_lcd_panel_io_del(internal->io_handle) != ESP_OK) {
|
||||
LOG_E(TAG, "Failed to delete panel IO handle");
|
||||
ok = false;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
internal->io_handle = nullptr;
|
||||
}
|
||||
|
||||
free(internal);
|
||||
return ok ? ERROR_NONE : ERROR_RESOURCE;
|
||||
device_set_driver_data(device, nullptr);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@ -5,7 +5,7 @@ dependencies:
|
||||
rules:
|
||||
- if: "target in [esp32s3, esp32c6, esp32p4]"
|
||||
espressif/esp_hosted:
|
||||
version: "*"
|
||||
version: "2.12.11"
|
||||
rules:
|
||||
- if: "target == esp32p4"
|
||||
espressif/esp_wifi_remote:
|
||||
|
||||
@ -25,10 +25,11 @@ struct Esp32PwmLedcInternal {
|
||||
// region Helpers
|
||||
|
||||
static uint32_t compute_freq_hz(uint32_t period_ns) {
|
||||
return (uint32_t)(1000000000ULL / period_ns);
|
||||
return period_ns > 0 ? (uint32_t)(1000000000ULL / period_ns) : 0;
|
||||
}
|
||||
|
||||
static uint32_t compute_raw_duty(uint32_t duty_ns, uint32_t period_ns, ledc_timer_bit_t duty_resolution) {
|
||||
if (period_ns == 0) return 0;
|
||||
uint64_t max_duty = 1ULL << duty_resolution;
|
||||
uint64_t raw_duty = ((uint64_t)duty_ns * max_duty) / period_ns;
|
||||
return (uint32_t)(raw_duty > max_duty ? max_duty : raw_duty);
|
||||
|
||||
@ -110,7 +110,10 @@ static error_t start(Device* device) {
|
||||
|
||||
device_set_driver_data(device, internal);
|
||||
|
||||
gpio_backlight_set_brightness_default(device); // Allowed to fail, we don't care about the result
|
||||
if (gpio_backlight_set_brightness_default(device) != ERROR_NONE) {
|
||||
// Allowed to fail, we don't care about the result
|
||||
LOG_W(TAG, "gpio_backlight_set_brightness_default(%s) failed", device->name);
|
||||
}
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
@ -34,6 +34,10 @@ static error_t apply_brightness(Device* device, uint8_t brightness) {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
if (brightness > config->brightness_range.max) {
|
||||
brightness = config->brightness_range.max;
|
||||
}
|
||||
|
||||
uint32_t period_ns;
|
||||
error_t error = pwm_get_period(config->pwm, &period_ns);
|
||||
if (error != ERROR_NONE) {
|
||||
@ -93,10 +97,16 @@ static constexpr BacklightApi PWM_BACKLIGHT_API = {
|
||||
// region Driver lifecycle
|
||||
|
||||
static error_t start(Device* device) {
|
||||
const auto* config = GET_CONFIG(device);
|
||||
if (config->brightness_range.max <= config->brightness_range.min) {
|
||||
return ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
auto* internal = new(std::nothrow) PwmBacklightInternal { .brightness = GET_CONFIG(device)->brightness_range.min };
|
||||
if (internal == nullptr) {
|
||||
return ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
device_set_driver_data(device, internal);
|
||||
|
||||
pwm_backlight_set_brightness_default(device); // Allowed to fail, we don't care about the result
|
||||
|
||||
@ -126,9 +126,15 @@ static error_t start(Device* device) {
|
||||
device_set_driver_data(device, internal);
|
||||
|
||||
if (config->enabled) {
|
||||
rgb_led_gpio_enable(device); // Allowed to fail, we don't care about the result
|
||||
if (rgb_led_gpio_enable(device) != ERROR_NONE) {
|
||||
// Allowed to fail, we don't care about the result
|
||||
LOG_W(TAG, "led_gpio_enable(%s) failed", device->name);
|
||||
}
|
||||
} else {
|
||||
apply_levels(device); // Allowed to fail, we don't care about the result
|
||||
if (apply_levels(device) != ERROR_NONE) {
|
||||
// Allowed to fail, we don't care about the result
|
||||
LOG_W(TAG, "led_gpio_apply_levels(%s) failed", device->name);
|
||||
}
|
||||
}
|
||||
|
||||
return ERROR_NONE;
|
||||
|
||||
@ -62,19 +62,24 @@ static error_t rgb_led_pwm_get_color(Device* device, RgbLedColor* out_color) {
|
||||
|
||||
static error_t rgb_led_pwm_enable(Device* device) {
|
||||
const auto* config = GET_CONFIG(device);
|
||||
GET_INTERNAL(device)->enabled = true;
|
||||
|
||||
error_t error = pwm_enable(config->pwm_red);
|
||||
if (error == ERROR_NONE) {
|
||||
error = pwm_enable(config->pwm_green);
|
||||
}
|
||||
if (error == ERROR_NONE) {
|
||||
error = pwm_enable(config->pwm_blue);
|
||||
}
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to enable LED");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
error = pwm_enable(config->pwm_green);
|
||||
if (error != ERROR_NONE) {
|
||||
pwm_disable(config->pwm_red);
|
||||
return error;
|
||||
}
|
||||
error = pwm_enable(config->pwm_blue);
|
||||
if (error != ERROR_NONE) {
|
||||
pwm_disable(config->pwm_green);
|
||||
pwm_disable(config->pwm_red);
|
||||
LOG_E(TAG, "Failed to enable LED");
|
||||
return error;
|
||||
}
|
||||
GET_INTERNAL(device)->enabled = true;
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static void rgb_led_pwm_disable(Device* device) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user