Rename Boards/ to Devices/ (#414)
This commit is contained in:
committed by
GitHub
parent
c7c9618f48
commit
c1ff024657
@@ -0,0 +1,30 @@
|
||||
#include "Display.h"
|
||||
|
||||
#include "St7789i8080Display.h"
|
||||
#include "PwmBacklight.h"
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
// Create configuration
|
||||
auto config = St7789i8080Display::Configuration(
|
||||
DISPLAY_CS, // CS
|
||||
DISPLAY_DC, // DC
|
||||
DISPLAY_WR, // WR
|
||||
DISPLAY_RD, // RD
|
||||
{ DISPLAY_I80_D0, DISPLAY_I80_D1, DISPLAY_I80_D2, DISPLAY_I80_D3,
|
||||
DISPLAY_I80_D4, DISPLAY_I80_D5, DISPLAY_I80_D6, DISPLAY_I80_D7 }, // D0..D7
|
||||
DISPLAY_RST, // RST
|
||||
DISPLAY_BL // BL
|
||||
);
|
||||
|
||||
// Set resolution explicitly
|
||||
config.horizontalResolution = DISPLAY_HORIZONTAL_RESOLUTION;
|
||||
config.verticalResolution = DISPLAY_VERTICAL_RESOLUTION;
|
||||
config.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty;
|
||||
|
||||
// Adjust other settings as needed
|
||||
config.gapX = 35; // ST7789 has a 35 pixel gap on X axis
|
||||
config.pixelClockFrequency = 10 * 1000 * 1000; // 10MHz for better stability
|
||||
|
||||
auto display = std::make_shared<St7789i8080Display>(config);
|
||||
return display;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/display/DisplayDevice.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
class St7789i8080Display;
|
||||
|
||||
constexpr auto DISPLAY_CS = GPIO_NUM_6;
|
||||
constexpr auto DISPLAY_DC = GPIO_NUM_7;
|
||||
constexpr auto DISPLAY_WR = GPIO_NUM_8;
|
||||
constexpr auto DISPLAY_RD = GPIO_NUM_9;
|
||||
constexpr auto DISPLAY_RST = GPIO_NUM_5;
|
||||
constexpr auto DISPLAY_BL = GPIO_NUM_38;
|
||||
constexpr auto DISPLAY_I80_D0 = GPIO_NUM_39;
|
||||
constexpr auto DISPLAY_I80_D1 = GPIO_NUM_40;
|
||||
constexpr auto DISPLAY_I80_D2 = GPIO_NUM_41;
|
||||
constexpr auto DISPLAY_I80_D3 = GPIO_NUM_42;
|
||||
constexpr auto DISPLAY_I80_D4 = GPIO_NUM_45;
|
||||
constexpr auto DISPLAY_I80_D5 = GPIO_NUM_46;
|
||||
constexpr auto DISPLAY_I80_D6 = GPIO_NUM_47;
|
||||
constexpr auto DISPLAY_I80_D7 = GPIO_NUM_48;
|
||||
constexpr auto DISPLAY_HORIZONTAL_RESOLUTION = 170;
|
||||
constexpr auto DISPLAY_VERTICAL_RESOLUTION = 320;
|
||||
|
||||
// Factory function for registration
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "Power.h"
|
||||
|
||||
#include <ChargeFromAdcVoltage.h>
|
||||
#include <EstimatedPower.h>
|
||||
|
||||
std::shared_ptr<tt::hal::power::PowerDevice> createPower() {
|
||||
ChargeFromAdcVoltage::Configuration configuration;
|
||||
// 2.0 ratio, but +.11 added as display voltage sag compensation.
|
||||
configuration.adcMultiplier = 2.11;
|
||||
|
||||
return std::make_shared<EstimatedPower>(configuration);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
#include <driver/gpio.h>
|
||||
|
||||
constexpr auto TDISPLAY_S3_POWERON_GPIO = GPIO_NUM_15;
|
||||
|
||||
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
|
||||
Reference in New Issue
Block a user