diff --git a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/README.md b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/README.md index 7402137c..83224341 100644 --- a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/README.md +++ b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/README.md @@ -1,4 +1,3 @@ - # 产品链接 微雪电子 ESP32-C5-Touch-LCD-1.69 diff --git a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.h b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.h index a70e16b2..ac52a49c 100644 --- a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.h +++ b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.h @@ -18,7 +18,6 @@ #define AUDIO_CODEC_ES8311_ADDR ES8311_CODEC_DEFAULT_ADDR #define BOOT_BUTTON_GPIO GPIO_NUM_28 -#define PWR_BUTTON_GPIO IO_EXPANDER_PIN_NUM_4 #define DISPLAY_SPI_MODE SPI2_HOST #define DISPLAY_CS_PIN GPIO_NUM_27 diff --git a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.json b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.json index fb4dc2fb..c5557444 100644 --- a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.json +++ b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/config.json @@ -15,4 +15,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/esp32-c5-touch-lcd-1.69.cc b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/esp32-c5-touch-lcd-1.69.cc index 4b264082..973f56b9 100644 --- a/main/boards/waveshare/esp32-c5-touch-lcd-1.69/esp32-c5-touch-lcd-1.69.cc +++ b/main/boards/waveshare/esp32-c5-touch-lcd-1.69/esp32-c5-touch-lcd-1.69.cc @@ -16,7 +16,6 @@ #include #include - #define TAG "WaveshareEsp32c5TouchLCD1inch69" class WaveshareEsp32c5TouchLCD1inch69 : public WifiBoard { @@ -33,19 +32,18 @@ private: power_save_timer_ = new PowerSaveTimer(-1, 60, 300); power_save_timer_->OnEnterSleepMode([this]() { GetDisplay()->SetPowerSaveMode(true); - GetBacklight()->SetBrightness(20); }); + GetBacklight()->SetBrightness(20); + }); power_save_timer_->OnExitSleepMode([this]() { GetDisplay()->SetPowerSaveMode(false); - GetBacklight()->RestoreBrightness(); }); - power_save_timer_->OnShutdownRequest([this](){ - // pmic_->PowerOff(); + GetBacklight()->RestoreBrightness(); }); power_save_timer_->SetEnabled(true); } void InitializeCodecI2c() { // Initialize I2C peripheral - i2c_config_t conf ; + i2c_config_t conf = {}; conf.mode = I2C_MODE_MASTER; conf.sda_io_num = AUDIO_CODEC_I2C_SDA_PIN; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; @@ -122,14 +120,14 @@ private: buscfg.sclk_io_num = DISPLAY_CLK_PIN; buscfg.quadwp_io_num = GPIO_NUM_NC; buscfg.quadhd_io_num = GPIO_NUM_NC; - buscfg.max_transfer_sz = DISPLAY_WIDTH* DISPLAY_HEIGHT* sizeof(uint16_t); + buscfg.max_transfer_sz = DISPLAY_WIDTH * DISPLAY_HEIGHT * sizeof(uint16_t); ESP_ERROR_CHECK(spi_bus_initialize(DISPLAY_SPI_MODE, &buscfg, SPI_DMA_CH_AUTO)); } void InitializeButtons() { boot_button_.OnClick([this]() { auto& app = Application::GetInstance(); - if (app.GetDeviceState() == kDeviceStateStarting) { + if (app.GetDeviceState() == kDeviceStateStarting) { EnterWifiConfigMode(); return; } @@ -201,10 +199,10 @@ private: ESP_ERROR_CHECK(esp_lcd_new_panel_io_i2c(i2c_handle_, &tp_io_config, &tp_io_handle)); ESP_LOGI(TAG, "Initialize touch controller"); - // esp_io_expander_set_level(expander, DISPLAY_TOUCH_RST_PIN, false); - // vTaskDelay(100 / portTICK_PERIOD_MS); - // esp_io_expander_set_level(expander, DISPLAY_TOUCH_RST_PIN, true); - // vTaskDelay(100 / portTICK_PERIOD_MS); + esp_io_expander_set_level(expander, DISPLAY_TOUCH_RST_PIN, false); + vTaskDelay(pdMS_TO_TICKS(100)); + esp_io_expander_set_level(expander, DISPLAY_TOUCH_RST_PIN, true); + vTaskDelay(pdMS_TO_TICKS(100)); ESP_ERROR_CHECK(esp_lcd_touch_new_i2c_cst816s(tp_io_handle, &tp_cfg, &tp)); const lvgl_port_touch_cfg_t touch_cfg = { @@ -229,12 +227,12 @@ private: public: WaveshareEsp32c5TouchLCD1inch69() : boot_button_(BOOT_BUTTON_GPIO) { - InitializePowerSaveTimer(); + InitializePowerSaveTimer(); InitializeCodecI2c(); InitializeBq27220(1000); InitializeSpi(); InitializeDisplay(); - // InitializeTouch(); + InitializeTouch(); InitializeButtons(); InitializeTools(); GetBacklight()->RestoreBrightness(); diff --git a/main/idf_component.yml b/main/idf_component.yml index cb9fb3ff..9baa9636 100644 --- a/main/idf_component.yml +++ b/main/idf_component.yml @@ -134,10 +134,10 @@ dependencies: version: ^0.3.1 rules: - if: target in [esp32s3, esp32p4] - + espressif/bq27220: public: true - version: '*' + version: '*' ## Required IDF version idf: diff --git a/main/main.cc b/main/main.cc index f688b4f0..f7e8bc3b 100755 --- a/main/main.cc +++ b/main/main.cc @@ -27,4 +27,3 @@ extern "C" void app_main(void) app.Initialize(); app.Run(); // This function runs the main event loop and never returns } - \ No newline at end of file