Closed ajsb85 closed 2 years ago
Huh..
I don't want to take care of a child who doesn't even know how to say hello.
@lovyan03 Sorry for not saying hello, I was wondering if you have any plans for R61529 support?
China Taobao store, the information given by the seller.
LiangHaoCai-3.5.inch.IPS-40p-R61529A-data.package.zip
this might help
https://github.com/nopnop2002/esp-idf-parallel-tft/issues/23
@lovyan03 R61529 and ILI9481 are compatible and have been tested.
I have purchased the R61529 but have not had time to work on it because of the troublesome handling of the flexible cable. I will eventually implement it when I have time to work on it, but it is low on my priority list.
@lovyan03 I tried it on ESP32S3,It supports color depth 16 or 18
#define LGFX_USE_V1
#include <lvgl.h>
#include "demos/lv_demos.h"
#include <LovyanGFX.hpp>
class LGFX : public lgfx::LGFX_Device
{
lgfx::Panel_ILI9481 _panel_instance; //R61529兼容ILI9481驱动
lgfx::Bus_Parallel16 _bus_instance;
lgfx::Light_PWM _light_instance;
lgfx::Touch_FT5x06 _touch_instance;
public:
LGFX(void)
{
{
auto cfg = _bus_instance.config();
cfg.port = 0;
cfg.freq_write = 20000000;
cfg.pin_wr = 15; // WR を接続しているピン番号
cfg.pin_rd = -1; // RD を接続しているピン番号
cfg.pin_rs = 16; // RS(D/C)を接続しているピン番号
cfg.pin_d0 = 37; // D0を接続しているピン番号
cfg.pin_d1 = 36; // D1を接続しているピン番号
cfg.pin_d2 = 35; // D2を接続しているピン番号
cfg.pin_d3 = 34; // D3を接続しているピン番号
cfg.pin_d4 = 33; // D4を接続しているピン番号
cfg.pin_d5 = 48; // D5を接続しているピン番号
cfg.pin_d6 = 21; // D6を接続しているピン番号
cfg.pin_d7 = 18; // D7を接続しているピン番号
cfg.pin_d8 = 17; // D8を接続しているピン番号
cfg.pin_d9 = 39; // D9を接続しているピン番号
cfg.pin_d10 = 38; // D10を接続しているピン番号
cfg.pin_d11 = 2; // D11を接続しているピン番号
cfg.pin_d12 = 7; // D12を接続しているピン番号
cfg.pin_d13 = 12; // D13を接続しているピン番号
cfg.pin_d14 = 6; // D14を接続しているピン番号
cfg.pin_d15 = 10; // D15を接続しているピン番号
_bus_instance.config(cfg); // 設定値をバスに反映します。
_panel_instance.setBus(&_bus_instance); // バスをパネルにセットします。
}
{ // 表示パネル制御の設定を行います。
auto cfg = _panel_instance.config(); // 表示パネル設定用の構造体を取得します。
cfg.pin_cs = -1; // CSが接続されているピン番号 (-1 = disable)
cfg.pin_rst = -1; // RSTが接続されているピン番号 (-1 = disable)
cfg.pin_busy = -1; // BUSYが接続されているピン番号 (-1 = disable)
// ※ 以下の設定値はパネル毎に一般的な初期値が設定されていますので、不明な項目はコメントアウトして試してみてください。
cfg.memory_width = 320; // ドライバICがサポートしている最大の幅
cfg.memory_height = 480; // ドライバICがサポートしている最大の高さ
cfg.panel_width = 320; // 実際に表示可能な幅
cfg.panel_height = 480; // 実際に表示可能な高さ
cfg.offset_x = 0; // パネルのX方向オフセット量
cfg.offset_y = 0; // パネルのY方向オフセット量
cfg.offset_rotation = 1; //值在旋转方向的偏移0~7(4~7是倒置的)
cfg.dummy_read_pixel = 8; // 在读取像素之前读取的虚拟位数
cfg.dummy_read_bits = 1; // 读取像素以外的数据之前的虚拟读取位数
cfg.readable = false; // 如果可以读取数据,则设置为 true
cfg.invert = false; // 如果面板的明暗反转,则设置为 true
cfg.rgb_order = false; // 如果面板的红色和蓝色被交换,则设置为 true
cfg.dlen_16bit = true; // 对于以 16 位单位发送数据长度的面板,设置为 true
cfg.bus_shared = false; // 如果总线与 SD 卡共享,则设置为 true(使用 drawJpgFile 等执行总线控制)
_panel_instance.config(cfg);
}
{ // バックライト制御の設定を行います。(必要なければ削除)
auto cfg = _light_instance.config(); // バックライト設定用の構造体を取得します。
cfg.pin_bl = 5; // バックライトが接続されているピン番号
cfg.invert = false; // バックライトの輝度を反転させる場合 true
cfg.freq = 44100; // バックライトのPWM周波数
cfg.pwm_channel = 1; // 使用するPWMのチャンネル番号
_light_instance.config(cfg);
_panel_instance.setLight(&_light_instance); // バックライトをパネルにセットします。
}
{ // タッチスクリーン制御の設定を行います。(必要なければ削除)
auto cfg = _touch_instance.config();
cfg.x_min = 0; // タッチスクリーンから得られる最小のX値(生の値)
cfg.x_max = 319; // タッチスクリーンから得られる最大のX値(生の値)
cfg.y_min = 0; // タッチスクリーンから得られる最小のY値(生の値)
cfg.y_max = 479; // タッチスクリーンから得られる最大のY値(生の値)
cfg.pin_int = -1; // INTが接続されているピン番号
cfg.bus_shared = false; // 如果您使用与屏幕相同的总线,则设置为 true
cfg.offset_rotation = 0;// 显示和触摸方向不匹配时的调整 设置为 0 到 7 的值
// I2C接続の場合
cfg.i2c_port = 0; // 使用するI2Cを選択 (0 or 1)
cfg.i2c_addr = 0x38; // I2Cデバイスアドレス番号
cfg.pin_sda = 40; // SDAが接続されているピン番号
cfg.pin_scl = 41; // SCLが接続されているピン番号
cfg.freq = 400000; // I2Cクロックを設定
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance); // タッチスクリーンをパネルにセットします。
}
setPanel(&_panel_instance); // 使用するパネルをセットします。
}
};
// 準備したクラスのインスタンスを作成します。
LGFX tft;
/*更改为您的屏幕分辨率*/
static const uint32_t screenWidth = 480;
static const uint32_t screenHeight = 320;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[2][screenWidth * 30];
#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(lv_log_level_t level, const char *file, uint32_t line, const char *fn_name, const char *dsc)
{
Serial.printf("%s(%s)@%d->%s\r\n", file, fn_name, line, dsc);
Serial.flush();
}
#endif
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
if(tft.getStartCount()==0)
{
tft.endWrite();
}
tft.pushImageDMA( area->x1
, area->y1
, area->x2 - area->x1 + 1
, area->y2 - area->y1 + 1
, ( lgfx::swap565_t * )&color_p->full);
lv_disp_flush_ready(disp); /* tell lvgl that flushing is done */
}
/*Read the touchpad*/
void my_touchpad_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data)
{
uint16_t touchX, touchY;
bool touched =tft.getTouch(&touchX, &touchY);
if(!touched)
{
data->state = LV_INDEV_STATE_REL;
}
else
{
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates*/
data->point.x = touchX;
data->point.y = touchY;
Serial.print( "Data x " );
Serial.println( touchX );
Serial.print( "Data y " );
Serial.println( touchY );
}
}
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
Serial.println("Hello Arduino! (V8.2.X)");
Serial.println("I am LVGL_Arduino");
tft.init();
tft.initDMA();
tft.startWrite();
lv_init();
#if LV_USE_LOG != 0
lv_log_register_print_cb(my_print); /* register print function for debugging */
#endif
lv_disp_draw_buf_init(&draw_buf, buf[0], buf[1], screenWidth * 30);
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
/*Change the following line to your display resolution*/
disp_drv.hor_res = screenWidth;
disp_drv.ver_res = screenHeight;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register(&disp_drv);
/*Initialize the (dummy) input device driver*/
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
#if 0
/* Create simple label */
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_label_set_text( label, "Hello Arduino! (V8.0.X)" );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
#else
/* Try an example from the lv_examples Arduino library
make sure to include it as written above.
lv_example_btn_1();
*/
// uncomment one of these demos
//lv_demo_widgets(); // OK
lv_demo_benchmark(); // OK
//lv_demo_keypad_encoder();
// works, but I haven't an encoder
//lv_demo_music(); // NOK
//lv_demo_printer();
//lv_demo_stress(); // seems to be OK
#endif
Serial.println("Setup done");
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay(5);
}
@lovyan03 excuse me! I wonder if LovyanGFX supports hardware swapping of color bytes?
https://github.com/espressif/esp-idf/issues/8847#issuecomment-1111678275
@lovyan03 R61529 and ILI9481 are compatible and have been tested.
6460_1647171512.mp4
hi, can you please share how you wired the ESP32 to R61529? I have tried a few different ways but something just seems to break and the characters are not printed clearly or the whole screen is blue. I might be missing something simple here. So any wiring/ connection info? and the TFT initialization sample code? Thanks.
Hello @lovyan03 ! Awesome library, thank you! If you share your Paypal, I'll send you a little donation for coffee XD
Also, if you don't mind, I am working on a new custom device with a parallel interface and thinking of buying a display based on R61529 driver.
Can you please confirm, when you have a chance, that the source code from the upper comment by @modi12jin is what I need https://github.com/lovyan03/LovyanGFX/issues/140#issuecomment-1094154316 ?
Sorry for asking, I have to order the custom device and if it does not work, will lose a lot $$.
Thanks a lot!
Datasheet R61529.pdf
https://es.aliexpress.com/item/32940608152.html https://es.aliexpress.com/item/4001050619990.html