Re: Single gpio shared by LED and switch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jacek,

On Mon, Sep 7, 2015 at 3:03 PM, Jacek Anaszewski
<j.anaszewski@xxxxxxxxxxx> wrote:
> On 09/01/2015 07:00 PM, Geert Uytterhoeven wrote:
>> I'm wondering if there already exists a driver for a gpio that's connected
>> to both an LED and an input switch.
>>
>> I'd expect such a hardware configuration to be fairly common, as gpios can
>> be
>> a limited resource.
>> Most of the time the gpio would be in output mode, driving the LED, but at
>> regular intervals the mode would be changed for a very short moment to
>> input,
>> to monitor the state of the switch.
>>
>> I had a quick look at various drivers (and of course at
>> Documentation/gpio/drivers-on-gpio.txt), but couldn't find any.
>>
>> Does such a hybrid of "leds-gpio" and "gpio-keys(-polled)" already exists?
>
> Can you share an example of such a circuit? Would it be possible to

Something like this?

                     VCC         VCC
                      |           |
                      R           R
                      |           |
              __|__   |           |
          +---o   o---+          _|_
          |           |          \ /
          |           |          ---
         GND          R           |
                      |           |
                      |         |-+
                      |         |<+
GPIO -----------------+---------|-|
                                  |
                                  |
                                 GND

> construct it without additional GPIO driven transistor?

Perhaps just like this?

                     VCC
                      |
                      R
                      |
                      |
                     _|_
                     \ /
                     ---
                      |
                      |
GPIO -----R-----------+
                      |
                      |
                    | o
                   -|
                    | o
                      |
                      |
                     GND

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux