I am trying to get touch working with a nRF5340 DK and a Waveshare 1.69inch Touch LCD Module. I am running nRF Connect for VSC 2.6.1. My goal is to handle swipe left, swipe right, swipe down, swipe up, and long press, similar to this post.
I started with the lvgl display sample, because it seems to support a pointer and touch. I added a build configuration for the nrf5340DK and an overlay. I can't however get the touch working.
I believe I need to add settings to the prj.conf and I have been experimenting, but it would be good to have the setting in there already, even if they are commented out. Here is what I have:
CONFIG_LV_Z_MEM_POOL_SIZE=16384 CONFIG_LV_Z_SHELL=y CONFIG_MAIN_STACK_SIZE=2048 CONFIG_DISPLAY=y CONFIG_DISPLAY_LOG_LEVEL_ERR=y CONFIG_DISPLAY_LOG_LEVEL_INF=y CONFIG_LOG=y CONFIG_SHELL=y CONFIG_LVGL=y CONFIG_LV_MEM_CUSTOM=y CONFIG_LV_USE_LOG=y CONFIG_LV_USE_LABEL=y CONFIG_LV_USE_BTN=y CONFIG_LV_USE_ARC=y CONFIG_LV_USE_IMG=y CONFIG_LV_USE_MONKEY=y CONFIG_LV_FONT_MONTSERRAT_16=y #added to get touch working CONFIG_INPUT=y CONFIG_LV_Z_POINTER_INPUT=y
However, I am getting a message on the CONFIG_LV_Z_POINTER_INPUT
:
CONFIG_LV_Z_POINTER_INPUT was assigned the value y, but got the value n. Missing dependencies: (INPUT && DT_HAS_ZEPHYR_LVGL_POINTER_INPUT_ENABLED && LVGL) || (INPUT && DT_HAS_ZEPHYR_LVGL_POINTER_INPUT_ENABLED && LVGL && 0)
In the code main.c as well this code is dimmed in VSC, so clearly this is not set:
#ifdef CONFIG_LV_Z_ENCODER_INPUT lv_obj_t *arc; lv_group_t *arc_group; arc = lv_arc_create(lv_scr_act()); lv_obj_align(arc, LV_ALIGN_CENTER, 0, 0); lv_obj_set_size(arc, 150, 150); arc_group = lv_group_create(); lv_group_add_obj(arc_group, arc); lv_indev_set_group(lvgl_input_get_indev(lvgl_encoder), arc_group); #endif /* CONFIG_LV_Z_ENCODER_INPUT */
So, I guess I need to figure out how to get CONFIG_DT_HAS_ZEPHYR_LVGL_POINTER_INPUT_ENABLED
set, which I'm guessing comes from the overlay. There may be additional overlay entries required, but I did set the touch, I think:
&pinctrl { spi4_default: spi4_default { group1 { psels = <NRF_PSEL(SPIM_SCK, 0, 6)>, <NRF_PSEL(SPIM_MOSI, 0, 25)>; }; }; spi4_sleep: spi4_sleep { group1 { psels = <NRF_PSEL(SPIM_SCK, 0, 6)>, <NRF_PSEL(SPIM_MOSI, 0, 25)>; low-power-enable; }; }; // Set to I2C pins that the touch screen is connected to i2c2_default: i2c2_default { group1 { psels = <NRF_PSEL(TWIM_SDA, 1, 2)>, <NRF_PSEL(TWIM_SCL, 1, 3)>; }; }; i2c2_sleep: i2c2_sleep { group1 { psels = <NRF_PSEL(TWIM_SDA, 1, 2)>, <NRF_PSEL(TWIM_SCL, 1, 3)>; low-power-enable; }; }; }; &spi4 { compatible = "nordic,nrf-spim"; status = "okay"; pinctrl-0 = <&spi4_default>; pinctrl-1 = <&spi4_sleep>; pinctrl-names = "default", "sleep"; cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; st7789v_st7789v_tl019fqv01: st7789v@0 { compatible = "sitronix,st7789v"; spi-max-frequency = <20000000>; reg = <0>; cmd-data-gpios = < &gpio1 11 GPIO_ACTIVE_LOW>; reset-gpios = < &gpio1 10 GPIO_ACTIVE_LOW>; width = <240>; height = <280>; x-offset = <0>; y-offset = <0>; vcom = <0x19>; gctrl = <0x35>; vrhs = <0x12>; vdvs = <0x20>; mdac = <0x00>; gamma = <0x01>; colmod = <0x05>; lcm = <0x2c>; porch-param = [0c 0c 00 33 33]; cmd2en-param = [5a 69 02 01]; pwctrl1-param = [a4 a1]; pvgam-param = [D0 04 0D 11 13 2B 3F 54 4C 18 0D 0B 1F 23]; nvgam-param = [D0 04 0C 11 13 2C 3F 44 51 2F 1F 1F 20 23]; ram-param = [00 F0]; rgb-param = [CD 08 14]; }; }; &i2c2 { compatible = "nordic,nrf-twim"; status = "okay"; clock-frequency = <I2C_BITRATE_FAST>; pinctrl-0 = <&i2c2_default>; pinctrl-1 = <&i2c2_sleep>; pinctrl-names = "default", "sleep"; cst816s: cst816s@15 { compatible = "hynitron,cst816s"; reg = <0x15>; irq-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; rst-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; }; }; / { fstab { compatible = "zephyr,fstab"; lfs: lfs { compatible = "zephyr,fstab,littlefs"; mount-point = "/lfs"; partition = <&littlefs_storage>; automount; read-size = <16>; prog-size = <16>; cache-size = <64>; lookahead-size = <32>; block-cycles = <512>; }; }; }; /delete-node/ &storage_partition; &mx25r64 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; littlefs_storage: partition@0 { label = "littlefs_storage"; reg = <0x00000000 0x00200000>; }; lvgl_raw_partition: partition@200000 { label = "lvgl_raw_partition"; reg = <0x00200000 0x00200000>; }; settings_partition: partition@400000 { label = "settings_partition"; reg = <0x400000 0x100000 >; }; }; }; / { chosen { nordic,pm-ext-flash = &mx25r64; zephyr,display = &st7789v_st7789v_tl019fqv01; zephyr,keyboard-scan = &cst816s; }; /* aliases { vibrator_pwm = &led0; }; */ vib_pwr: vib-pwr-ctrl { compatible = "regulator-fixed"; regulator-name = "vib-pwr-ctrl"; enable-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; }; };
I did find the Capacitive Touch on the nRF52 series good background but I'm using lvgl which handles the touch, I believe, and I did not see specifics on getting a demo set up.