FAQ_MA35_Family Matrix Keyboard Settings

Post Reply
yhcheng3
Posts: 55
Joined: 02 Dec 2022, 10:46

11 Apr 2024, 14:12

Question :

How to Set Matrix Keyboard ?


Answer.


1. Taking the 2X2 Matrix Keyboard as an example, the circuit design is as follows:
Matrix_Keyboard.png
Matrix_Keyboard
Matrix_Keyboard.png (12.43 KiB) Viewed 645 times


2. Taking the SOM board as an example, modify ma35d1-som-256m.dts and the keypad part is as follows:

Code: Select all

&keypad {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_keypad>;

     keypad,num-rows = <2>;
    keypad,num-columns = <2>;

    linux,keymap = <
    MATRIX_KEY(0x00, 0x00, KEY_1) /* key_1 */
    MATRIX_KEY(0x00, 0x01, KEY_2) /* key_2 */
    MATRIX_KEY(0x01, 0x00, KEY_3) /* key_3 */
    MATRIX_KEY(0x01, 0x01, KEY_4) /* key_4 */
    >;
    
};

    keypad {
        pinctrl_keypad: keypadgrp{
            nuvoton,pins =
                <SYS_GPF_MFPL_PF4MFP_KPI_ROW0 &pcfg_default>,
                <SYS_GPF_MFPL_PF5MFP_KPI_ROW1 &pcfg_default>,
                     <SYS_GPF_MFPL_PF0MFP_KPI_COL0 &pcfg_default>,
                <SYS_GPF_MFPL_PF1MFP_KPI_COL1 &pcfg_default>;
        };
    };


#MA35 , #Keyboard , #dts
.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests