Compare commits

..

No commits in common. "adec22bfe7f05f6df7793fb48007acdb4304e0e0" and "baa4ed96df3295951c514953a7ac45d23176b13d" have entirely different histories.

12 changed files with 44 additions and 56 deletions

View File

@ -18,8 +18,33 @@
std::shared_ptr<Bq27220> bq27220; std::shared_ptr<Bq27220> bq27220;
std::shared_ptr<Tca8418> tca8418; std::shared_ptr<Tca8418> tca8418;
bool tpagerInit() { static bool powerOn() {
/*
gpio_config_t device_power_signal_config = {
.pin_bit_mask = BIT64(TDECK_POWERON_GPIO),
.mode = GPIO_MODE_OUTPUT,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE,
};
if (gpio_config(&device_power_signal_config) != ESP_OK) {
return false;
}
if (gpio_set_level(TDECK_POWERON_GPIO, 1) != ESP_OK) {
return false;
}
*/
return true;
}
bool tdeckInit() {
ESP_LOGI(TAG, LOG_MESSAGE_POWER_ON_START); ESP_LOGI(TAG, LOG_MESSAGE_POWER_ON_START);
if (!powerOn()) {
TT_LOG_E(TAG, LOG_MESSAGE_POWER_ON_FAILED);
return false;
}
/* 32 Khz and higher gives an issue where the screen starts dimming again above 80% brightness /* 32 Khz and higher gives an issue where the screen starts dimming again above 80% brightness
* when moving the brightness slider rapidly from a lower setting to 100%. * when moving the brightness slider rapidly from a lower setting to 100%.

View File

@ -9,12 +9,12 @@
#define TDECK_SPI_TRANSFER_SIZE_LIMIT (TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8)) #define TDECK_SPI_TRANSFER_SIZE_LIMIT (TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
bool tpagerInit(); bool tdeckInit();
using namespace tt::hal; using namespace tt::hal;
extern const Configuration lilygo_tlora_pager = { extern const Configuration lilygo_tlora_pager = {
.initBoot = tpagerInit, .initBoot = tdeckInit,
.createDisplay = createDisplay, .createDisplay = createDisplay,
.createKeyboard = createKeyboard, .createKeyboard = createKeyboard,
.sdcard = createTpagerSdCard(), .sdcard = createTpagerSdCard(),

View File

@ -19,9 +19,7 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
true, //swapXY true, //swapXY
true, //mirrorX true, //mirrorX
true, //mirrorY true, //mirrorY
true, //invertColor true //invertColor
0, //gapX
49 //gapY
); );
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty; configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;

View File

@ -219,10 +219,6 @@ void TpagerKeyboard::initEncoder(void) {
const int low_limit = -127; const int low_limit = -127;
const int high_limit = 126; const int high_limit = 126;
// Original implementation based on
// https://github.com/UsefulElectronics/esp32s3-gc9a01-lvgl/blob/main/main/hardware/rotary_encoder.c
// Copyright (c) 2023 Ward Almasarani
// Accum. count makes it that over- and underflows are automatically compensated. // Accum. count makes it that over- and underflows are automatically compensated.
// Prerequisite: watchpoints at low and high limit // Prerequisite: watchpoints at low and high limit
pcnt_unit_config_t unit_config = { pcnt_unit_config_t unit_config = {

View File

@ -1,6 +1,5 @@
# BQ27220 # BQ24295
Power management: Single-Cell CEDV Fuel Gauge Power management: I2C-controlled 3A single cell USB charger with narrow VDC 4.5-5.5V adjustable voltage at 1.5A synchronous boost operation.
[Datasheet](https://www.ti.com/lit/gpn/bq27220) [Datasheet](https://www.ti.com/lit/ds/symlink/bq24295.pdf)
[User Guide](https://www.ti.com/lit/pdf/sluubd4)

View File

@ -7,9 +7,9 @@
#define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a))) #define ARRAYSIZE(a) (sizeof(a) / sizeof(*(a)))
static uint8_t highByte(const uint16_t word) { return (word >> 8) & 0xFF; } uint8_t highByte(const uint16_t word) { return (word >> 8) & 0xFF; }
static uint8_t lowByte(const uint16_t word) { return word & 0xFF; } uint8_t lowByte(const uint16_t word) { return word & 0xFF; }
static constexpr void swapEndianess(uint16_t &word) { word = (lowByte(word) << 8) | highByte(word); } void swapEndianess(uint16_t &word) { word = (lowByte(word) << 8) | highByte(word); }
namespace registers { namespace registers {
static const uint16_t SUBCMD_CTRL_STATUS = 0x0000U; static const uint16_t SUBCMD_CTRL_STATUS = 0x0000U;
@ -314,6 +314,8 @@ bool Bq27220::configPreamble(bool &isSealed) {
if (!unsealFullAccess()) { if (!unsealFullAccess()) {
TT_LOG_E(TAG, "Unsealing full access failure!"); TT_LOG_E(TAG, "Unsealing full access failure!");
return false; return false;
} else {
TT_LOG_I(TAG, "Full access theoretically.");
} }
} }

View File

@ -20,11 +20,6 @@ private:
template<typename T> template<typename T>
bool performConfigUpdate(T configUpdateFunc) bool performConfigUpdate(T configUpdateFunc)
{ {
// Configuration routine lifted from
// https://github.com/Xinyuan-LilyGO/T-Echo/blob/main/lib/SensorLib/src/GaugeBQ27220.hpp
// Copyright (c) 2025 lewis he
// SPDX-License-Identifier: MIT
bool isSealed = false; bool isSealed = false;
if (!configPreamble(isSealed)) { if (!configPreamble(isSealed)) {
@ -37,10 +32,6 @@ private:
} }
public: public:
// Register structures lifted from
// https://github.com/Xinyuan-LilyGO/T-Deck-Pro/blob/master/lib/BQ27220/bq27220.h
// Copyright (c) 2025 Liygo / Shenzhen Xinyuan Electronic Technology Co., Ltd
union BatteryStatus { union BatteryStatus {
struct struct
{ {

View File

@ -1,3 +1,3 @@
# ST7796 # ST7789
A basic ESP32 LVGL driver for ST7796 displays. A basic ESP32 LVGL driver for ST7789 displays.

View File

@ -123,7 +123,7 @@ bool St7796Display::start() {
return false; return false;
} }
if (esp_lcd_panel_set_gap(panelHandle, configuration->gapX, configuration->gapY) != ESP_OK) { if (esp_lcd_panel_set_gap(panelHandle, 0, 49) != ESP_OK) {
TT_LOG_E(TAG, "Failed to set panel gap"); TT_LOG_E(TAG, "Failed to set panel gap");
return false; return false;
} }

View File

@ -28,8 +28,6 @@ public:
bool mirrorX = false, bool mirrorX = false,
bool mirrorY = false, bool mirrorY = false,
bool invertColor = false, bool invertColor = false,
unsigned int gapX = 0,
unsigned int gapY = 0,
uint32_t bufferSize = 0 // Size in pixel count. 0 means default, which is 1/10 of the screen size uint32_t bufferSize = 0 // Size in pixel count. 0 means default, which is 1/10 of the screen size
) : spiBusHandle(spi_bus_handle), ) : spiBusHandle(spi_bus_handle),
csPin(csPin), csPin(csPin),
@ -40,8 +38,6 @@ public:
mirrorX(mirrorX), mirrorX(mirrorX),
mirrorY(mirrorY), mirrorY(mirrorY),
invertColor(invertColor), invertColor(invertColor),
gapX(gapX),
gapY(gapY),
bufferSize(bufferSize), bufferSize(bufferSize),
touch(std::move(touch)) {} touch(std::move(touch)) {}
@ -57,8 +53,6 @@ public:
bool mirrorX = false; bool mirrorX = false;
bool mirrorY = false; bool mirrorY = false;
bool invertColor = false; bool invertColor = false;
unsigned int gapX = 0;
unsigned int gapY = 0;
uint32_t bufferSize = 0; // Size in pixel count. 0 means default, which is 1/10 of the screen size uint32_t bufferSize = 0; // Size in pixel count. 0 means default, which is 1/10 of the screen size
std::shared_ptr<tt::hal::touch::TouchDevice> touch; std::shared_ptr<tt::hal::touch::TouchDevice> touch;
std::function<void(uint8_t)> _Nullable backlightDutyFunction = nullptr; std::function<void(uint8_t)> _Nullable backlightDutyFunction = nullptr;

View File

@ -1,18 +0,0 @@
Copyright 2023 Anthony DiGirolamo
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,4 +1,5 @@
# TCA8418 I2C Controlled Keypad Scan IC With Integrated ESD Protection # BQ24295
[Datasheet](https://www.ti.com/lit/ds/symlink/tca8418.pdf?ts=1751500237439) Power management: I2C-controlled 3A single cell USB charger with narrow VDC 4.5-5.5V adjustable voltage at 1.5A synchronous boost operation.
[Original implementation](https://github.com/AnthonyDiGirolamo/i2c-thumb-keyboard/tree/master) by Anthony DiGirolamo
[Datasheet](https://www.ti.com/lit/ds/symlink/bq24295.pdf)