Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA8875 Resistive Touch Screen Incorrect #652

Open
gwiethaus opened this issue Nov 26, 2024 · 0 comments
Open

RA8875 Resistive Touch Screen Incorrect #652

gwiethaus opened this issue Nov 26, 2024 · 0 comments

Comments

@gwiethaus
Copy link

Environment

  • MCU or Board name: ESP32-S3 DevKitC-1
  • Panel Driver IC: RA8875 with Touch Native Controller
  • Bus type: SPI
  • LovyanGFX version: v1.2.0
  • FrameWork version: Visual Studio Code
  • Build Environment: PlatformIO
  • Operating System: Windows 10

Problem Description

The recently released version of the Touch_RA8875.h library has lines in the init() method that do not make sense. First, the RA8875 display shares the same SPI for controlling the display and the touch screen. Configuring an SPI for controlling the touch screen is redundant and can mess up previous display configurations that have already been made. I have noticed this by causing malfunctions.

Expected Behavior

the touch screen does not work properly

Actual Behavior

The following piece of code I am referring to and believe should be removed:

bool Touch_RA8875::init(void)
{
  ...
  lgfx::gpio_hi(_cfg.pin_cs);
  lgfx::pinMode(_cfg.pin_cs, lgfx::pin_mode_t::output);
  if (!lgfx::spi::init(_cfg.spi_host, _cfg.pin_sclk, _cfg.pin_miso, _cfg.pin_mosi).has_value()) return false;
  ...
}

In addition, it was necessary to implement the code that defines the interrupt pin on which the microcontroller will receive the signal that a touch has occurred (INT). Important for handling interrupts, interrupt routines (ISR), etc. Below is a section that should have been implemented:

    if (_cfg.pin_int !=-1) {
      pinMode(_cfg.pin_int, lgfx::pin_mode_t::input);
      digitalWrite(_cfg.pin_int, HIGH);
    }

Check

Check if it is correctly implemented for the ESP32S3 MCU, as I found that in the respective folders some things between ESP32 and ESP32S3 are different

  1. common.cpp (hpp)
  2. BUS_SPI.cpp (hpp)
  3. Folder esp32 and esp32S3

Final considerations

It is always good for clarity of design and code understanding to use constants to define the registers and functions of the microcontroller in question. This makes it easier to find possible bugs and understand the code. It reduces the difficulty in locating functions and registers in the datasheet. I use the same name as the definitions or constants that are identical to the datasheet. It greatly improves the understanding of what is happening in the code. I create a file with only arpa registers like RA8875_registers.hpp and declare all the registers and some considerations about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant