Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

H6 gpio input as key stroke

Featured Replies

Hi,

 

i need a gpio to trigger a key stroke.

 

I had an raspberry pi zero and this worked for setting up an gpio to trigger a key stroke.

For some reason I am not able to port this to my orangepi 3 lts H6 board.

 

I think there is some confusion because there are two pin-controller? Do I have to set the right one anywhere?

 

I thought the setting will be listed here like the raspberry did

root@orangepi3-lts:~# cat /sys/kernel/debug/gpio
gpiochip1: GPIOs 0-255, parent: platform/300b000.pinctrl, 300b000.pinctrl:
 gpio-79  (                    |usb0_id_det         ) in  hi
 gpio-102 (                    |gmac-3v3            ) out hi
 gpio-110 (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-166 (                    |cd                  ) in  lo IRQ ACTIVE LOW
 gpio-226 (                    |ddc-en              ) out hi
 gpio-231 (                    |vcc33-wifi          ) out hi

gpiochip0: GPIOs 352-415, parent: platform/7022000.pinctrl, 7022000.pinctrl:
 gpio-356 (                    |red-led             ) out lo
 gpio-359 (                    |green-led           ) out hi
 gpio-387 (                    |reset               ) out hi ACTIVE LOW

 

Here's my try using gpio "PD21" aka 117 for an active low input (bias-pull-up is not active ?!)

 

/dts-v1/;
/plugin/;

/ {

  compatible = "allwinner,sun50i-h6";

  fragment@0 {

    target = <&pio>;

    __overlay__ {
      gpio_keys: gpio_keys {
        pins = "PD21";
        function = "gpio_in";
        bias-pull-up;			
      };
    };

  };

  fragment@1 {

    target-path = "/";

    __overlay__ {
      pinctrl-names = "default";
      pinctrl-0 = <&gpio_keys>;

      keypad: photobox {
        compatible = "gpio-keys";
        #address-cells = <1>;
        #size-cells = <0>;
        autorepeat;

        button@117 {
          label = "KEY_R";
          linux,code = <19>;  // r
          gpios = <&pio 117 1>;
        };

      };

    };

  };

};

 

What does `pinctrl-0 = <&gpio_keys>;` mean? Is there an automatic mapping to the right pinctrl?

 

I have seen that the gpio pins eg. PD21 are represented as `gpios = <&pio 3 21 0>` here ... but it doesn't help either

                                                                                                                        ^   ^

                                                                                                                            - 21 as pin offset

                                                                                                                            - 3 multiplicator (A=0, B=1, C=2, D=3 ?)

 

Maybe I need to build with "CONFIG_INPUT_MATRIXKMAP" ?

 

CONFIG_INPUT=y
CONFIG_INPUT_LEDS=y
CONFIG_INPUT_FF_MEMLESS=m
# CONFIG_INPUT_SPARSEKMAP is not set
# CONFIG_INPUT_MATRIXKMAP is not set

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.