Quantcast
Viewing all articles
Browse latest Browse all 5251

Device Tree • Re: How to select a device tree on the basis of GPIOs?


Kinda. GPIO based conditional filters are XOR and last one wins. That means one GPIO per overlay or combination of overlays except for the default.

Code:

[gpio0=1]dtoverlay=foo[gpio1=1]dtoverly=bar[all]
If both GPIO0 and GPIO1 are high you only get the bar overlay loaded. If GPIO0 is high and GPIO1 is low you get nothing.

Similarly,

Code:

[gpio0=1][gpio1=1]dtoverlay=baz[all]
Will load baz if GPIO1 is high, not, as you might expect, only if both GPIO0 and GPIO1 are high.

Code:

[gpio0=1]dtoverlay=foo[all][gpio1=1]dtoverly=bar[all]
Might load both if both GPIO are high but you'd need to test that as it's been a long time since I tried.
This is not possible, only the last condition will win. For example, if case of gpio0 and gpio1, dtoverlay will only be equal to baz if gpio01=1

Statistics: Posted by funkpunkt — Tue Jun 25, 2024 6:53 am



Viewing all articles
Browse latest Browse all 5251

Trending Articles