Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Devices/cyd-4848s040c/Source/devices/St7701Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <Gt911Touch.h>
#include <PwmBacklight.h>
#include <Tactility/Logger.h>
#include <tactility/check.h>
#include <tactility/device.h>
#include <tactility/log.h>

#include <driver/gpio.h>
#include <esp_err.h>
Expand All @@ -16,7 +16,7 @@
#include <soc/spi_periph.h>
#include <driver/spi_master.h>

static const auto LOGGER = tt::Logger("St7701Display");
constexpr auto* TAG = "St7701Display";

// GPIO47/48 are physically shared between this bit-banged 3-wire command bus
// and the SD card's real SPI2 bus (no alternate pins exist on this PCB).
Expand Down Expand Up @@ -171,29 +171,29 @@ bool St7701Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, esp_lc
};

if (esp_lcd_new_panel_st7701(ioHandle, &panel_config, &panelHandle) != ESP_OK) {
LOGGER.error("Failed to create panel");
LOG_E(TAG, "Failed to create panel");
return false;
}

if (esp_lcd_panel_reset(panelHandle) != ESP_OK) {
LOGGER.error("Failed to reset panel");
LOG_E(TAG, "Failed to reset panel");
return false;
}

if (esp_lcd_panel_init(panelHandle) != ESP_OK) {
LOGGER.error("Failed to init panel");
LOG_E(TAG, "Failed to init panel");
return false;
}

if (esp_lcd_panel_invert_color(panelHandle, false) != ESP_OK) {
LOGGER.error("Failed to invert color");
LOG_E(TAG, "Failed to invert color");
return false;
}

esp_lcd_panel_set_gap(panelHandle, 0, 0);

if (esp_lcd_panel_disp_on_off(panelHandle, true) != ESP_OK) {
LOGGER.error("Failed to turn display on");
LOG_E(TAG, "Failed to turn display on");
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions Devices/guition-jc1060p470ciwy/Source/devices/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#include <Gt911Touch.h>
#include <PwmBacklight.h>
#include <Tactility/Logger.h>
#include <Tactility/Mutex.h>
#include <tactility/check.h>
#include <tactility/device.h>
#include <tactility/log.h>

constexpr auto LCD_PIN_RESET = GPIO_NUM_0; // Match P4 EV board reset line
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_23;
Expand Down Expand Up @@ -36,7 +36,7 @@ static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
// Initialize PWM backlight
if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT, 20000, LEDC_TIMER_1, LEDC_CHANNEL_0)) {
tt::Logger("jc1060p470ciwy").warn("Failed to initialize backlight");
LOG_W("jc1060p470ciwy", "Failed to initialize backlight");
}

auto touch = createTouch();
Expand Down
20 changes: 10 additions & 10 deletions Devices/guition-jc1060p470ciwy/Source/devices/Jd9165Display.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "Jd9165Display.h"

#include <Tactility/Logger.h>
#include <tactility/log.h>

#include <esp_lcd_jd9165.h>

static const auto LOGGER = tt::Logger("JD9165");
constexpr auto* TAG = "JD9165";

// MIPI DSI PHY power configuration
#define MIPI_DSI_PHY_PWR_LDO_CHAN 3 // LDO_VO3 connects to VDD_MIPI_DPHY
Expand Down Expand Up @@ -87,11 +87,11 @@ bool Jd9165Display::createMipiDsiBus() {
};

if (esp_ldo_acquire_channel(&ldo_mipi_phy_config, &ldoChannel) != ESP_OK) {
LOGGER.error("Failed to acquire LDO channel for MIPI DSI PHY");
LOG_E(TAG, "Failed to acquire LDO channel for MIPI DSI PHY");
return false;
}
LOGGER.info("MIPI DSI PHY powered on");

LOG_I(TAG, "MIPI DSI PHY powered on");

// Create MIPI DSI bus
// TODO: use MIPI_DSI_PHY_CLK_SRC_DEFAULT() in future ESP-IDF 6.0.0 update with esp_lcd_jd9165 library version 2.x
Expand All @@ -103,11 +103,11 @@ bool Jd9165Display::createMipiDsiBus() {
};

