1 Star 0 Fork 5.3K

royomon / OpenHarmonyDocs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
touchscreendevelopment-guidelines.md 2.64 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

Touchscreen Development Guidelines

Regardless of the OS and system on a chip (SoC), the Touchscreen driver is developed based on the HDF, Platform, and OSAL APIs to provide a unified driver model for touchscreens.

  1. The HDF provides a unified driver management model. The HDF identifies and loads drivers through the module configuration information. The HDF starts drivers in sequence using the Init function.
  2. Implement the following operations in Init:
    • Use an OSAL interface to create device node /dev/input/eventx and implement operation functions such as open, close, read, write, and ioctl for the node, enabling the node to transmit touch reporting data and instructions.
    • Based on the hardware connection to the touchscreen, use the GPIO interfaces provided by the Platform to configure and perform operations for the reset pins and interrupt pins.
    • Use the I2C or SPI interfaces provided by the Platform to implement data communication depending on the communication interfaces selected by the touchscreen.

Limitations and Constraints

None.

How to Develop

  1. Start the driver using the Init function.

    Currently, the driver is developed based on the HDF driver model and is loaded and started by the HDF. Register the driver information in the configuration file. Then, the HDF starts the registered driver modules one by one. For details about the driver configuration, see How to Develop.

  2. Initialize the I/O status and input configurations.

    Configure the required I/O pins. For example, configure a register for the I2C pin reserved for the touchscreen to use I2C for transmitting data.

  3. Perform power sequence.

    Use the Platform interfaces to perform operations for the reset pins, interrupt pins and power based on the communications interfaces designed for boards. For details about the GPIO-related operations, see GPIO Usage Guidelines.

  4. Implement the ISR function.

  5. Obtain the power status and take proper actions.

  6. Download the required touchscreen firmware.

  7. Create a device node and implement the operation function for the node.

    Create an input device node based on service requirements. For example, create the device file dev/input/event0. Then, implement functions such as open, close, read, write, ioctl and poll for the file. You can add or delete them as required.

FAQs

None.

1
https://gitee.com/eastwellext/OpenHarmonyDocs.git
git@gitee.com:eastwellext/OpenHarmonyDocs.git
eastwellext
OpenHarmonyDocs
OpenHarmonyDocs
master

搜索帮助