Adding more buttons via overlay

Hello,

I am trying to use a membrane keypad that has 5 buttons. It's not a matrix keyboard so I was just going to add 5 buttons into whatever gpio pins I can spare, but I'm having trouble with the overlay file. It says the button needs a "compatible" property, but once I add that it gives me a different error. I've been playing whack-a-mole with errors for a while and not sure what I'm missing.

Parents Reply Children
  • /{
        custom_buttons {
            compatible = "gpio-leds";
            button4: button_4 {
                gpios = <&gpio0 21 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; //Pull down is very important
                label = "Custum button 4";
            };
            button5: button_5 {
                gpios = <&gpio0 17 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; //Pull down is very important
                label = "Custom button 5";
            };
            button6: button_6 {
                gpios = <&gpio0 24 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; //Pull down is very important
                label = "Custom button 6";
            };
        };
    };
    Thanks, I was able to get this to work yesterday. I think the problem was I didn't have the /{ for the root. Also I needed to set it to have GPIO_PULL_DOWN instead of GPIO_PULL_UP.
Related