mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-19 01:45:06 +00:00
Create separate project for AXP192 driver
This commit is contained in:
parent
e23b956cf4
commit
20c4e6d3ab
@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd ILI934x FT6x36 driver vfs fatfs
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd AXP192 ILI934x FT6x36 driver vfs fatfs
|
||||
)
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
#include "M5stackCore2.h"
|
||||
#include "InitBoot.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/Core2Power.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/Power.h"
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
@ -11,9 +10,16 @@
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
constexpr auto* TAG = "Core2";
|
||||
|
||||
bool initBoot() {
|
||||
TT_LOG_I(TAG, "initBoot");
|
||||
return initAxp();
|
||||
}
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createPower(),
|
||||
getAxp192(),
|
||||
createSdCard(),
|
||||
createDisplay()
|
||||
};
|
||||
|
||||
35
Boards/M5stackCore2/Source/devices/Power.cpp
Normal file
35
Boards/M5stackCore2/Source/devices/Power.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#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) {
|
||||
axp192_ioctl(driver, AXP192_LDO2_SET_VOLTAGE, 3300); // LCD + SD
|
||||
axp192_ioctl(driver, AXP192_LDO3_SET_VOLTAGE, 0); // VIB_MOTOR STOP
|
||||
axp192_ioctl(driver, AXP192_DCDC3_SET_VOLTAGE, 3300);
|
||||
|
||||
axp192_ioctl(driver, AXP192_LDO2_ENABLE);
|
||||
axp192_ioctl(driver, AXP192_LDO3_DISABLE);
|
||||
axp192_ioctl(driver, AXP192_DCDC3_ENABLE);
|
||||
|
||||
axp192_write(driver, AXP192_PWM1_DUTY_CYCLE_2, 255); // PWM 255 (LED OFF)
|
||||
axp192_write(driver, 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.
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
9
Boards/M5stackCore2/Source/devices/Power.h
Normal file
9
Boards/M5stackCore2/Source/devices/Power.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <Axp192.h>
|
||||
|
||||
bool initAxp();
|
||||
|
||||
// Must call initAxp() first before this returns a non-nullptr response
|
||||
std::shared_ptr<Axp192> getAxp192();
|
||||
|
||||
7
Boards/M5stackStickCPlus/CMakeLists.txt
Normal file
7
Boards/M5stackStickCPlus/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd ILI934x FT6x36 driver vfs fatfs
|
||||
)
|
||||
9
Boards/M5stackStickCPlus/README.md
Normal file
9
Boards/M5stackStickCPlus/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# 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:
|
||||
- [M5Stack.com](https://docs.m5stack.com/en/core/Core2)
|
||||
111
Boards/M5stackStickCPlus/Source/M5stackCore2.cpp
Normal file
111
Boards/M5stackStickCPlus/Source/M5stackCore2.cpp
Normal file
@ -0,0 +1,111 @@
|
||||
#include "M5stackCore2.h"
|
||||
#include "InitBoot.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/Core2Power.h"
|
||||
#include "devices/SdCard.h"
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
#define CORE2_SPI_TRANSFER_SIZE_LIMIT (CORE2_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8)
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createPower(),
|
||||
createSdCard(),
|
||||
createDisplay()
|
||||
};
|
||||
}
|
||||
|
||||
extern const Configuration m5stack_core2 = {
|
||||
.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_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 = "External", // (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_23,
|
||||
.miso_io_num = GPIO_NUM_38,
|
||||
.sclk_io_num = GPIO_NUM_18,
|
||||
.quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||
.quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
|
||||
.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 = CORE2_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,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
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;
|
||||
36
Boards/M5stackStickCPlus/Source/devices/Display.cpp
Normal file
36
Boards/M5stackStickCPlus/Source/devices/Display.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include "Display.h"
|
||||
|
||||
#include <Ft6x36Touch.h>
|
||||
#include <Ili934xDisplay.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
GPIO_NUM_39,
|
||||
CORE2_LCD_HORIZONTAL_RESOLUTION,
|
||||
CORE2_LCD_VERTICAL_RESOLUTION
|
||||
);
|
||||
|
||||
auto touch = std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||
return std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
auto touch = createTouch();
|
||||
|
||||
auto configuration = std::make_unique<Ili934xDisplay::Configuration>(
|
||||
CORE2_LCD_SPI_HOST,
|
||||
CORE2_LCD_PIN_CS,
|
||||
CORE2_LCD_PIN_DC,
|
||||
CORE2_LCD_HORIZONTAL_RESOLUTION,
|
||||
CORE2_LCD_VERTICAL_RESOLUTION,
|
||||
touch,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
auto display = std::make_shared<Ili934xDisplay>(std::move(configuration));
|
||||
return std::reinterpret_pointer_cast<tt::hal::display::DisplayDevice>(display);
|
||||
}
|
||||
14
Boards/M5stackStickCPlus/Source/devices/Display.h
Normal file
14
Boards/M5stackStickCPlus/Source/devices/Display.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/display/DisplayDevice.h"
|
||||
#include <memory>
|
||||
|
||||
#define CORE2_LCD_SPI_HOST SPI2_HOST
|
||||
#define CORE2_LCD_PIN_CS GPIO_NUM_5
|
||||
#define CORE2_LCD_PIN_DC GPIO_NUM_15
|
||||
#define CORE2_LCD_HORIZONTAL_RESOLUTION 320
|
||||
#define CORE2_LCD_VERTICAL_RESOLUTION 240
|
||||
#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10)
|
||||
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT)
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||
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();
|
||||
7
Boards/M5stackStickCPlus2/CMakeLists.txt
Normal file
7
Boards/M5stackStickCPlus2/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port ILI934x FT5x06 AXP2101 AW9523 driver vfs fatfs
|
||||
)
|
||||
7
Boards/M5stackStickCPlus2/README.md
Normal file
7
Boards/M5stackStickCPlus2/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# M5Stack CoreS3
|
||||
|
||||
Reference implementations:
|
||||
- [ESP-BSP](https://github.com/espressif/esp-bsp/tree/master/bsp/m5stack_core_s3)
|
||||
|
||||
Docs:
|
||||
- [M5Stack.com](https://docs.m5stack.com/en/core/CoreS3)
|
||||
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();
|
||||
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;
|
||||
51
Boards/M5stackStickCPlus2/Source/devices/Display.cpp
Normal file
51
Boards/M5stackStickCPlus2/Source/devices/Display.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include "Display.h"
|
||||
|
||||
#include <Axp2101.h>
|
||||
#include <Ft5x06Touch.h>
|
||||
#include <Ili934xDisplay.h>
|
||||
#include <Tactility/Log.h>
|
||||
#include <Tactility/hal/i2c/I2c.h>
|
||||
|
||||
constexpr auto* TAG = "CoreS3Display";
|
||||
|
||||
static void setBacklightDuty(uint8_t backlightDuty) {
|
||||
const uint8_t voltage = 20 + ((8 * backlightDuty) / 255); // [0b00000, 0b11100] - under 20 is too dark
|
||||
// TODO: Refactor to use Axp2102 driver subproject. Reference: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/AXP2101_Class.cpp#L42
|
||||
if (!tt::hal::i2c::masterWriteRegister(I2C_NUM_0, AXP2101_ADDRESS, 0x99, &voltage, 1, 1000)) { // Sets DLD01
|
||||
TT_LOG_E(TAG, "Failed to set display backlight voltage");
|
||||
}
|
||||
}
|
||||
|
||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
// Note for future changes: Reset pin is 48 and interrupt pin is 47
|
||||
auto configuration = std::make_unique<Ft5x06Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
320,
|
||||
240
|
||||
);
|
||||
|
||||
auto touch = std::make_shared<Ft5x06Touch>(std::move(configuration));
|
||||
return std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
14
Boards/M5stackStickCPlus2/Source/devices/Display.h
Normal file
14
Boards/M5stackStickCPlus2/Source/devices/Display.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/display/DisplayDevice.h>
|
||||
|
||||
// Display
|
||||
#define CORES3_LCD_SPI_HOST SPI3_HOST
|
||||
#define CORES3_LCD_PIN_CS GPIO_NUM_3
|
||||
#define CORES3_LCD_PIN_DC GPIO_NUM_35
|
||||
#define CORES3_LCD_HORIZONTAL_RESOLUTION 320
|
||||
#define CORES3_LCD_VERTICAL_RESOLUTION 240
|
||||
#define CORES3_LCD_DRAW_BUFFER_HEIGHT (CORES3_LCD_VERTICAL_RESOLUTION / 10)
|
||||
#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT)
|
||||
|
||||
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();
|
||||
8
Drivers/AXP192/CMakeLists.txt
Normal file
8
Drivers/AXP192/CMakeLists.txt
Normal file
@ -0,0 +1,8 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Include"
|
||||
PRIV_INCLUDE_DIRS "Private"
|
||||
REQUIRES Tactility
|
||||
)
|
||||
57
Drivers/AXP192/Include/Axp192.h
Normal file
57
Drivers/AXP192/Include/Axp192.h
Normal file
@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <axp192/axp192.h>
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
#include <Tactility/hal/i2c/I2c.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class Axp192 final : public tt::hal::power::PowerDevice {
|
||||
|
||||
static int32_t i2cRead(void* handle, uint8_t address, uint8_t reg, uint8_t* buffer, uint16_t size);
|
||||
static int32_t i2cWrite(void* handle, uint8_t address, uint8_t reg, const uint8_t* buffer, uint16_t size);
|
||||
|
||||
public:
|
||||
|
||||
struct Configuration {
|
||||
i2c_port_t port;
|
||||
TickType_t readTimeout = 50 / portTICK_PERIOD_MS;
|
||||
TickType_t writeTimeout = 50 / portTICK_PERIOD_MS;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<Configuration> configuration;
|
||||
|
||||
axp192_t axpDevice = {
|
||||
.read = i2cRead,
|
||||
.write = i2cWrite,
|
||||
.handle = this
|
||||
};
|
||||
|
||||
bool isInitialized = false;
|
||||
|
||||
public:
|
||||
|
||||
explicit Axp192(std::unique_ptr<Configuration> configuration) : configuration(std::move(configuration)) {}
|
||||
~Axp192() override {}
|
||||
|
||||
/**
|
||||
* @warning Must call this function before device can operate!
|
||||
* @param onInit
|
||||
*/
|
||||
bool init(const std::function<bool(axp192_t*)>& onInit) {
|
||||
isInitialized = onInit(&axpDevice);
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
std::string getName() const override { return "AXP192"; }
|
||||
std::string getDescription() const override { return "AXP192 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;
|
||||
};
|
||||
5
Drivers/AXP192/README.md
Normal file
5
Drivers/AXP192/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# AXP192
|
||||
|
||||
Power management with I2C interface. Used on M5Stack Core2 and StickCPlus.
|
||||
|
||||
It includes driver code from https://github.com/tuupola/axp192, Copyright (c) 2019-2021 Mika Tuupola, MIT License
|
||||
117
Drivers/AXP192/Source/Axp192.cpp
Normal file
117
Drivers/AXP192/Source/Axp192.cpp
Normal file
@ -0,0 +1,117 @@
|
||||
#include "Axp192.h"
|
||||
|
||||
constexpr auto TAG = "Axp192Power";
|
||||
|
||||
int32_t Axp192::i2cRead(void* handle, uint8_t address, uint8_t reg, uint8_t* buffer, uint16_t size) {
|
||||
const auto* device = static_cast<Axp192*>(handle);
|
||||
if (tt::hal::i2c::masterReadRegister(device->configuration->port, address, reg, buffer, size, device->configuration->readTimeout)) {
|
||||
return AXP192_OK;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t Axp192::i2cWrite(void* handle, uint8_t address, uint8_t reg, const uint8_t* buffer, uint16_t size) {
|
||||
const auto* device = static_cast<Axp192*>(handle);
|
||||
if (tt::hal::i2c::masterWriteRegister(device->configuration->port, address, reg, buffer, size, device->configuration->writeTimeout)) {
|
||||
return AXP192_OK;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
bool Axp192::supportsMetric(MetricType type) const {
|
||||
if (!isInitialized) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
using enum MetricType;
|
||||
case BatteryVoltage:
|
||||
case ChargeLevel:
|
||||
case IsCharging:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Axp192::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 Axp192::isAllowedToCharge() const {
|
||||
uint8_t buffer;
|
||||
if (axp192_read(&axpDevice, AXP192_CHARGE_CONTROL_1, &buffer) == ESP_OK) {
|
||||
return buffer & 0x80;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Axp192::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);
|
||||
}
|
||||
}
|
||||
@ -35,8 +35,8 @@ Version: 0.6.0
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "axp192_config.h"
|
||||
#include "axp192.h"
|
||||
#include "axp192/axp192_config.h"
|
||||
#include "axp192/axp192.h"
|
||||
|
||||
static axp192_err_t read_coloumb_counter(const axp192_t *axp, float *buffer);
|
||||
static axp192_err_t read_battery_power(const axp192_t *axp, float *buffer);
|
||||
60
sdkconfig.board.m5stack-stickc-plus
Normal file
60
sdkconfig.board.m5stack-stickc-plus
Normal file
@ -0,0 +1,60 @@
|
||||
# Software defaults
|
||||
# Increase stack size for WiFi (fixes crash after scan)
|
||||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072
|
||||
CONFIG_LV_FONT_MONTSERRAT_14=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_18=y
|
||||
CONFIG_LV_USE_USER_DATA=y
|
||||
CONFIG_LV_USE_FS_STDIO=y
|
||||
CONFIG_LV_FS_STDIO_LETTER=65
|
||||
CONFIG_LV_FS_STDIO_PATH=""
|
||||
CONFIG_LV_FS_STDIO_CACHE_SIZE=4096
|
||||
CONFIG_LV_USE_LODEPNG=y
|
||||
CONFIG_LV_USE_BUILTIN_MALLOC=n
|
||||
CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_LV_USE_MSGBOX=n
|
||||
CONFIG_LV_USE_SPINNER=n
|
||||
CONFIG_LV_USE_WIN=n
|
||||
CONFIG_LV_USE_SNAPSHOT=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=5120
|
||||
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
|
||||
CONFIG_FATFS_LFN_HEAP=y
|
||||
CONFIG_FATFS_VOLUME_COUNT=3
|
||||
CONFIG_FATFS_SECTOR_512=y
|
||||
CONFIG_WL_SECTOR_SIZE_512=y
|
||||
CONFIG_WL_SECTOR_SIZE=512
|
||||
CONFIG_WL_SECTOR_MODE_SAFE=y
|
||||
CONFIG_WL_SECTOR_MODE=1
|
||||
|
||||
# Hardware: Main
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16mb.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions-16mb.csv"
|
||||
CONFIG_TT_BOARD_M5STACK_CORE2=y
|
||||
CONFIG_TT_BOARD_NAME="M5Stack Core2"
|
||||
CONFIG_TT_BOARD_ID="m5stack-core2"
|
||||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
|
||||
CONFIG_FLASHMODE_QIO=y
|
||||
# Hardware: SPI RAM
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_MODE_QUAD=y
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
|
||||
# LVGL
|
||||
CONFIG_LV_DISP_DEF_REFR_PERIOD=10
|
||||
CONFIG_LV_DPI_DEF=139
|
||||
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
|
||||
59
sdkconfig.board.m5stack-stickc-plus2
Normal file
59
sdkconfig.board.m5stack-stickc-plus2
Normal file
@ -0,0 +1,59 @@
|
||||
# Software defaults
|
||||
# Increase stack size for WiFi (fixes crash after scan)
|
||||
CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=3072
|
||||
CONFIG_LV_FONT_MONTSERRAT_14=y
|
||||
CONFIG_LV_FONT_MONTSERRAT_18=y
|
||||
CONFIG_LV_USE_USER_DATA=y
|
||||
CONFIG_LV_USE_FS_STDIO=y
|
||||
CONFIG_LV_FS_STDIO_LETTER=65
|
||||
CONFIG_LV_FS_STDIO_PATH=""
|
||||
CONFIG_LV_FS_STDIO_CACHE_SIZE=4096
|
||||
CONFIG_LV_USE_LODEPNG=y
|
||||
CONFIG_LV_USE_BUILTIN_MALLOC=n
|
||||
CONFIG_LV_USE_CLIB_MALLOC=y
|
||||
CONFIG_LV_USE_MSGBOX=n
|
||||
CONFIG_LV_USE_SPINNER=n
|
||||
CONFIG_LV_USE_WIN=n
|
||||
CONFIG_LV_USE_SNAPSHOT=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=2
|
||||
CONFIG_FREERTOS_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=n
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=5120
|
||||
CONFIG_FREERTOS_USE_TRACE_FACILITY=y
|
||||
CONFIG_FATFS_LFN_HEAP=y
|
||||
CONFIG_FATFS_VOLUME_COUNT=3
|
||||
CONFIG_FATFS_SECTOR_512=y
|
||||
CONFIG_WL_SECTOR_SIZE_512=y
|
||||
CONFIG_WL_SECTOR_SIZE=512
|
||||
CONFIG_WL_SECTOR_MODE_SAFE=y
|
||||
CONFIG_WL_SECTOR_MODE=1
|
||||
|
||||
# Hardware: Main
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16mb.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions-16mb.csv"
|
||||
CONFIG_TT_BOARD_LILYGO_TDECK=y
|
||||
CONFIG_TT_BOARD_NAME="LilyGo T-Deck"
|
||||
CONFIG_TT_BOARD_ID="lilygo-tdeck"
|
||||
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
|
||||
CONFIG_IDF_TARGET="esp32s3"
|
||||
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
|
||||
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_FLASHMODE_QIO=y
|
||||
# Hardware: SPI RAM
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
CONFIG_SPIRAM_MODE_OCT=y
|
||||
CONFIG_SPIRAM_SPEED_120M=y
|
||||
CONFIG_SPIRAM_USE_MALLOC=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
|
||||
CONFIG_LV_DPI_DEF=139
|
||||
CONFIG_LV_DISP_DEF_REFR_PERIOD=10
|
||||
CONFIG_LV_THEME_DEFAULT_DARK=y
|
||||
# USB
|
||||
CONFIG_TINYUSB_MSC_ENABLED=y
|
||||
CONFIG_TINYUSB_MSC_MOUNT_PATH="/sdcard"
|
||||
Loading…
x
Reference in New Issue
Block a user