if (esp_lcd_new_dsi_bus(&bus_config, &mipiDsiBus) != ESP_OK) {
LOGGER.error("Failed to create MIPI DSI bus");
LOG_E(TAG, "Failed to create MIPI DSI bus");
return false;
}

LOGGER.info("MIPI DSI bus created");
LOG_I(TAG, "MIPI DSI bus created");
return true;
}

Expand All @@ -123,7 +123,7 @@ bool Jd9165Display::createIoHandle(esp_lcd_panel_io_handle_t& ioHandle) {
esp_lcd_dbi_io_config_t dbi_config = JD9165_PANEL_IO_DBI_CONFIG();

if (esp_lcd_new_panel_io_dbi(mipiDsiBus, &dbi_config, &ioHandle) != ESP_OK) {
LOGGER.error("Failed to create panel IO");
LOG_E(TAG, "Failed to create panel IO");
return false;
}

Expand Down Expand Up @@ -184,11 +184,11 @@ bool Jd9165Display::createPanelHandle(esp_lcd_panel_io_handle_t ioHandle, const
mutable_panel_config.vendor_config = &vendor_config;

if (esp_lcd_new_panel_jd9165(ioHandle, &mutable_panel_config, &panelHandle) != ESP_OK) {
LOGGER.error("Failed to create panel");
LOG_E(TAG, "Failed to create panel");
return false;
}

LOGGER.info("JD9165 panel created successfully");
LOG_I(TAG, "JD9165 panel created successfully");
// Defer reset/init to base class applyConfiguration to avoid double initialization
return true;
}
Expand Down
16 changes: 8 additions & 8 deletions Devices/guition-jc1060p470ciwy/Source/devices/Power.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "Power.h"

#include <Tactility/Logger.h>
#include <ChargeFromVoltage.h>
#include <tactility/log.h>
#include <esp_adc/adc_oneshot.h>
#include <esp_adc/adc_cali.h>
#include <esp_adc/adc_cali_scheme.h>

using tt::hal::power::PowerDevice;

static const auto LOGGER = tt::Logger("JcPower");
constexpr auto* TAG = "JcPower";

namespace {

Expand Down Expand Up @@ -71,7 +71,7 @@ class JcPower final : public PowerDevice {
.ulp_mode = ADC_ULP_MODE_DISABLE,
};
if (adc_oneshot_new_unit(&init_cfg, &adcHandle) != ESP_OK) {
LOGGER.error("ADC unit init failed");
LOG_E(TAG, "ADC unit init failed");
return false;
}

Expand All @@ -80,7 +80,7 @@ class JcPower final : public PowerDevice {
.bitwidth = ADC_BITWIDTH_DEFAULT,
};
if (adc_oneshot_config_channel(adcHandle, ADC_CHANNEL, &chan_cfg) != ESP_OK) {
LOGGER.error("ADC channel config failed");
LOG_E(TAG, "ADC channel config failed");
adc_oneshot_del_unit(adcHandle);
adcHandle = nullptr;
return false;
Expand All @@ -100,7 +100,7 @@ class JcPower final : public PowerDevice {
};
if (adc_cali_create_scheme_line_fitting(&cali_config, &caliHandle) == ESP_OK) {
calScheme = CaliScheme::Line;
LOGGER.info("ADC calibration (line fitting) enabled");
LOG_I(TAG, "ADC calibration (line fitting) enabled");
return true;
}
#endif
Expand All @@ -114,19 +114,19 @@ class JcPower final : public PowerDevice {
};
if (adc_cali_create_scheme_curve_fitting(&curve_cfg, &caliHandle) == ESP_OK) {
calScheme = CaliScheme::Curve;
LOGGER.info("ADC calibration (curve fitting) enabled");
LOG_I(TAG, "ADC calibration (curve fitting) enabled");
return true;
}
#endif

LOGGER.warn("ADC calibration not available, using raw scaling");
LOG_W(TAG, "ADC calibration not available, using raw scaling");
return false;
}

bool readBatteryMilliVolt(uint32_t& outMv) {
int raw = 0;
if (adc_oneshot_read(adcHandle, ADC_CHANNEL, &raw) != ESP_OK) {
LOGGER.error("ADC read failed");
LOG_E(TAG, "ADC read failed");
return false;
}

Expand Down
Loading
Loading