mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-19 01:45:06 +00:00
- Add kernel support for SPI driver - Add kernel support for UART driver - Implemented ESP32 UART kernel driver - Update existing UART-related code in Tactility to use new kernel driver - Remove UART from tt::hal::Configuration - Remove tt_hal_uart functionality but keep functions for now - Update devicetrees for UART changes - Kernel mutex and recursive mutex: improved locking API design - Other kernel improvements - Added device_exists_of_type() and device_find_by_name()
60 lines
1.9 KiB
C++
60 lines
1.9 KiB
C++
#include "devices/Display.h"
|
|
#include <driver/gpio.h>
|
|
|
|
#include <Tactility/hal/Configuration.h>
|
|
#include <Tactility/lvgl/LvglSync.h>
|
|
#include <ButtonControl.h>
|
|
#include <PwmBacklight.h>
|
|
|
|
using namespace tt::hal;
|
|
|
|
bool 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 hardwareConfiguration = {
|
|
.initBoot = initBoot,
|
|
.uiScale = UiScale::Smallest,
|
|
.createDevices = createDevices,
|
|
.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 = LCD_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
|
|
}
|
|
}
|
|
};
|