I. MX6ull Terminator Linux key input experimental key driver

Date: 2020-12-16

  • The experimental routine path: I.MX6ul Terminator CD data /06_Linux driver routines /08_key

    After adding the hardware information of the keys in the device tree file, create the key.c file and write the driver program. The specific content is as follows:

    In line 36, add a keyvalue to the device structure of the key to record the keyvalue.

    In lines 47 to 65, the function keyio_init is used to initialize the key, get the GPIO information of the key from the device tree, and then set it as input. The key initialization code is extracted as an independent function to improve the modular design of the program.

    In lines 74 to 85, the key_open function initializes the keystroke I/O by calling the keyio_init function, which initializes the keystroke I/O each time the application opens the keystroke driver file.

    On lines 95 to 112, the key_read function is executed when the application reads the key value through the read function. Line 110 reads the level of key IO. If 0, the key is pressed. If the key is pressed, line 111 waits for the key release. After the key is released, mark the key value as 0xF0.

    Line 130 calls the atomic_set function to initialize the atomic variable to an invalid value by default.

Order

Tel:

010-85270716

    Copyright2013 ©Beijing TOPEET Electronics Co.,Ltd.All Rights Reserved 京ICP备12036083号-2

收缩
  • 电话咨询

  • 01058957586