Compare commits
3 Commits
adec22bfe7
...
6aee531685
| Author | SHA1 | Date | |
|---|---|---|---|
| 6aee531685 | |||
| f7cfa9a431 | |||
| da190e7803 |
@ -7,7 +7,7 @@
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
#define TDECK_SPI_TRANSFER_SIZE_LIMIT (TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
||||
#define TPAGER_SPI_TRANSFER_SIZE_LIMIT (TPAGER_LCD_HORIZONTAL_RESOLUTION * TPAGER_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
||||
|
||||
bool tpagerInit();
|
||||
|
||||
@ -21,7 +21,7 @@ extern const Configuration lilygo_tlora_pager = {
|
||||
.power = tpager_get_power,
|
||||
.i2c = {
|
||||
i2c::Configuration {
|
||||
.name = "Internal",
|
||||
.name = "Shared",
|
||||
.port = I2C_NUM_0,
|
||||
.initMode = i2c::InitMode::ByTactility,
|
||||
.isMutable = true,
|
||||
@ -49,7 +49,7 @@ extern const Configuration lilygo_tlora_pager = {
|
||||
.data6_io_num = GPIO_NUM_NC,
|
||||
.data7_io_num = GPIO_NUM_NC,
|
||||
.data_io_default_level = false,
|
||||
.max_transfer_sz = TDECK_SPI_TRANSFER_SIZE_LIMIT,
|
||||
.max_transfer_sz = TPAGER_SPI_TRANSFER_SIZE_LIMIT,
|
||||
.flags = 0,
|
||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||
.intr_flags = 0},
|
||||
@ -57,8 +57,27 @@ extern const Configuration lilygo_tlora_pager = {
|
||||
.isMutable = false,
|
||||
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
||||
}},
|
||||
.uart {uart::Configuration {.name = "Grove", .port = UART_NUM_1, .rxPin = GPIO_NUM_4, .txPin = GPIO_NUM_12, .rtsPin = GPIO_NUM_NC, .ctsPin = GPIO_NUM_NC, .rxBufferSize = 1024, .txBufferSize = 1024, .config = {.baud_rate = 38400, .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, .rx_flow_ctrl_thresh = 0, .source_clk = UART_SCLK_DEFAULT, .flags = {
|
||||
.uart {uart::Configuration {
|
||||
.name = "Grove",
|
||||
.port = UART_NUM_1,
|
||||
.rxPin = GPIO_NUM_4,
|
||||
.txPin = GPIO_NUM_12,
|
||||
.rtsPin = GPIO_NUM_NC,
|
||||
.ctsPin = GPIO_NUM_NC,
|
||||
.rxBufferSize = 1024,
|
||||
.txBufferSize = 1024,
|
||||
.config = {
|
||||
.baud_rate = 38400,
|
||||
.data_bits = UART_DATA_8_BITS,
|
||||
.parity = UART_PARITY_DISABLE,
|
||||
.stop_bits = UART_STOP_BITS_1,
|
||||
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
|
||||
.rx_flow_ctrl_thresh = 0,
|
||||
.source_clk = UART_SCLK_DEFAULT,
|
||||
.flags = {
|
||||
.allow_pd = 0,
|
||||
.backup_before_sleep = 0,
|
||||
}}}}
|
||||
}
|
||||
}
|
||||
}}
|
||||
};
|
||||
|
||||
@ -6,13 +6,13 @@
|
||||
|
||||
#include <driver/spi_master.h>
|
||||
|
||||
#define TAG "tdeck_display"
|
||||
#define TAG "TPAGER_display"
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
auto configuration = std::make_unique<St7796Display::Configuration>(
|
||||
TDECK_LCD_SPI_HOST,
|
||||
TDECK_LCD_PIN_CS,
|
||||
TDECK_LCD_PIN_DC,
|
||||
TPAGER_LCD_SPI_HOST,
|
||||
TPAGER_LCD_PIN_CS,
|
||||
TPAGER_LCD_PIN_DC,
|
||||
480, // w
|
||||
222, // h
|
||||
nullptr,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#define TDECK_LCD_SPI_HOST SPI2_HOST
|
||||
#define TDECK_LCD_PIN_CS GPIO_NUM_38
|
||||
#define TDECK_LCD_PIN_DC GPIO_NUM_37 // RS
|
||||
#define TDECK_LCD_HORIZONTAL_RESOLUTION 222
|
||||
#define TDECK_LCD_VERTICAL_RESOLUTION 480
|
||||
#define TDECK_LCD_SPI_TRANSFER_HEIGHT (TDECK_LCD_VERTICAL_RESOLUTION / 10)
|
||||
#define TPAGER_LCD_SPI_HOST SPI2_HOST
|
||||
#define TPAGER_LCD_PIN_CS GPIO_NUM_38
|
||||
#define TPAGER_LCD_PIN_DC GPIO_NUM_37 // RS
|
||||
#define TPAGER_LCD_HORIZONTAL_RESOLUTION 222
|
||||
#define TPAGER_LCD_VERTICAL_RESOLUTION 480
|
||||
#define TPAGER_LCD_SPI_TRANSFER_HEIGHT (TPAGER_LCD_VERTICAL_RESOLUTION / 10)
|
||||
|
||||
@ -219,10 +219,6 @@ void TpagerKeyboard::initEncoder(void) {
|
||||
const int low_limit = -127;
|
||||
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.
|
||||
// Prerequisite: watchpoints at low and high limit
|
||||
pcnt_unit_config_t unit_config = {
|
||||
@ -231,37 +227,60 @@ void TpagerKeyboard::initEncoder(void) {
|
||||
.flags = {.accum_count = 1},
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(pcnt_new_unit(&unit_config, &encPcntUnit));
|
||||
if (pcnt_new_unit(&unit_config, &encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter intialization failed");
|
||||
}
|
||||
|
||||
pcnt_glitch_filter_config_t filter_config = {
|
||||
.max_glitch_ns = 1000,
|
||||
.max_glitch_ns = 5000,
|
||||
};
|
||||
ESP_ERROR_CHECK(pcnt_unit_set_glitch_filter(encPcntUnit, &filter_config));
|
||||
if (pcnt_unit_set_glitch_filter(encPcntUnit, &filter_config) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter glitch filter config failed");
|
||||
}
|
||||
|
||||
pcnt_chan_config_t chan_a_config = {
|
||||
pcnt_chan_config_t chan_1_config = {
|
||||
.edge_gpio_num = ENCODER_A,
|
||||
.level_gpio_num = ENCODER_B,
|
||||
};
|
||||
pcnt_channel_handle_t pcnt_chan_a = NULL;
|
||||
ESP_ERROR_CHECK(pcnt_new_channel(encPcntUnit, &chan_a_config, &pcnt_chan_a));
|
||||
pcnt_chan_config_t chan_b_config = {
|
||||
pcnt_chan_config_t chan_2_config = {
|
||||
.edge_gpio_num = ENCODER_B,
|
||||
.level_gpio_num = ENCODER_A,
|
||||
};
|
||||
pcnt_channel_handle_t pcnt_chan_b = NULL;
|
||||
ESP_ERROR_CHECK(pcnt_new_channel(encPcntUnit, &chan_b_config, &pcnt_chan_b));
|
||||
|
||||
ESP_ERROR_CHECK(pcnt_channel_set_edge_action(pcnt_chan_a, PCNT_CHANNEL_EDGE_ACTION_DECREASE, PCNT_CHANNEL_EDGE_ACTION_INCREASE));
|
||||
ESP_ERROR_CHECK(pcnt_channel_set_level_action(pcnt_chan_a, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE));
|
||||
ESP_ERROR_CHECK(pcnt_channel_set_edge_action(pcnt_chan_b, PCNT_CHANNEL_EDGE_ACTION_INCREASE, PCNT_CHANNEL_EDGE_ACTION_DECREASE));
|
||||
ESP_ERROR_CHECK(pcnt_channel_set_level_action(pcnt_chan_b, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE));
|
||||
pcnt_channel_handle_t pcnt_chan_1 = NULL;
|
||||
pcnt_channel_handle_t pcnt_chan_2 = NULL;
|
||||
|
||||
ESP_ERROR_CHECK(pcnt_unit_add_watch_point(encPcntUnit, low_limit));
|
||||
ESP_ERROR_CHECK(pcnt_unit_add_watch_point(encPcntUnit, high_limit));
|
||||
if ((pcnt_new_channel(encPcntUnit, &chan_1_config, &pcnt_chan_1) != ESP_OK) ||
|
||||
(pcnt_new_channel(encPcntUnit, &chan_2_config, &pcnt_chan_2) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter channel config failed");
|
||||
}
|
||||
|
||||
ESP_ERROR_CHECK(pcnt_unit_enable(encPcntUnit));
|
||||
ESP_ERROR_CHECK(pcnt_unit_clear_count(encPcntUnit));
|
||||
ESP_ERROR_CHECK(pcnt_unit_start(encPcntUnit));
|
||||
// second argument is rising edge, third argument is falling edge
|
||||
if ((pcnt_channel_set_edge_action(pcnt_chan_1, PCNT_CHANNEL_EDGE_ACTION_DECREASE, PCNT_CHANNEL_EDGE_ACTION_INCREASE) != ESP_OK) ||
|
||||
(pcnt_channel_set_edge_action(pcnt_chan_2, PCNT_CHANNEL_EDGE_ACTION_INCREASE, PCNT_CHANNEL_EDGE_ACTION_DECREASE) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter edge action config failed");
|
||||
}
|
||||
|
||||
// second argument is low level, third argument is high level
|
||||
if ((pcnt_channel_set_level_action(pcnt_chan_1, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE) != ESP_OK) ||
|
||||
(pcnt_channel_set_level_action(pcnt_chan_2, PCNT_CHANNEL_LEVEL_ACTION_KEEP, PCNT_CHANNEL_LEVEL_ACTION_INVERSE) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter level action config failed");
|
||||
}
|
||||
|
||||
if ((pcnt_unit_add_watch_point(encPcntUnit, low_limit) != ESP_OK) ||
|
||||
(pcnt_unit_add_watch_point(encPcntUnit, high_limit) != ESP_OK)) {
|
||||
TT_LOG_E(TAG, "Pulsecounter watch point config failed");
|
||||
}
|
||||
|
||||
if (pcnt_unit_enable(encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter could not be enabled");
|
||||
}
|
||||
if (pcnt_unit_clear_count(encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter could not be cleared");
|
||||
}
|
||||
if (pcnt_unit_start(encPcntUnit) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "Pulsecounter could not be started");
|
||||
}
|
||||
}
|
||||
|
||||
int TpagerKeyboard::getEncoderPulses() {
|
||||
|
||||
@ -7,20 +7,20 @@
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
#define TDECK_SDCARD_PIN_CS GPIO_NUM_21
|
||||
#define TDECK_LCD_PIN_CS GPIO_NUM_38
|
||||
#define TDECK_RADIO_PIN_CS GPIO_NUM_36
|
||||
#define TPAGER_SDCARD_PIN_CS GPIO_NUM_21
|
||||
#define TPAGER_LCD_PIN_CS GPIO_NUM_38
|
||||
#define TPAGER_RADIO_PIN_CS GPIO_NUM_36
|
||||
|
||||
std::shared_ptr<SdCardDevice> createTpagerSdCard() {
|
||||
auto* configuration = new SpiSdCardDevice::Config(
|
||||
TDECK_SDCARD_PIN_CS,
|
||||
TPAGER_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
{TDECK_RADIO_PIN_CS,
|
||||
TDECK_LCD_PIN_CS}
|
||||
{TPAGER_RADIO_PIN_CS,
|
||||
TPAGER_LCD_PIN_CS}
|
||||
);
|
||||
|
||||
auto* sdcard = (SdCardDevice*)new SpiSdCardDevice(
|
||||
|
||||
@ -53,6 +53,12 @@ Website: https://github.com/meshtastic/firmware
|
||||
|
||||
License: [GPL v3.0](https://github.com/meshtastic/firmware/blob/master/LICENSE)
|
||||
|
||||
### BQ27220 Driver
|
||||
|
||||
Website: https://github.com/Xinyuan-LilyGO/T-Echo/blob/main/LICENSE
|
||||
|
||||
License: [MIT](https://github.com/Xinyuan-LilyGO/T-Echo/blob/main/LICENSE)
|
||||
|
||||
### Other Components
|
||||
|
||||
See `/components` for the respective projects and their licenses.
|
||||
|
||||
@ -20,11 +20,6 @@ private:
|
||||
template<typename T>
|
||||
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;
|
||||
|
||||
if (!configPreamble(isSealed)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user