mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-23 08:55:04 +00:00
Compare commits
No commits in common. "accca5d1d787e83d55fc5b3333918b83180d0049" and "f45f809c9ba2fdf0f198d1a98ddc9caf0ec8d761" have entirely different histories.
accca5d1d7
...
f45f809c9b
27
.github/workflows/build-firmware.yml
vendored
27
.github/workflows/build-firmware.yml
vendored
@ -144,15 +144,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
board_id: lilygo-tdeck
|
board_id: lilygo-tdeck
|
||||||
arch: esp32s3
|
arch: esp32s3
|
||||||
lilygo-tdongle-s3:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: lilygo-tdongle-s3
|
|
||||||
arch: esp32s3
|
|
||||||
lilygo-tlora-pager:
|
lilygo-tlora-pager:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -189,24 +180,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
board_id: m5stack-cores3
|
board_id: m5stack-cores3
|
||||||
arch: esp32s3
|
arch: esp32s3
|
||||||
m5stack-stickc-plus:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: m5stack-stickc-plus
|
|
||||||
arch: esp32
|
|
||||||
m5stack-stickc-plus2:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Build"
|
|
||||||
uses: ./.github/actions/build-firmware
|
|
||||||
with:
|
|
||||||
board_id: m5stack-stickc-plus2
|
|
||||||
arch: esp32
|
|
||||||
unphone:
|
unphone:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
INCLUDE_DIRS "Source"
|
INCLUDE_DIRS "Source"
|
||||||
REQUIRES Tactility ST7735 PwmBacklight driver
|
REQUIRES Tactility EspLcdCompat ST7735 GT911 PwmBacklight driver
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
INCLUDE_DIRS "Source"
|
INCLUDE_DIRS "Source"
|
||||||
REQUIRES Tactility esp_lvgl_port esp_lcd AXP192 ST7789 ButtonControl
|
REQUIRES Tactility esp_lvgl_port esp_lcd ILI934x FT6x36 driver vfs fatfs
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
# M5Stack StickC Plus
|
# M5Stack Core2
|
||||||
|
|
||||||
|
This board implementation concerns the original Core2 hardware and **not** the v1.1 variant.
|
||||||
|
|
||||||
|
Reference implementations:
|
||||||
|
- [ESP-BSP](https://github.com/espressif/esp-bsp/tree/master/bsp/m5stack_core_2)
|
||||||
|
|
||||||
Docs:
|
Docs:
|
||||||
|
- [M5Stack.com](https://docs.m5stack.com/en/core/Core2)
|
||||||
- [M5Stack.com](https://docs.m5stack.com/en/core/m5stickc_plus)
|
|
||||||
|
|||||||
51
Boards/M5stackStickCPlus/Source/InitBoot.cpp
Normal file
51
Boards/M5stackStickCPlus/Source/InitBoot.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include "axp192/axp192.h"
|
||||||
|
|
||||||
|
#include <Tactility/Log.h>
|
||||||
|
#include <Tactility/hal/i2c/I2c.h>
|
||||||
|
#include <Tactility/CoreDefines.h>
|
||||||
|
|
||||||
|
#include <driver/i2c.h>
|
||||||
|
#include <driver/spi_master.h>
|
||||||
|
|
||||||
|
constexpr auto* TAG = "Core2";
|
||||||
|
|
||||||
|
axp192_t axpDevice;
|
||||||
|
|
||||||
|
static int32_t axpI2cRead(TT_UNUSED void* handle, uint8_t address, uint8_t reg, uint8_t* buffer, uint16_t size) {
|
||||||
|
if (tt::hal::i2c::masterReadRegister(I2C_NUM_0, address, reg, buffer, size, 50 / portTICK_PERIOD_MS)) {
|
||||||
|
return AXP192_OK;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t axpI2cWrite(TT_UNUSED void* handle, uint8_t address, uint8_t reg, const uint8_t* buffer, uint16_t size) {
|
||||||
|
if (tt::hal::i2c::masterWriteRegister(I2C_NUM_0, address, reg, buffer, size, 50 / portTICK_PERIOD_MS)) {
|
||||||
|
return AXP192_OK;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void initAxp() {
|
||||||
|
axpDevice.read = axpI2cRead;
|
||||||
|
axpDevice.write = axpI2cWrite;
|
||||||
|
|
||||||
|
axp192_ioctl(&axpDevice, AXP192_LDO2_SET_VOLTAGE, 3300); // LCD + SD
|
||||||
|
axp192_ioctl(&axpDevice, AXP192_LDO3_SET_VOLTAGE, 0); // VIB_MOTOR STOP
|
||||||
|
axp192_ioctl(&axpDevice, AXP192_DCDC3_SET_VOLTAGE, 3300);
|
||||||
|
|
||||||
|
axp192_ioctl(&axpDevice, AXP192_LDO2_ENABLE);
|
||||||
|
axp192_ioctl(&axpDevice, AXP192_LDO3_DISABLE);
|
||||||
|
axp192_ioctl(&axpDevice, AXP192_DCDC3_ENABLE);
|
||||||
|
|
||||||
|
axp192_write(&axpDevice, AXP192_PWM1_DUTY_CYCLE_2, 255); // PWM 255 (LED OFF)
|
||||||
|
axp192_write(&axpDevice, AXP192_GPIO1_CONTROL, 0x02); // GPIO1 PWM
|
||||||
|
// TODO: We could charge at 390mA according to the M5Unified code, but the AXP driver in M5Unified limits to 132mA, so it's unclear what the AXP supports.
|
||||||
|
}
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
TT_LOG_I(TAG, "initBoot");
|
||||||
|
initAxp();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
3
Boards/M5stackStickCPlus/Source/InitBoot.h
Normal file
3
Boards/M5stackStickCPlus/Source/InitBoot.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
bool initBoot();
|
||||||
@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_stickc_plus;
|
|
||||||
@ -1,38 +1,26 @@
|
|||||||
#include "M5StackStickCPlus.h"
|
#include "M5stackCore2.h"
|
||||||
|
#include "InitBoot.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Core2Power.h"
|
||||||
#include <ButtonControl.h>
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <lvgl.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
#define SPI_TRANSFER_SIZE_LIMIT (LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
#define CORE2_SPI_TRANSFER_SIZE_LIMIT (CORE2_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
constexpr auto* TAG = "StickCPlus";
|
|
||||||
|
|
||||||
bool initBoot() {
|
|
||||||
TT_LOG_I(TAG, "initBoot");
|
|
||||||
|
|
||||||
// CH552 applies 4 V to GPIO 0, which reduces Wi-Fi sensitivity
|
|
||||||
// Setting output to high adds a bias of 3.3 V and suppresses over-voltage:
|
|
||||||
gpio::configure(0, gpio::Mode::Output, false, false);
|
|
||||||
gpio::setLevel(0, true);
|
|
||||||
|
|
||||||
return initAxp();
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
getAxp192(),
|
createPower(),
|
||||||
ButtonControl::createTwoButtonControl(37, 39),
|
createSdCard(),
|
||||||
createDisplay()
|
createDisplay()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const Configuration m5stack_stickc_plus = {
|
extern const Configuration m5stack_core2 = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.uiScale = UiScale::Smallest,
|
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices,
|
||||||
.i2c = {
|
.i2c = {
|
||||||
i2c::Configuration {
|
i2c::Configuration {
|
||||||
@ -53,7 +41,7 @@ extern const Configuration m5stack_stickc_plus = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
i2c::Configuration {
|
i2c::Configuration {
|
||||||
.name = "Grove",
|
.name = "External", // (Grove)
|
||||||
.port = I2C_NUM_1,
|
.port = I2C_NUM_1,
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
.isMutable = true,
|
.isMutable = true,
|
||||||
@ -75,17 +63,17 @@ extern const Configuration m5stack_stickc_plus = {
|
|||||||
.device = SPI2_HOST,
|
.device = SPI2_HOST,
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
.config = {
|
.config = {
|
||||||
.mosi_io_num = GPIO_NUM_15,
|
.mosi_io_num = GPIO_NUM_23,
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
.miso_io_num = GPIO_NUM_38,
|
||||||
.sclk_io_num = GPIO_NUM_13,
|
.sclk_io_num = GPIO_NUM_18,
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
.quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
.quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
.data4_io_num = GPIO_NUM_NC,
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
.data5_io_num = GPIO_NUM_NC,
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
.data_io_default_level = false,
|
.data_io_default_level = false,
|
||||||
.max_transfer_sz = SPI_TRANSFER_SIZE_LIMIT,
|
.max_transfer_sz = CORE2_SPI_TRANSFER_SIZE_LIMIT,
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
5
Boards/M5stackStickCPlus/Source/M5stackCore2.h
Normal file
5
Boards/M5stackStickCPlus/Source/M5stackCore2.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
extern const tt::hal::Configuration m5stack_core2;
|
||||||
108
Boards/M5stackStickCPlus/Source/devices/Core2Power.cpp
Normal file
108
Boards/M5stackStickCPlus/Source/devices/Core2Power.cpp
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#include "Core2Power.h"
|
||||||
|
#include <Tactility/TactilityCore.h>
|
||||||
|
#include "axp192/axp192.h"
|
||||||
|
|
||||||
|
constexpr auto TAG = "Core2Power";
|
||||||
|
|
||||||
|
extern axp192_t axpDevice;
|
||||||
|
|
||||||
|
bool Core2Power::supportsMetric(MetricType type) const {
|
||||||
|
switch (type) {
|
||||||
|
using enum MetricType;
|
||||||
|
case BatteryVoltage:
|
||||||
|
case ChargeLevel:
|
||||||
|
case IsCharging:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Core2Power::getMetric(MetricType type, MetricData& data) {
|
||||||
|
switch (type) {
|
||||||
|
using enum MetricType;
|
||||||
|
case BatteryVoltage: {
|
||||||
|
float voltage;
|
||||||
|
if (axp192_read(&axpDevice, AXP192_BATTERY_VOLTAGE, &voltage) == ESP_OK) {
|
||||||
|
data.valueAsUint32 = (uint32_t)std::max((voltage * 1000.f), 0.0f);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case ChargeLevel: {
|
||||||
|
float vbat, charge_current;
|
||||||
|
if (
|
||||||
|
axp192_read(&axpDevice, AXP192_BATTERY_VOLTAGE, &vbat) == ESP_OK &&
|
||||||
|
axp192_read(&axpDevice, AXP192_CHARGE_CURRENT, &charge_current) == ESP_OK
|
||||||
|
) {
|
||||||
|
float max_voltage = 4.20f;
|
||||||
|
float min_voltage = 2.69f; // From M5Unified
|
||||||
|
float voltage_correction = (charge_current > 0.01f) ? -0.1f : 0.f; // Roughly 0.1V drop when ccharging
|
||||||
|
float corrected_voltage = vbat + voltage_correction;
|
||||||
|
if (corrected_voltage > 2.69f) {
|
||||||
|
float charge_factor = (corrected_voltage - min_voltage) / (max_voltage - min_voltage);
|
||||||
|
data.valueAsUint8 = (uint8_t)(charge_factor * 100.f);
|
||||||
|
} else {
|
||||||
|
data.valueAsUint8 = 0;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case IsCharging: {
|
||||||
|
float charge_current;
|
||||||
|
if (axp192_read(&axpDevice, AXP192_CHARGE_CURRENT, &charge_current) == ESP_OK) {
|
||||||
|
data.valueAsBool = charge_current > 0.001f;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case Current: {
|
||||||
|
float charge_current, discharge_current;
|
||||||
|
if (
|
||||||
|
axp192_read(&axpDevice, AXP192_CHARGE_CURRENT, &charge_current) == ESP_OK &&
|
||||||
|
axp192_read(&axpDevice, AXP192_DISCHARGE_CURRENT, &discharge_current) == ESP_OK
|
||||||
|
) {
|
||||||
|
if (charge_current > 0.0f) {
|
||||||
|
data.valueAsInt32 = (int32_t) (charge_current * 1000.0f);
|
||||||
|
} else {
|
||||||
|
data.valueAsInt32 = -(int32_t) (discharge_current * 1000.0f);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Core2Power::isAllowedToCharge() const {
|
||||||
|
uint8_t buffer;
|
||||||
|
if (axp192_read(&axpDevice, AXP192_CHARGE_CONTROL_1, &buffer) == ESP_OK) {
|
||||||
|
return buffer & 0x80;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core2Power::setAllowedToCharge(bool canCharge) {
|
||||||
|
uint8_t buffer;
|
||||||
|
if (axp192_read(&axpDevice, AXP192_CHARGE_CONTROL_1, &buffer) == ESP_OK) {
|
||||||
|
buffer = (buffer & 0x7F) + (canCharge ? 0x80 : 0x00);
|
||||||
|
axp192_write(&axpDevice, AXP192_CHARGE_CONTROL_1, buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::shared_ptr<PowerDevice> power;
|
||||||
|
|
||||||
|
std::shared_ptr<PowerDevice> createPower() {
|
||||||
|
if (power == nullptr) {
|
||||||
|
power = std::make_shared<Core2Power>();
|
||||||
|
}
|
||||||
|
return power;
|
||||||
|
}
|
||||||
26
Boards/M5stackStickCPlus/Source/devices/Core2Power.h
Normal file
26
Boards/M5stackStickCPlus/Source/devices/Core2Power.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/power/PowerDevice.h"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
using tt::hal::power::PowerDevice;
|
||||||
|
|
||||||
|
class Core2Power : public PowerDevice {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Core2Power() = default;
|
||||||
|
~Core2Power() override = default;
|
||||||
|
|
||||||
|
std::string getName() const final { return "AXP192 Power"; }
|
||||||
|
std::string getDescription() const final { return "Power management via I2C"; }
|
||||||
|
|
||||||
|
bool supportsMetric(MetricType type) const override;
|
||||||
|
bool getMetric(MetricType type, MetricData& data) override;
|
||||||
|
|
||||||
|
bool supportsChargeControl() const override { return true; }
|
||||||
|
bool isAllowedToCharge() const override;
|
||||||
|
void setAllowedToCharge(bool canCharge) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<PowerDevice> createPower();
|
||||||
@ -1,63 +1,36 @@
|
|||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
#include "Power.h"
|
#include <Ft6x36Touch.h>
|
||||||
|
#include <Ili934xDisplay.h>
|
||||||
|
|
||||||
#include <St7789Display.h>
|
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
#include <bitset>
|
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
||||||
|
I2C_NUM_0,
|
||||||
|
GPIO_NUM_39,
|
||||||
|
CORE2_LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
CORE2_LCD_VERTICAL_RESOLUTION
|
||||||
|
);
|
||||||
|
|
||||||
constexpr auto* TAG = "StickCPlus";
|
auto touch = std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||||
|
return std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||||
static void setBacklightOn(bool on) {
|
|
||||||
const auto axp = getAxp192();
|
|
||||||
const auto* driver = axp->getAxp192();
|
|
||||||
uint8_t state;
|
|
||||||
if (axp192_read(driver, AXP192_DCDC13_LDO23_CONTROL, &state) != AXP192_OK) {
|
|
||||||
TT_LOG_I(TAG, "Failed to read LCD brightness state");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::bitset<8> new_state = state;
|
|
||||||
if (new_state[2] != on) {
|
|
||||||
new_state[2] = on;
|
|
||||||
const auto new_state_long = new_state.to_ulong();
|
|
||||||
axp192_write(driver, AXP192_DCDC13_LDO23_CONTROL, static_cast<uint8_t>(new_state_long)); // Display on/off
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setBrightness(uint8_t brightness) {
|
|
||||||
const auto axp = getAxp192();
|
|
||||||
if (brightness)
|
|
||||||
{
|
|
||||||
brightness = (((brightness >> 1) + 8) / 13) + 5;
|
|
||||||
setBacklightOn(true);
|
|
||||||
axp192_write(axp->getAxp192(), AXP192_LDO23_VOLTAGE, brightness << 4); // Display brightness
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setBacklightOn(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
auto configuration = std::make_unique<St7789Display::Configuration>(
|
auto touch = createTouch();
|
||||||
LCD_SPI_HOST,
|
|
||||||
LCD_PIN_CS,
|
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
||||||
LCD_PIN_DC,
|
CORE2_LCD_SPI_HOST,
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
CORE2_LCD_PIN_CS,
|
||||||
LCD_VERTICAL_RESOLUTION,
|
CORE2_LCD_PIN_DC,
|
||||||
nullptr,
|
CORE2_LCD_HORIZONTAL_RESOLUTION,
|
||||||
|
CORE2_LCD_VERTICAL_RESOLUTION,
|
||||||
|
touch,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
true
|
||||||
LCD_DRAW_BUFFER_SIZE,
|
|
||||||
52,
|
|
||||||
40
|
|
||||||
);
|
);
|
||||||
|
|
||||||
configuration->pixelClockFrequency = 40'000'000;
|
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
|
||||||
configuration->resetPin = LCD_PIN_RESET;
|
|
||||||
|
|
||||||
configuration->backlightDutyFunction = setBrightness;
|
|
||||||
const auto display = std::make_shared<St7789Display>(std::move(configuration));
|
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,12 @@
|
|||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
#include "Tactility/hal/display/DisplayDevice.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#define LCD_SPI_HOST SPI2_HOST
|
#define CORE2_LCD_SPI_HOST SPI2_HOST
|
||||||
#define LCD_PIN_CS GPIO_NUM_5
|
#define CORE2_LCD_PIN_CS GPIO_NUM_5
|
||||||
#define LCD_PIN_DC GPIO_NUM_23
|
#define CORE2_LCD_PIN_DC GPIO_NUM_15
|
||||||
#define LCD_PIN_RESET GPIO_NUM_18
|
#define CORE2_LCD_HORIZONTAL_RESOLUTION 320
|
||||||
#define LCD_HORIZONTAL_RESOLUTION 135
|
#define CORE2_LCD_VERTICAL_RESOLUTION 240
|
||||||
#define LCD_VERTICAL_RESOLUTION 240
|
#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10)
|
||||||
#define LCD_DRAW_BUFFER_HEIGHT (LCD_VERTICAL_RESOLUTION / 3)
|
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT)
|
||||||
#define LCD_DRAW_BUFFER_SIZE (LCD_HORIZONTAL_RESOLUTION * LCD_DRAW_BUFFER_HEIGHT)
|
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
#include <Axp192.h>
|
|
||||||
|
|
||||||
static std::shared_ptr<Axp192> axp192 = nullptr;
|
|
||||||
|
|
||||||
std::shared_ptr<Axp192> createAxp192() {
|
|
||||||
assert(axp192 == nullptr);
|
|
||||||
auto configuration = std::make_unique<Axp192::Configuration>(I2C_NUM_0);
|
|
||||||
axp192 = std::make_shared<Axp192>(std::move(configuration));
|
|
||||||
return axp192;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<Axp192> getAxp192() {
|
|
||||||
assert(axp192 != nullptr);
|
|
||||||
return axp192;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool initAxp() {
|
|
||||||
const auto axp = createAxp192();
|
|
||||||
return axp->init([](auto* driver) {
|
|
||||||
// Reference: https://github.com/pr3y/Bruce/blob/main/lib/utility/AXP192.cpp
|
|
||||||
axp192_ioctl(driver, AXP192_LDO23_VOLTAGE, 3300); // LCD backlight
|
|
||||||
axp192_ioctl(driver, AXP192_ADC_ENABLE_1, 0xff); // Set all ADC enabled
|
|
||||||
axp192_ioctl(driver, AXP192_CHARGE_CONTROL_1, 0xc0); // Battery charging at 4.2 V and 100 mA
|
|
||||||
axp192_ioctl(driver, AXP192_ADC_ENABLE_1, 0xff); // Enable battery, AC in, Vbus, APS ADC
|
|
||||||
uint8_t buffer;
|
|
||||||
axp192_read(driver, AXP192_DCDC13_LDO23_CONTROL, &buffer);
|
|
||||||
axp192_ioctl(driver, AXP192_DCDC13_LDO23_CONTROL, buffer | 0x4D); // Enable Ext, LDO2, LDO3, DCDC1
|
|
||||||
axp192_ioctl(driver, AXP192_PEK, 0x0C); // 128 ms power on, 4 s power off
|
|
||||||
axp192_ioctl(driver, AXP192_GPIO0_LDOIO0_VOLTAGE, 0xF0); // 3.3 V RTC voltage
|
|
||||||
axp192_ioctl(driver, AXP192_GPIO0_CONTROL, 0x02); // Set GPIO0 to LDO
|
|
||||||
axp192_ioctl(driver, AXP192_VBUS_IPSOUT_CHANNEL, 0x80); // Disable Vbus hold limit
|
|
||||||
axp192_ioctl(driver, AXP192_BATTERY_CHARGE_HIGH_TEMP, 0xFC); // Set temperature protection
|
|
||||||
axp192_ioctl(driver, AXP192_BATTERY_CHARGE_CONTROL, 0xA2); // Enable RTC BAT charge
|
|
||||||
axp192_ioctl(driver, AXP192_SHUTDOWN_BATTERY_CHGLED_CONTROL, 0x46); // Enable bat detection
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Axp192.h>
|
|
||||||
|
|
||||||
bool initAxp();
|
|
||||||
|
|
||||||
// Must call initAxp() first before this returns a non-nullptr response
|
|
||||||
std::shared_ptr<Axp192> getAxp192();
|
|
||||||
|
|
||||||
27
Boards/M5stackStickCPlus/Source/devices/SdCard.cpp
Normal file
27
Boards/M5stackStickCPlus/Source/devices/SdCard.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
|
constexpr auto CORE2_SDCARD_PIN_CS = GPIO_NUM_4;
|
||||||
|
constexpr auto CORE2_LCD_PIN_CS = GPIO_NUM_5;
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||||
|
CORE2_SDCARD_PIN_CS,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
tt::lvgl::getSyncLock(),
|
||||||
|
std::vector {
|
||||||
|
CORE2_LCD_PIN_CS
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(configuration)
|
||||||
|
);
|
||||||
|
}
|
||||||
7
Boards/M5stackStickCPlus/Source/devices/SdCard.h
Normal file
7
Boards/M5stackStickCPlus/Source/devices/SdCard.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
|||||||
idf_component_register(
|
idf_component_register(
|
||||||
SRCS ${SOURCE_FILES}
|
SRCS ${SOURCE_FILES}
|
||||||
INCLUDE_DIRS "Source"
|
INCLUDE_DIRS "Source"
|
||||||
REQUIRES Tactility esp_lvgl_port esp_lcd ST7789 PwmBacklight ButtonControl
|
REQUIRES Tactility esp_lvgl_port ILI934x FT5x06 AXP2101 AW9523 driver vfs fatfs
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
# M5Stack StickC Plus2
|
# M5Stack CoreS3
|
||||||
|
|
||||||
|
Reference implementations:
|
||||||
|
- [ESP-BSP](https://github.com/espressif/esp-bsp/tree/master/bsp/m5stack_core_s3)
|
||||||
|
|
||||||
Docs:
|
Docs:
|
||||||
|
- [M5Stack.com](https://docs.m5stack.com/en/core/CoreS3)
|
||||||
- [M5Stack.com](https://docs.m5stack.com/en/core/M5StickC%20PLUS2)
|
|
||||||
|
|||||||
153
Boards/M5stackStickCPlus2/Source/InitBoot.cpp
Normal file
153
Boards/M5stackStickCPlus2/Source/InitBoot.cpp
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
#include "InitBoot.h"
|
||||||
|
|
||||||
|
#include <Tactility/Log.h>
|
||||||
|
#include <Tactility/kernel/Kernel.h>
|
||||||
|
|
||||||
|
constexpr auto* TAG = "CoreS3";
|
||||||
|
|
||||||
|
std::shared_ptr<Axp2101> axp2101;
|
||||||
|
std::shared_ptr<Aw9523> aw9523;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For details see https://github.com/espressif/esp-bsp/blob/master/bsp/m5stack_core_s3/m5stack_core_s3.c
|
||||||
|
* and schematic: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/K128%20CoreS3/Sch_M5_CoreS3_v1.0.pdf
|
||||||
|
*/
|
||||||
|
bool initGpioExpander() {
|
||||||
|
TT_LOG_I(TAG, "AW9523 init");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* P0 pins:
|
||||||
|
* 0: Touch reset
|
||||||
|
* 1: Bus out enable
|
||||||
|
* 2: AW88298 reset (I2S)
|
||||||
|
* 3: ES7210 interrupt (Audio ADC)
|
||||||
|
* 4: SD Card SW(itch on?)
|
||||||
|
* 5: USB OTG enable
|
||||||
|
* 6: /
|
||||||
|
* 7: /
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* P1 pins:
|
||||||
|
* 0: Cam reset
|
||||||
|
* 1: LCD reset
|
||||||
|
* 2: Touch interrupt
|
||||||
|
* 3: AW88298 interrupt (I2S)
|
||||||
|
* 4: /
|
||||||
|
* 5: /
|
||||||
|
* 6: /
|
||||||
|
* 7: Boost enable
|
||||||
|
*/
|
||||||
|
|
||||||
|
uint8_t p0_state = 0U;
|
||||||
|
uint8_t p1_state = 0U;
|
||||||
|
|
||||||
|
// Enable touch
|
||||||
|
p0_state |= (1U);
|
||||||
|
// Bus out enable
|
||||||
|
p0_state |= (1U << 1U);
|
||||||
|
// I2S
|
||||||
|
p0_state |= (1U << 2U);
|
||||||
|
// SD card
|
||||||
|
p0_state |= (1U << 4U);
|
||||||
|
|
||||||
|
// Enable LCD
|
||||||
|
p1_state |= (1U << 1U);
|
||||||
|
// Boost enable
|
||||||
|
p1_state |= (1U << 7U);
|
||||||
|
|
||||||
|
/* AW9523 P0 is in push-pull mode */
|
||||||
|
if (!aw9523->writeCTL(0x10)) {
|
||||||
|
TT_LOG_E(TAG, "AW9523: Failed to set CTL");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aw9523->writeP0(p0_state)) {
|
||||||
|
TT_LOG_E(TAG, "AW9523: Failed to set P0");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aw9523->writeP1(p1_state)) {
|
||||||
|
TT_LOG_E(TAG, "AW9523: Failed to set P1");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (axp2101->isVBus()) {
|
||||||
|
float voltage = 0.0f;
|
||||||
|
axp2101->getVBusVoltage(voltage);
|
||||||
|
TT_LOG_I(TAG, "AXP2101: VBus at %.2f", voltage);
|
||||||
|
} else {
|
||||||
|
TT_LOG_W(TAG, "AXP2101: VBus disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool initPowerControl() {
|
||||||
|
TT_LOG_I(TAG, "Init power control (AXP2101)");
|
||||||
|
|
||||||
|
// Source: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/Power_Class.cpp#L61
|
||||||
|
aw9523->bitOnP1(0b10000000); // SY7088 boost enable
|
||||||
|
|
||||||
|
/** AXP2101 usage
|
||||||
|
Source: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/README.md?plain=1#L223
|
||||||
|
| |M5Stack<BR>CoreS3<BR>CoreS3SE| |
|
||||||
|
|:---------:|:-----------------:|:---------:|
|
||||||
|
| ALDO1 |VDD 1v8 | ALDO1 |
|
||||||
|
| ALDO2 |VDDA 3v3 | ALDO2 |
|
||||||
|
| ALDO3 |CAM 3v3 | ALDO3 |
|
||||||
|
| ALDO4 |TF 3v3 | ALDO4 |
|
||||||
|
| BLDO1 |AVDD | BLDO1 |
|
||||||
|
| BLDO2 |DVDD | BLDO2 |
|
||||||
|
| DLDO1/DC1 |LCD BL | DLDO1/DC1 |
|
||||||
|
| DLDO2/DC2 | --- | DLDO2/DC2 |
|
||||||
|
| BACKUP |RTC BAT | BACKUP |
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0x92 = ALD01
|
||||||
|
* 0x93 = ALD02
|
||||||
|
* 0x94 = ALD03
|
||||||
|
* 0x95 = ALD04
|
||||||
|
* 0x96 = BLD01
|
||||||
|
* 0x97 = BLD02
|
||||||
|
*
|
||||||
|
* DCDC1 : 0.7-3.5V, 25mV/step 1200mA
|
||||||
|
* DCDC2 : 0.7-2.275V,25mV/step 1600mA
|
||||||
|
* DCDC3 : 0.7-3.5V, 25mV/step 700mA
|
||||||
|
|
||||||
|
* LDOio0: 1.8-3.3V, 100mV/step 50mA
|
||||||
|
* LDO1 : 30mA always on
|
||||||
|
* LDO2 : 1.8-3.3V, 100mV/step 200mA
|
||||||
|
* LDO3 : 1.8-3.3V, 100mV/step 200mA
|
||||||
|
*/
|
||||||
|
// Source: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/Power_Class.cpp#L64
|
||||||
|
static constexpr uint8_t reg_data_array[] = {
|
||||||
|
0x90U, 0xBFU, // LDOS ON/OFF control 0 (backlight)
|
||||||
|
0x92U, 18U -5U, // ALDO1 set to 1.8v // for AW88298
|
||||||
|
0x93U, 33U -5U, // ALDO2 set to 3.3v // for ES7210
|
||||||
|
0x94U, 33U -5U, // ALDO3 set to 3.3v // for camera
|
||||||
|
0x95U, 33U -5U, // ALDO3 set to 3.3v // for TF card slot
|
||||||
|
0x27, 0x00, // PowerKey Hold=1sec / PowerOff=4sec
|
||||||
|
0x69, 0x11, // CHGLED setting
|
||||||
|
0x10, 0x30, // PMU common config
|
||||||
|
0x30, 0x0F // ADC enabled (for voltage measurement)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (axp2101->setRegisters((uint8_t*)reg_data_array, sizeof(reg_data_array))) {
|
||||||
|
TT_LOG_I(TAG, "AXP2101 initialized with %d registers", sizeof(reg_data_array) / 2);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
TT_LOG_E(TAG, "AXP2101: Failed to set registers");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool initBoot() {
|
||||||
|
TT_LOG_I(TAG, "initBoot()");
|
||||||
|
|
||||||
|
axp2101 = std::make_shared<Axp2101>(I2C_NUM_0);
|
||||||
|
aw9523 = std::make_shared<Aw9523>(I2C_NUM_0);
|
||||||
|
|
||||||
|
return initPowerControl() && initGpioExpander();
|
||||||
|
}
|
||||||
9
Boards/M5stackStickCPlus2/Source/InitBoot.h
Normal file
9
Boards/M5stackStickCPlus2/Source/InitBoot.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Axp2101.h>
|
||||||
|
#include <Aw9523.h>
|
||||||
|
|
||||||
|
extern std::shared_ptr<Axp2101> axp2101;
|
||||||
|
extern std::shared_ptr<Aw9523> aw9523;
|
||||||
|
|
||||||
|
bool initBoot();
|
||||||
@ -1,125 +0,0 @@
|
|||||||
#include "M5StackStickCPlus2.h"
|
|
||||||
#include "devices/Display.h"
|
|
||||||
|
|
||||||
#include <ButtonControl.h>
|
|
||||||
#include <PwmBacklight.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#define SPI_TRANSFER_SIZE_LIMIT (LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
|
||||||
|
|
||||||
constexpr auto* TAG = "StickCPlus2";
|
|
||||||
|
|
||||||
bool initBoot() {
|
|
||||||
TT_LOG_I(TAG, "initBoot");
|
|
||||||
|
|
||||||
// CH552 applies 4 V to GPIO 0, which reduces Wi-Fi sensitivity
|
|
||||||
// Setting output to high adds a bias of 3.3 V and suppresses over-voltage:
|
|
||||||
gpio::configure(0, gpio::Mode::Output, false, false);
|
|
||||||
gpio::setLevel(0, true);
|
|
||||||
|
|
||||||
// "Hold power" pin: must be set to high to keep the device powered on:
|
|
||||||
gpio::configure(4, gpio::Mode::Output, false, false);
|
|
||||||
gpio::setLevel(4, true);
|
|
||||||
return driver::pwmbacklight::init(GPIO_NUM_27, 512);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
|
||||||
return {
|
|
||||||
ButtonControl::createTwoButtonControl(37, 39),
|
|
||||||
createDisplay()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
extern const Configuration m5stack_stickc_plus2 = {
|
|
||||||
.initBoot = initBoot,
|
|
||||||
.uiScale = UiScale::Smallest,
|
|
||||||
.createDevices = createDevices,
|
|
||||||
.i2c = {
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Internal",
|
|
||||||
.port = I2C_NUM_0,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_21,
|
|
||||||
.scl_io_num = GPIO_NUM_22,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
i2c::Configuration {
|
|
||||||
.name = "Grove",
|
|
||||||
.port = I2C_NUM_1,
|
|
||||||
.initMode = i2c::InitMode::ByTactility,
|
|
||||||
.isMutable = true,
|
|
||||||
.config = (i2c_config_t) {
|
|
||||||
.mode = I2C_MODE_MASTER,
|
|
||||||
.sda_io_num = GPIO_NUM_32,
|
|
||||||
.scl_io_num = GPIO_NUM_33,
|
|
||||||
.sda_pullup_en = true,
|
|
||||||
.scl_pullup_en = true,
|
|
||||||
.master = {
|
|
||||||
.clk_speed = 400000
|
|
||||||
},
|
|
||||||
.clk_flags = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_15,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_13,
|
|
||||||
.quadwp_io_num = GPIO_NUM_NC,
|
|
||||||
.quadhd_io_num = GPIO_NUM_NC,
|
|
||||||
.data4_io_num = GPIO_NUM_NC,
|
|
||||||
.data5_io_num = GPIO_NUM_NC,
|
|
||||||
.data6_io_num = GPIO_NUM_NC,
|
|
||||||
.data7_io_num = GPIO_NUM_NC,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = SPI_TRANSFER_SIZE_LIMIT,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.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_32,
|
|
||||||
.txPin = GPIO_NUM_33,
|
|
||||||
.rtsPin = GPIO_NUM_NC,
|
|
||||||
.ctsPin = GPIO_NUM_NC,
|
|
||||||
.rxBufferSize = 1024,
|
|
||||||
.txBufferSize = 1024,
|
|
||||||
.config = {
|
|
||||||
.baud_rate = 115200,
|
|
||||||
.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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_stickc_plus2;
|
|
||||||
193
Boards/M5stackStickCPlus2/Source/M5stackCoreS3.cpp
Normal file
193
Boards/M5stackStickCPlus2/Source/M5stackCoreS3.cpp
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
#include "M5stackCoreS3.h"
|
||||||
|
#include "InitBoot.h"
|
||||||
|
#include "devices/Display.h"
|
||||||
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
|
#include <Axp2101Power.h>
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <Tactility/hal/uart/Uart.h>
|
||||||
|
|
||||||
|
#define CORES3_TRANSACTION_SIZE (CORES3_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
||||||
|
|
||||||
|
using namespace tt::hal;
|
||||||
|
|
||||||
|
static DeviceVector createDevices() {
|
||||||
|
return {
|
||||||
|
axp2101,
|
||||||
|
aw9523,
|
||||||
|
std::make_shared<Axp2101Power>(axp2101),
|
||||||
|
createSdCard(),
|
||||||
|
createDisplay()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const Configuration m5stack_cores3 = {
|
||||||
|
.initBoot = initBoot,
|
||||||
|
.createDevices = createDevices,
|
||||||
|
.i2c = {
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Internal",
|
||||||
|
.port = I2C_NUM_0,
|
||||||
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_12,
|
||||||
|
.scl_io_num = GPIO_NUM_11,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Port A", // Grove
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_2,
|
||||||
|
.scl_io_num = GPIO_NUM_1,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Port B", // Grove
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_9,
|
||||||
|
.scl_io_num = GPIO_NUM_8,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
i2c::Configuration {
|
||||||
|
.name = "Port C", // Grove
|
||||||
|
.port = I2C_NUM_1,
|
||||||
|
.initMode = i2c::InitMode::Disabled,
|
||||||
|
.isMutable = true,
|
||||||
|
.config = (i2c_config_t) {
|
||||||
|
.mode = I2C_MODE_MASTER,
|
||||||
|
.sda_io_num = GPIO_NUM_18,
|
||||||
|
.scl_io_num = GPIO_NUM_17,
|
||||||
|
.sda_pullup_en = true,
|
||||||
|
.scl_pullup_en = true,
|
||||||
|
.master = {
|
||||||
|
.clk_speed = 400000
|
||||||
|
},
|
||||||
|
.clk_flags = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.spi {
|
||||||
|
spi::Configuration {
|
||||||
|
.device = SPI3_HOST,
|
||||||
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
|
.config = {
|
||||||
|
.mosi_io_num = GPIO_NUM_37,
|
||||||
|
.miso_io_num = GPIO_NUM_35,
|
||||||
|
.sclk_io_num = GPIO_NUM_36,
|
||||||
|
.data2_io_num = GPIO_NUM_NC,
|
||||||
|
.data3_io_num = GPIO_NUM_NC,
|
||||||
|
.data4_io_num = GPIO_NUM_NC,
|
||||||
|
.data5_io_num = GPIO_NUM_NC,
|
||||||
|
.data6_io_num = GPIO_NUM_NC,
|
||||||
|
.data7_io_num = GPIO_NUM_NC,
|
||||||
|
.data_io_default_level = false,
|
||||||
|
.max_transfer_sz = CORES3_TRANSACTION_SIZE,
|
||||||
|
.flags = 0,
|
||||||
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
|
.intr_flags = 0
|
||||||
|
},
|
||||||
|
.initMode = spi::InitMode::ByTactility,
|
||||||
|
.isMutable = false,
|
||||||
|
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
||||||
|
}
|
||||||
|
},
|
||||||
|
.uart {
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "Port A",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_2,
|
||||||
|
.txPin = GPIO_NUM_1,
|
||||||
|
.rtsPin = GPIO_NUM_NC,
|
||||||
|
.ctsPin = GPIO_NUM_NC,
|
||||||
|
.rxBufferSize = 1024,
|
||||||
|
.txBufferSize = 1024,
|
||||||
|
.config = {
|
||||||
|
.baud_rate = 115200,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "Port B",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_9,
|
||||||
|
.txPin = GPIO_NUM_8,
|
||||||
|
.rtsPin = GPIO_NUM_NC,
|
||||||
|
.ctsPin = GPIO_NUM_NC,
|
||||||
|
.rxBufferSize = 1024,
|
||||||
|
.txBufferSize = 1024,
|
||||||
|
.config = {
|
||||||
|
.baud_rate = 115200,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uart::Configuration {
|
||||||
|
.name = "Port C",
|
||||||
|
.port = UART_NUM_1,
|
||||||
|
.rxPin = GPIO_NUM_18,
|
||||||
|
.txPin = GPIO_NUM_17,
|
||||||
|
.rtsPin = GPIO_NUM_NC,
|
||||||
|
.ctsPin = GPIO_NUM_NC,
|
||||||
|
.rxBufferSize = 1024,
|
||||||
|
.txBufferSize = 1024,
|
||||||
|
.config = {
|
||||||
|
.baud_rate = 115200,
|
||||||
|
.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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
5
Boards/M5stackStickCPlus2/Source/M5stackCoreS3.h
Normal file
5
Boards/M5stackStickCPlus2/Source/M5stackCoreS3.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
|
extern const tt::hal::Configuration m5stack_cores3;
|
||||||
@ -1,29 +1,51 @@
|
|||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <Axp2101.h>
|
||||||
#include <St7789Display.h>
|
#include <Ft5x06Touch.h>
|
||||||
|
#include <Ili934xDisplay.h>
|
||||||
|
#include <Tactility/Log.h>
|
||||||
|
#include <Tactility/hal/i2c/I2c.h>
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
constexpr auto* TAG = "CoreS3Display";
|
||||||
auto configuration = std::make_unique<St7789Display::Configuration>(
|
|
||||||
LCD_SPI_HOST,
|
static void setBacklightDuty(uint8_t backlightDuty) {
|
||||||
LCD_PIN_CS,
|
const uint8_t voltage = 20 + ((8 * backlightDuty) / 255); // [0b00000, 0b11100] - under 20 is too dark
|
||||||
LCD_PIN_DC,
|
// TODO: Refactor to use Axp2102 driver subproject. Reference: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/AXP2101_Class.cpp#L42
|
||||||
LCD_HORIZONTAL_RESOLUTION,
|
if (!tt::hal::i2c::masterWriteRegister(I2C_NUM_0, AXP2101_ADDRESS, 0x99, &voltage, 1, 1000)) { // Sets DLD01
|
||||||
LCD_VERTICAL_RESOLUTION,
|
TT_LOG_E(TAG, "Failed to set display backlight voltage");
|
||||||
nullptr,
|
}
|
||||||
false,
|
}
|
||||||
false,
|
|
||||||
false,
|
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||||
true,
|
// Note for future changes: Reset pin is 48 and interrupt pin is 47
|
||||||
LCD_DRAW_BUFFER_SIZE,
|
auto configuration = std::make_unique<Ft5x06Touch::Configuration>(
|
||||||
52,
|
I2C_NUM_0,
|
||||||
40
|
320,
|
||||||
|
240
|
||||||
);
|
);
|
||||||
|
|
||||||
configuration->pixelClockFrequency = 40'000'000;
|
auto touch = std::make_shared<Ft5x06Touch>(std::move(configuration));
|
||||||
configuration->resetPin = LCD_PIN_RESET;
|
return std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||||
configuration->backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
}
|
||||||
|
|
||||||
const auto display = std::make_shared<St7789Display>(std::move(configuration));
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
|
auto touch = createTouch();
|
||||||
|
|
||||||
|
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
||||||
|
SPI3_HOST,
|
||||||
|
GPIO_NUM_3,
|
||||||
|
GPIO_NUM_35,
|
||||||
|
320,
|
||||||
|
240,
|
||||||
|
touch,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
configuration->backlightDutyFunction = ::setBacklightDuty;
|
||||||
|
|
||||||
|
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
|
||||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Tactility/hal/display/DisplayDevice.h"
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#define LCD_SPI_HOST SPI2_HOST
|
// Display
|
||||||
#define LCD_PIN_CS GPIO_NUM_5
|
#define CORES3_LCD_SPI_HOST SPI3_HOST
|
||||||
#define LCD_PIN_DC GPIO_NUM_14
|
#define CORES3_LCD_PIN_CS GPIO_NUM_3
|
||||||
#define LCD_PIN_RESET GPIO_NUM_12
|
#define CORES3_LCD_PIN_DC GPIO_NUM_35
|
||||||
#define LCD_HORIZONTAL_RESOLUTION 135
|
#define CORES3_LCD_HORIZONTAL_RESOLUTION 320
|
||||||
#define LCD_VERTICAL_RESOLUTION 240
|
#define CORES3_LCD_VERTICAL_RESOLUTION 240
|
||||||
#define LCD_DRAW_BUFFER_HEIGHT (LCD_VERTICAL_RESOLUTION / 3)
|
#define CORES3_LCD_DRAW_BUFFER_HEIGHT (CORES3_LCD_VERTICAL_RESOLUTION / 10)
|
||||||
#define LCD_DRAW_BUFFER_SIZE (LCD_HORIZONTAL_RESOLUTION * LCD_DRAW_BUFFER_HEIGHT)
|
#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT)
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
28
Boards/M5stackStickCPlus2/Source/devices/SdCard.cpp
Normal file
28
Boards/M5stackStickCPlus2/Source/devices/SdCard.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
|
constexpr auto CORES3_SDCARD_PIN_CS = GPIO_NUM_4;
|
||||||
|
constexpr auto CORES3_LCD_PIN_CS = GPIO_NUM_3;
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||||
|
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||||
|
CORES3_SDCARD_PIN_CS,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
GPIO_NUM_NC,
|
||||||
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
|
tt::lvgl::getSyncLock(),
|
||||||
|
std::vector {
|
||||||
|
CORES3_LCD_PIN_CS
|
||||||
|
},
|
||||||
|
SPI3_HOST
|
||||||
|
);
|
||||||
|
|
||||||
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(configuration)
|
||||||
|
);
|
||||||
|
}
|
||||||
7
Boards/M5stackStickCPlus2/Source/devices/SdCard.h
Normal file
7
Boards/M5stackStickCPlus2/Source/devices/SdCard.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||||
|
|
||||||
|
using tt::hal::sdcard::SdCardDevice;
|
||||||
|
|
||||||
|
std::shared_ptr<SdCardDevice> createSdCard();
|
||||||
@ -61,10 +61,6 @@ function(INIT_TACTILITY_GLOBALS SDKCONFIG_FILE)
|
|||||||
set(TACTILITY_BOARD_PROJECT M5stackCore2)
|
set(TACTILITY_BOARD_PROJECT M5stackCore2)
|
||||||
elseif (board_id STREQUAL "m5stack-cores3")
|
elseif (board_id STREQUAL "m5stack-cores3")
|
||||||
set(TACTILITY_BOARD_PROJECT M5stackCoreS3)
|
set(TACTILITY_BOARD_PROJECT M5stackCoreS3)
|
||||||
elseif (board_id STREQUAL "m5stack-stickc-plus")
|
|
||||||
set(TACTILITY_BOARD_PROJECT M5stackStickCPlus)
|
|
||||||
elseif (board_id STREQUAL "m5stack-stickc-plus2")
|
|
||||||
set(TACTILITY_BOARD_PROJECT M5stackStickCPlus2)
|
|
||||||
elseif (board_id STREQUAL "unphone")
|
elseif (board_id STREQUAL "unphone")
|
||||||
set(TACTILITY_BOARD_PROJECT UnPhone)
|
set(TACTILITY_BOARD_PROJECT UnPhone)
|
||||||
elseif (board_id STREQUAL "waveshare-s3-touch-43")
|
elseif (board_id STREQUAL "waveshare-s3-touch-43")
|
||||||
|
|||||||
@ -35,9 +35,6 @@ release elecrow-crowpanel-basic-50
|
|||||||
build lilygo-tdeck
|
build lilygo-tdeck
|
||||||
release lilygo-tdeck
|
release lilygo-tdeck
|
||||||
|
|
||||||
build lilygo-tdongle-s3
|
|
||||||
release lilygo-tdongle-s3
|
|
||||||
|
|
||||||
build lilygo-tlora-pager
|
build lilygo-tlora-pager
|
||||||
release lilygo-tlora-pager
|
release lilygo-tlora-pager
|
||||||
|
|
||||||
@ -78,12 +75,6 @@ release m5stack-cardputer
|
|||||||
build m5stack-cores3
|
build m5stack-cores3
|
||||||
release m5stack-cores3
|
release m5stack-cores3
|
||||||
|
|
||||||
build m5stack-stickc-plus
|
|
||||||
release m5stack-stickc-plus
|
|
||||||
|
|
||||||
build m5stack-stickc-plus2
|
|
||||||
release m5stack-stickc-plus2
|
|
||||||
|
|
||||||
build waveshare-s3-touch-43
|
build waveshare-s3-touch-43
|
||||||
release waveshare-s3-touch-43
|
release waveshare-s3-touch-43
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ void ButtonControl::readCallback(lv_indev_t* indev, lv_indev_data_t* data) {
|
|||||||
|
|
||||||
auto* self = static_cast<ButtonControl*>(lv_indev_get_driver_data(indev));
|
auto* self = static_cast<ButtonControl*>(lv_indev_get_driver_data(indev));
|
||||||
|
|
||||||
if (self->mutex.lock(100)) {
|
if (self->mutex.lock(20)) {
|
||||||
|
|
||||||
for (int i = 0; i < self->pinConfigurations.size(); i++) {
|
for (int i = 0; i < self->pinConfigurations.size(); i++) {
|
||||||
const auto& config = self->pinConfigurations[i];
|
const auto& config = self->pinConfigurations[i];
|
||||||
@ -73,7 +73,7 @@ void ButtonControl::updatePin(std::vector<PinConfiguration>::const_reference con
|
|||||||
if (state.pressState) {
|
if (state.pressState) {
|
||||||
auto time_passed = tt::kernel::getMillis() - state.pressStartTime;
|
auto time_passed = tt::kernel::getMillis() - state.pressStartTime;
|
||||||
if (time_passed < 500) {
|
if (time_passed < 500) {
|
||||||
TT_LOG_D(TAG, "Trigger short press");
|
TT_LOG_W(TAG, "Trigger short press");
|
||||||
state.triggerShortPress = true;
|
state.triggerShortPress = true;
|
||||||
}
|
}
|
||||||
state.pressState = false;
|
state.pressState = false;
|
||||||
|
|||||||
@ -51,10 +51,6 @@ menu "Tactility App"
|
|||||||
bool "M5Stack Core2"
|
bool "M5Stack Core2"
|
||||||
config TT_BOARD_M5STACK_CORES3
|
config TT_BOARD_M5STACK_CORES3
|
||||||
bool "M5Stack CoreS3"
|
bool "M5Stack CoreS3"
|
||||||
config TT_BOARD_M5STACK_STICKC_PLUS
|
|
||||||
bool "M5Stack StickC Plus"
|
|
||||||
config TT_BOARD_M5STACK_STICKC_PLUS2
|
|
||||||
bool "M5Stack StickC Plus2"
|
|
||||||
config TT_BOARD_UNPHONE
|
config TT_BOARD_UNPHONE
|
||||||
bool "unPhone"
|
bool "unPhone"
|
||||||
config TT_BOARD_WAVESHARE_S3_TOUCH_43
|
config TT_BOARD_WAVESHARE_S3_TOUCH_43
|
||||||
|
|||||||
@ -53,12 +53,6 @@
|
|||||||
#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3)
|
#elif defined(CONFIG_TT_BOARD_M5STACK_CORES3)
|
||||||
#include "M5stackCoreS3.h"
|
#include "M5stackCoreS3.h"
|
||||||
#define TT_BOARD_HARDWARE &m5stack_cores3
|
#define TT_BOARD_HARDWARE &m5stack_cores3
|
||||||
#elif defined(CONFIG_TT_BOARD_M5STACK_STICKC_PLUS)
|
|
||||||
#include "M5StackStickCPlus.h"
|
|
||||||
#define TT_BOARD_HARDWARE &m5stack_stickc_plus
|
|
||||||
#elif defined(CONFIG_TT_BOARD_M5STACK_STICKC_PLUS2)
|
|
||||||
#include "M5StackStickCPlus2.h"
|
|
||||||
#define TT_BOARD_HARDWARE &m5stack_stickc_plus2
|
|
||||||
#elif defined(CONFIG_TT_BOARD_UNPHONE)
|
#elif defined(CONFIG_TT_BOARD_UNPHONE)
|
||||||
#include "UnPhone.h"
|
#include "UnPhone.h"
|
||||||
#define TT_BOARD_HARDWARE &unPhone
|
#define TT_BOARD_HARDWARE &unPhone
|
||||||
|
|||||||
@ -115,14 +115,8 @@ public:
|
|||||||
lv_obj_set_flex_flow(buttons_wrapper, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_flex_flow(buttons_wrapper, LV_FLEX_FLOW_COLUMN);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t margin;
|
const int32_t available_width = std::max<int32_t>(0, lv_display_get_horizontal_resolution(display) - (3 * button_size));
|
||||||
if (is_landscape_display) {
|
const int32_t margin = is_landscape_display ? std::min<int32_t>(available_width / 16, button_size) : 0;
|
||||||
const int32_t available_width = std::max<int32_t>(0, lv_display_get_horizontal_resolution(display) - (3 * button_size));
|
|
||||||
margin = std::min<int32_t>(available_width / 16, button_size);
|
|
||||||
} else {
|
|
||||||
const int32_t available_height = std::max<int32_t>(0, lv_display_get_vertical_resolution(display) - (3 * button_size));
|
|
||||||
margin = std::min<int32_t>(available_height / 16, button_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto paths = app.getPaths();
|
const auto paths = app.getPaths();
|
||||||
const auto apps_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_apps.png");
|
const auto apps_icon_path = lvgl::PATH_PREFIX + paths->getAssetsPath("icon_apps.png");
|
||||||
|
|||||||
@ -33,28 +33,24 @@ CONFIG_WL_SECTOR_MODE=1
|
|||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8mb.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8mb.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions-8mb.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions-8mb.csv"
|
||||||
CONFIG_TT_BOARD_M5STACK_STICKC_PLUS2=y
|
CONFIG_TT_BOARD_LILYGO_TDECK=y
|
||||||
CONFIG_TT_BOARD_NAME="M5Stack StickC Plus2"
|
CONFIG_TT_BOARD_NAME="M5Stack StickC Plus2"
|
||||||
CONFIG_TT_BOARD_ID="m5stack-stickc-plus2"
|
CONFIG_TT_BOARD_ID="m5stack-stickc-plus2"
|
||||||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
||||||
CONFIG_IDF_TARGET="esp32"
|
CONFIG_IDF_TARGET="esp32s3"
|
||||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
|
||||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
|
||||||
CONFIG_FLASHMODE_QIO=y
|
CONFIG_FLASHMODE_QIO=y
|
||||||
# Hardware: SPI RAM
|
# Hardware: SPI RAM
|
||||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||||
CONFIG_SPIRAM=y
|
CONFIG_SPIRAM_MODE_OCT=y
|
||||||
CONFIG_SPIRAM_MODE_QUAD=y
|
CONFIG_SPIRAM_SPEED_120M=y
|
||||||
CONFIG_SPIRAM_SPEED_80M=y
|
CONFIG_SPIRAM_USE_MALLOC=y
|
||||||
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
|
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
|
||||||
|
# SPI Flash (can set back to 80MHz after ESP-IDF bug is resolved)
|
||||||
|
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y
|
||||||
# LVGL
|
# LVGL
|
||||||
CONFIG_LV_DISP_DEF_REFR_PERIOD=10
|
|
||||||
CONFIG_LV_DPI_DEF=241
|
CONFIG_LV_DPI_DEF=241
|
||||||
|
CONFIG_LV_DISP_DEF_REFR_PERIOD=10
|
||||||
CONFIG_LV_THEME_DEFAULT_DARK=y
|
CONFIG_LV_THEME_DEFAULT_DARK=y
|
||||||
# Fix for IRAM
|
|
||||||
CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y
|
|
||||||
CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y
|
|
||||||
CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH=y
|
|
||||||
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user