update: Added button at GPIO 0 for testing.
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/managed_components
|
||||
58
dependencies.lock
Normal file
58
dependencies.lock
Normal file
@@ -0,0 +1,58 @@
|
||||
dependencies:
|
||||
espressif/esp_lcd_touch:
|
||||
component_hash: cf4741f4903bdfe83c0a6606cb33314957e78605398954154f247e03acfd306b
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=4.4.2'
|
||||
source:
|
||||
registry_url: https://components.espressif.com
|
||||
type: service
|
||||
version: 1.2.0
|
||||
espressif/esp_lcd_touch_cst816s:
|
||||
component_hash: 270bd7df3a2a5cffa3a626c4709fc03237d83fd9daa6fb70c833a2f1875f0f68
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=4.4.2'
|
||||
- name: espressif/esp_lcd_touch
|
||||
registry_url: https://components.espressif.com
|
||||
require: public
|
||||
version: ^1.0.4
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 1.0.3
|
||||
espressif/esp_lvgl_port:
|
||||
component_hash: f872401524cb645ee6ff1c9242d44fb4ddcfd4d37d7be8b9ed3f4e85a404efcd
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=5.1'
|
||||
- name: lvgl/lvgl
|
||||
registry_url: https://components.espressif.com
|
||||
require: public
|
||||
version: '>=8,<10'
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 2.7.0
|
||||
idf:
|
||||
source:
|
||||
type: idf
|
||||
version: 5.5.0
|
||||
lvgl/lvgl:
|
||||
component_hash: d7c1ac037ae6e85d94897f807d6e7ba0946a83e720074fc95a4f6241da9f9f53
|
||||
dependencies: []
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 8.4.0
|
||||
direct_dependencies:
|
||||
- espressif/esp_lcd_touch_cst816s
|
||||
- espressif/esp_lvgl_port
|
||||
- idf
|
||||
- lvgl/lvgl
|
||||
manifest_hash: 391e610bbbb8dd2ca0bd0161b6e90827107ad7670c55565d19b2c3b880766aee
|
||||
target: esp32s3
|
||||
version: 2.0.0
|
||||
33
main/main.c
33
main/main.c
@@ -17,6 +17,8 @@
|
||||
#include "lv_conf.h"
|
||||
#include "lv_demos.h"
|
||||
#include "esp_lcd_touch_cst816s.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
/* LCD size */
|
||||
#define EXAMPLE_LCD_H_RES (240)
|
||||
#define EXAMPLE_LCD_V_RES (280)
|
||||
@@ -44,6 +46,9 @@
|
||||
|
||||
#define TOUCH_HOST I2C_NUM_0
|
||||
|
||||
/* Power button */
|
||||
#define PWR_BUTTON_GPIO (GPIO_NUM_0)
|
||||
|
||||
#if EXAMPLE_USE_TOUCH
|
||||
#define EXAMPLE_PIN_NUM_TOUCH_SCL (GPIO_NUM_10)
|
||||
#define EXAMPLE_PIN_NUM_TOUCH_SDA (GPIO_NUM_11)
|
||||
@@ -225,8 +230,36 @@ static void app_main_display(void)
|
||||
lvgl_port_unlock();
|
||||
}
|
||||
|
||||
static void wait_for_power_button(void)
|
||||
{
|
||||
/* Configure power button GPIO */
|
||||
gpio_config_t pwr_btn_config = {
|
||||
.mode = GPIO_MODE_INPUT,
|
||||
.pin_bit_mask = 1ULL << PWR_BUTTON_GPIO,
|
||||
.pull_up_en = GPIO_PULLUP_ENABLE,
|
||||
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
||||
.intr_type = GPIO_INTR_DISABLE,
|
||||
};
|
||||
ESP_ERROR_CHECK(gpio_config(&pwr_btn_config));
|
||||
|
||||
ESP_LOGI(TAG, "Waiting for power button press on GPIO %d...", PWR_BUTTON_GPIO);
|
||||
|
||||
/* Wait for button press (active low) */
|
||||
while (gpio_get_level(PWR_BUTTON_GPIO) == 1) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
|
||||
/* Debounce delay */
|
||||
vTaskDelay(pdMS_TO_TICKS(50));
|
||||
|
||||
ESP_LOGI(TAG, "Power button pressed, starting system...");
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
/* Wait for power button press before starting */
|
||||
wait_for_power_button();
|
||||
|
||||
/* LCD HW initialization */
|
||||
ESP_ERROR_CHECK(app_lcd_init());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user