mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-18 17:35:05 +00:00
Updated M5Stack Core2
This commit is contained in:
parent
3b9004ffbc
commit
b0408e40ec
@ -15,7 +15,7 @@ bool tpagerInit();
|
|||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
auto bq27220 = std::make_shared<Bq27220>(I2C_NUM_0);
|
auto bq27220 = std::make_shared<Bq27220>(I2C_NUM_0);
|
||||||
auto power = std::make_shared<TpagerPower>(bq27220);
|
auto power = std::make_shared<TpagerPower>(bq27220);
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#include <driver/i2c.h>
|
#include <driver/i2c.h>
|
||||||
#include <driver/spi_master.h>
|
#include <driver/spi_master.h>
|
||||||
|
|
||||||
#define TAG "core2"
|
constexpr auto* TAG = "Core2";
|
||||||
|
|
||||||
axp192_t axpDevice;
|
axp192_t axpDevice;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#include "M5stackCore2.h"
|
#include "M5stackCore2.h"
|
||||||
#include "InitBoot.h"
|
#include "InitBoot.h"
|
||||||
#include "hal/Core2Display.h"
|
#include "devices/Display.h"
|
||||||
#include "hal/Core2Power.h"
|
#include "devices/Core2Power.h"
|
||||||
#include "hal/Core2SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
@ -11,16 +11,22 @@
|
|||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
extern const tt::hal::Configuration m5stack_core2 = {
|
static DeviceVector createDevices() {
|
||||||
|
return {
|
||||||
|
createPower(),
|
||||||
|
createSdCard(),
|
||||||
|
createDisplay()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
extern const Configuration m5stack_core2 = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDisplay = createDisplay,
|
.createDevices = createDevices,
|
||||||
.sdcard = createSdCard(),
|
|
||||||
.power = createPower,
|
|
||||||
.i2c = {
|
.i2c = {
|
||||||
tt::hal::i2c::Configuration {
|
i2c::Configuration {
|
||||||
.name = "Internal",
|
.name = "Internal",
|
||||||
.port = I2C_NUM_0,
|
.port = I2C_NUM_0,
|
||||||
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
.isMutable = false,
|
.isMutable = false,
|
||||||
.config = (i2c_config_t) {
|
.config = (i2c_config_t) {
|
||||||
.mode = I2C_MODE_MASTER,
|
.mode = I2C_MODE_MASTER,
|
||||||
@ -34,10 +40,10 @@ extern const tt::hal::Configuration m5stack_core2 = {
|
|||||||
.clk_flags = 0
|
.clk_flags = 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tt::hal::i2c::Configuration {
|
i2c::Configuration {
|
||||||
.name = "External", // (Grove)
|
.name = "External", // (Grove)
|
||||||
.port = I2C_NUM_1,
|
.port = I2C_NUM_1,
|
||||||
.initMode = tt::hal::i2c::InitMode::ByTactility,
|
.initMode = i2c::InitMode::ByTactility,
|
||||||
.isMutable = true,
|
.isMutable = true,
|
||||||
.config = (i2c_config_t) {
|
.config = (i2c_config_t) {
|
||||||
.mode = I2C_MODE_MASTER,
|
.mode = I2C_MODE_MASTER,
|
||||||
@ -53,7 +59,7 @@ extern const tt::hal::Configuration m5stack_core2 = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
.spi {
|
.spi {
|
||||||
tt::hal::spi::Configuration {
|
spi::Configuration {
|
||||||
.device = SPI2_HOST,
|
.device = SPI2_HOST,
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
.dma = SPI_DMA_CH_AUTO,
|
||||||
.config = {
|
.config = {
|
||||||
@ -72,7 +78,7 @@ extern const tt::hal::Configuration m5stack_core2 = {
|
|||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||||
.intr_flags = 0
|
.intr_flags = 0
|
||||||
},
|
},
|
||||||
.initMode = tt::hal::spi::InitMode::ByTactility,
|
.initMode = spi::InitMode::ByTactility,
|
||||||
.isMutable = false,
|
.isMutable = false,
|
||||||
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,6 @@ bool Core2Power::supportsMetric(MetricType type) const {
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // Safety guard for when new enum values are introduced
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core2Power::getMetric(MetricType type, MetricData& data) {
|
bool Core2Power::getMetric(MetricType type, MetricData& data) {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#include "Core2Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
#include <Ft6x36Touch.h>
|
#include <Ft6x36Touch.h>
|
||||||
#include <Ili934xDisplay.h>
|
#include <Ili934xDisplay.h>
|
||||||
@ -1,12 +1,10 @@
|
|||||||
#include "Core2SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
#include <esp_vfs_fat.h>
|
constexpr auto CORE2_SDCARD_PIN_CS = GPIO_NUM_4;
|
||||||
|
constexpr auto CORE2_LCD_PIN_CS = GPIO_NUM_5;
|
||||||
#define CORE2_SDCARD_PIN_CS GPIO_NUM_4
|
|
||||||
#define CORE2_LCD_PIN_CS GPIO_NUM_5
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user