TFT_BL was wrongly GPIO21 (GT911 INT); use GPIO27, DRAW_BUF_DIV=20, and export firmware/cyd_35r. Co-authored-by: Cursor <cursoragent@cursor.com>
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#include <Arduino.h>
|
|
#include <lvgl.h>
|
|
|
|
#include "pins.h"
|
|
#include "touch.h"
|
|
#include "wifi_prov.h"
|
|
#include "wifi_ui.h"
|
|
|
|
static constexpr uint32_t DRAW_BUF_SIZE =
|
|
(SCREEN_WIDTH * SCREEN_HEIGHT / DRAW_BUF_DIV * (LV_COLOR_DEPTH / 8));
|
|
static uint32_t draw_buf[DRAW_BUF_SIZE / 4];
|
|
|
|
void setup() {
|
|
Serial.begin(460800);
|
|
delay(200);
|
|
Serial.println();
|
|
Serial.printf("LVGL %d.%d.%d | CYD WiFi Prov\n", lv_version_major(),
|
|
lv_version_minor(), lv_version_patch());
|
|
|
|
pinMode(TFT_BL_PIN, OUTPUT);
|
|
digitalWrite(TFT_BL_PIN, HIGH);
|
|
|
|
touch_init();
|
|
|
|
lv_init();
|
|
lv_display_t *disp =
|
|
lv_tft_espi_create(SCREEN_WIDTH, SCREEN_HEIGHT, draw_buf, sizeof(draw_buf));
|
|
lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_270);
|
|
|
|
lv_indev_t *indev = lv_indev_create();
|
|
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
|
|
lv_indev_set_read_cb(indev, touch_read_cb);
|
|
lv_indev_set_display(indev, disp);
|
|
|
|
wifi_prov_begin();
|
|
wifi_ui_create();
|
|
}
|
|
|
|
void loop() {
|
|
wifi_prov_loop();
|
|
wifi_ui_tick();
|
|
lv_timer_handler();
|
|
lv_tick_inc(5);
|
|
delay(5);
|
|
}
|