Merge develop into main branch (#137)
* SdCard HAL refactored (#135) - Refactor SdCard HAL - introduce Lockable * Screenshot and FatFS improvements (#136) - Fix screenshots on ESP32 - Improve Screenshot service - Convert Screenshot app to class-based instead of structs - Screenshot app now automatically updates when task is finished - Enable FatFS long filename support * Re-use common log messages (#138) For consistency and binary size reduction * Toolbar spinner should get margin to the right * More TactilityC features (#139) * Rewrote Loader - Simplified Loader by removing custom threa - Created DispatcherThread - Move auto-starting apps to Boot app - Fixed Dispatcher bug where it could get stuck not processing new messages * Hide AP settings if the AP is not saved * Missing from previous commit * Replace LV_EVENT_CLICKED with LV_EVENT_SHORT_CLICKED * Refactored files app and created InputDialog (#140) - Changed Files app so that it has a View and State - Files app now allows for long-pressing on files to perform actions - Files app now has rename and delete actions - Created InputDialog app - Improved AlertDialog app layout
This commit is contained in:
committed by
GitHub
parent
9033daa6dd
commit
50bd6e8bf6
@@ -1,4 +1,4 @@
|
||||
#include "Config.h"
|
||||
#include "YellowConfig.h"
|
||||
#include "TactilityCore.h"
|
||||
#include "hal/YellowTouchConstants.h"
|
||||
#include <driver/spi_common.h>
|
||||
@@ -6,6 +6,8 @@
|
||||
#define TAG "twodotfour_bootstrap"
|
||||
|
||||
static bool init_i2c() {
|
||||
TT_LOG_I(TAG, LOG_MESSAGE_I2C_INIT_START);
|
||||
|
||||
const i2c_config_t i2c_conf = {
|
||||
.mode = I2C_MODE_MASTER,
|
||||
.sda_io_num = GPIO_NUM_33,
|
||||
@@ -18,12 +20,12 @@ static bool init_i2c() {
|
||||
};
|
||||
|
||||
if (i2c_param_config(TWODOTFOUR_TOUCH_I2C_PORT, &i2c_conf) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "i2c config failed");
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_I2C_INIT_CONFIG_FAILED );
|
||||
return false;
|
||||
}
|
||||
|
||||
if (i2c_driver_install(TWODOTFOUR_TOUCH_I2C_PORT, i2c_conf.mode, 0, 0, 0) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "i2c driver install failed");
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_I2C_INIT_DRIVER_INSTALL_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,35 +33,46 @@ static bool init_i2c() {
|
||||
}
|
||||
|
||||
static bool init_spi2() {
|
||||
const spi_bus_config_t bus_config = {
|
||||
.mosi_io_num = TWODOTFOUR_SPI2_PIN_MOSI,
|
||||
.miso_io_num = GPIO_NUM_NC,
|
||||
.sclk_io_num = TWODOTFOUR_SPI2_PIN_SCLK,
|
||||
.quadwp_io_num = GPIO_NUM_NC,
|
||||
.quadhd_io_num = GPIO_NUM_NC,
|
||||
.max_transfer_sz = TWODOTFOUR_SPI2_TRANSACTION_LIMIT
|
||||
};
|
||||
TT_LOG_I(TAG, LOG_MESSAGE_SPI_INIT_START_FMT, SPI2_HOST);
|
||||
|
||||
if (spi_bus_initialize(SPI2_HOST, &bus_config, SPI_DMA_CH_AUTO) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "SPI bus init failed");
|
||||
return false;
|
||||
}
|
||||
const spi_bus_config_t bus_config = {
|
||||
.mosi_io_num = TWODOTFOUR_SPI2_PIN_MOSI,
|
||||
.miso_io_num = GPIO_NUM_NC,
|
||||
.sclk_io_num = TWODOTFOUR_SPI2_PIN_SCLK,
|
||||
.quadwp_io_num = GPIO_NUM_NC,
|
||||
.quadhd_io_num = GPIO_NUM_NC,
|
||||
.max_transfer_sz = TWODOTFOUR_SPI2_TRANSACTION_LIMIT
|
||||
};
|
||||
|
||||
return true;
|
||||
if (spi_bus_initialize(SPI2_HOST, &bus_config, SPI_DMA_CH_AUTO) != ESP_OK) {
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_SPI_INIT_FAILED_FMT, SPI2_HOST);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool init_spi3() {
|
||||
TT_LOG_I(TAG, LOG_MESSAGE_SPI_INIT_START_FMT, SPI3_HOST);
|
||||
|
||||
const spi_bus_config_t bus_config = {
|
||||
.mosi_io_num = TWODOTFOUR_SPI3_PIN_MOSI,
|
||||
.miso_io_num = TWODOTFOUR_SPI3_PIN_MISO,
|
||||
.sclk_io_num = TWODOTFOUR_SPI3_PIN_SCLK,
|
||||
.quadwp_io_num = GPIO_NUM_NC,
|
||||
.quadhd_io_num = GPIO_NUM_NC,
|
||||
.max_transfer_sz = TWODOTFOUR_SPI3_TRANSACTION_LIMIT
|
||||
.data4_io_num = 0,
|
||||
.data5_io_num = 0,
|
||||
.data6_io_num = 0,
|
||||
.data7_io_num = 0,
|
||||
.max_transfer_sz = TWODOTFOUR_SPI3_TRANSACTION_LIMIT,
|
||||
.flags = 0,
|
||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||
.intr_flags = 0
|
||||
};
|
||||
|
||||
if (spi_bus_initialize(SPI3_HOST, &bus_config, SPI_DMA_CH_AUTO) != ESP_OK) {
|
||||
TT_LOG_E(TAG, "SPI bus init failed");
|
||||
TT_LOG_E(TAG, LOG_MESSAGE_SPI_INIT_FAILED_FMT, SPI3_HOST);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -67,23 +80,5 @@ static bool init_spi3() {
|
||||
}
|
||||
|
||||
bool twodotfour_boot() {
|
||||
TT_LOG_I(TAG, "Init I2C");
|
||||
if (!init_i2c()) {
|
||||
TT_LOG_E(TAG, "Init I2C failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
TT_LOG_I(TAG, "Init SPI2");
|
||||
if (!init_spi2()) {
|
||||
TT_LOG_E(TAG, "Init SPI2 failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
TT_LOG_I(TAG, "Init SPI3");
|
||||
if (!init_spi3()) {
|
||||
TT_LOG_E(TAG, "Init SPI3 failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return init_i2c() && init_spi2() && init_spi3();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user