<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[T-Touch Bar LED does not work with SquareLine Studio]]></title><description><![CDATA[<p dir="auto">I might need some help with implementing the Flow_image example on the T-Touch Bar LED device using the official source code from Lilygo (<a href="https://github.com/Xinyuan-LilyGO/T-Touch_Bar.git" rel="nofollow ugc">https://github.com/Xinyuan-LilyGO/T-Touch_Bar.git</a>). I have built the interface using SquareLine Studio (configuration details are provided below). However, after successfully compiling and uploading the code, the T-Touch Bar LED screen remains black. I tried restarting, but it didn't change anything. I hope someone can assist me. My configuration details are provided below.</p>
<p dir="auto">Interface configuration on SquareLine Studio 1.4.1:<br />
<img src="/assets/uploads/files/1718449153736-capture111-resized.png" alt="Capture111.PNG" class=" img-responsive img-markdown" /></p>
<p dir="auto">main.cpp</p>
<pre><code>
#define I2C_SDA 10
#define I2C_SCL 11
#define INT_N_PIN 12
#define RST_N_PIN 9
#define TFT1_CS 14
#define TFT2_CS 13
#define LED_PIN 21
#define TOUCH_PIN 1
#define TOUCH_CE_PIN 39
#define TFT1_EN                      \
    {                                \
        digitalWrite(TFT2_CS, HIGH); \
        digitalWrite(TFT1_CS, LOW);  \
    }
#define TFT2_EN                      \
    {                                \
        digitalWrite(TFT1_CS, HIGH); \
        digitalWrite(TFT2_CS, LOW);  \
    }
#define DISP_BUF_SIZE (screenWidth * screenHeight)

#include "Arduino.h"
#include &lt;TFT_GC9D01N.h&gt;
#include "ui.h"
#include &lt;SPI.h&gt;
#include "lvgl.h"
#include "FT6336U.h"
#include &lt;stdio.h&gt;

FT6336U ft6336u(I2C_SDA, I2C_SCL, RST_N_PIN, INT_N_PIN);
FT6336U_TouchPointType tp;
TFT_GC9D01N_Class tft;
static const uint32_t screenWidth = 40;
static const uint32_t screenHeight = 320;
static lv_disp_draw_buf_t draw_buf;
static lv_disp_drv_t disp_drv;
static lv_color_t *buf;
lv_disp_t *disp;
lv_obj_t *meun_obj_bg;
lv_obj_t *ui_meun_group;

static void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
void my_input_read(lv_indev_drv_t *drv, lv_indev_data_t *data);
void lv_port_disp_init(void);
static void ofs_y_anim(void *img, int32_t v);
void setup()
{
    // put your setup code here, to run once:
    Serial.begin(115200);
    pinMode(LED_PIN, OUTPUT);
    pinMode(TOUCH_CE_PIN, OUTPUT);
    digitalWrite(TOUCH_CE_PIN, HIGH);

    tft.begin();
    tft.backlight(255);
    pinMode(TFT2_CS, OUTPUT);
    pinMode(TFT1_CS, OUTPUT);

    digitalWrite(TFT2_CS, LOW);
    digitalWrite(TFT1_CS, LOW);
    delay(200);

    TFT2_EN
    tft.writecommand(0x36);
    tft.writedata(0x00);

    ft6336u.begin();
    delay(200);

    TFT1_EN
    tft.DispColor(0, 0, TFT_WIDTH, TFT_HEIGHT, BLACK);
    TFT2_EN
    tft.DispColor(0, 0, TFT_WIDTH, TFT_HEIGHT, BLACK);

    lv_init();
    lv_port_disp_init();
    // load UI
    ui_init();
    lv_disp_load_scr(meun_obj_bg);
}

void loop()
{
    tp = ft6336u.scan();
    lv_timer_handler();
    vTaskDelay(5);
}

static void ofs_y_anim(void *img, int32_t v)
{
    lv_img_set_offset_y((lv_obj_t *)img, v);
}

static void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
    uint32_t w = (area-&gt;x2 - area-&gt;x1 + 1);
    uint32_t h = (area-&gt;y2 - area-&gt;y1 + 1);

    if (area-&gt;y1 &lt;= 160 &amp;&amp; area-&gt;y2 &lt;= 160)
    {
        TFT1_EN
        tft.DrawImage(area-&gt;x1, area-&gt;y1, w, (h &gt; 160 ? 160 : h), (uint16_t *)color_p);
    }
    else if (area-&gt;y1 &gt; 160 &amp;&amp; area-&gt;y2 &gt; 160)
    {
        TFT2_EN
        tft.DrawImage(area-&gt;x1, area-&gt;y1 - 159, w, h, (uint16_t *)color_p);
    }
    else
    {
        uint32_t h1 = (160 - area-&gt;y1);
        uint32_t h2 = (area-&gt;y2 - 160 + 1);
        TFT1_EN
        tft.BlockWrite(area-&gt;x1, area-&gt;x1 + w - 1, area-&gt;y1, 159);
        SPI.beginTransaction(SPISettings(SPI_FREQUENCY, MSBFIRST, SPI_MODE0));
        DC_D;
        for (int i = 0; i &lt; (w * h1); i++)
        {
            SPI.write16(*((uint16_t *)(color_p + i)));
        }
        SPI.endTransaction();

        TFT2_EN
        tft.BlockWrite(area-&gt;x1, area-&gt;x1 + w - 1, 0, area-&gt;y1 + h2 - 1);
        SPI.beginTransaction(SPISettings(SPI_FREQUENCY, MSBFIRST, SPI_MODE0));
        DC_D;
        int j = w * h1;
        for (int i = 0; i &lt; (w * h2); i++)
        {
            SPI.write16(*((uint16_t *)(color_p + i + j)));
        }
        SPI.endTransaction();
    }

    lv_disp_flush_ready(disp);
}

void my_input_read(lv_indev_drv_t *drv, lv_indev_data_t *data)
{

    if (tp.tp[0].status == 1)
    {
        if (data-&gt;point.y &gt; 165)
        {
            data-&gt;point.x = tp.tp[0].x;
            data-&gt;point.y = tp.tp[0].y - 40;
        }
        else
        {
            data-&gt;point.x = tp.tp[0].x;
            data-&gt;point.y = tp.tp[0].y;
        }
        data-&gt;state = LV_INDEV_STATE_PRESSED;
    }
    else
    {
        data-&gt;state = LV_INDEV_STATE_RELEASED;
    }
}

void lv_port_disp_init(void)
{
    buf = (lv_color_t *)heap_caps_malloc(sizeof(lv_color_t) * DISP_BUF_SIZE,
                                         MALLOC_CAP_DMA | MALLOC_CAP_8BIT);
    lv_disp_draw_buf_init(&amp;draw_buf, buf, NULL, DISP_BUF_SIZE);

    lv_disp_drv_init(&amp;disp_drv);
    disp_drv.hor_res = screenWidth;
    disp_drv.ver_res = screenHeight;
    disp_drv.flush_cb = my_disp_flush;
    disp_drv.draw_buf = &amp;draw_buf;
    // disp_drv.full_refresh=1;
    disp_drv.sw_rotate = 1;
    disp_drv.rotated = LV_DISP_ROT_180;
    lv_disp_drv_register(&amp;disp_drv);
    disp = lv_disp_drv_register(&amp;disp_drv); /*Register the driver and save the created display objects*/

    // touch
    static lv_indev_drv_t indev_drv;
    lv_indev_drv_init(&amp;indev_drv);
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read_cb = my_input_read;
    /*Register the driver in LVGL and save the created input device object*/
    lv_indev_t *my_indev = lv_indev_drv_register(&amp;indev_drv);
}

</code></pre>
<p dir="auto">platformio.ini</p>
<pre><code>; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
;;Select the project you want to compile
; default_envs = USB_HID
; default_envs = battery_voltage
; default_envs = Flow_image
; default_envs = nyan_cat
default_envs = Touch_Bar_Image


globallib_dir = lib
src_dir = E:/Work/PlatformIO/Project/T-Touch_Bar/example/${platformio.default_envs}

[env]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino

; change MCU frequency
board_build.f_cpu = 240000000L
monitor_speed = 115200
; upload_port= COM1096

build_flags = 
    -DLV_LVGL_H_INCLUDE_SIMPLE
    -DBOARD_HAS_PSRAM
    ; -mfix-esp32-psram-cache-issue 
    ; -mfix-esp32-psram-cache-strategy=memw
    -DARDUINO_USB_MODE=1
    ; -DARDUINO_USB_CDC_ON_BOOT=1 
board_build.partitions=partitions_custom.csv

; platform_packages =
;     framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git#2.0.6
    
lib_deps = 
[env:battery_voltage]
[env:Flow_image]
[env:USB_HID]
[env:nyan_cat]
[env:Touch_Bar_Image]

</code></pre>
]]></description><link>https://www.community.lilygo.cc/topic/1022/t-touch-bar-led-does-not-work-with-squareline-studio</link><generator>RSS for Node</generator><lastBuildDate>Sat, 06 Jun 2026 10:43:52 GMT</lastBuildDate><atom:link href="https://www.community.lilygo.cc/topic/1022.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 15 Jun 2024 10:57:34 GMT</pubDate><ttl>60</ttl></channel></rss>