Skip to content

Inverting GPIOs #178

Closed
Closed
@har7an

Description

@har7an

Why?

Today I came across a SPI device that has an inverted CS line. With the current HAL implementation, this situation cannot easily be handled: The SpiDevice trait as implemented on SpiBusDevice requires an IO that implements the OutputPin trait from the esp-hal, hence something like inverted-pin doesn't work. This leaves me with having to forego SpiBusDevice in favor of manually handling the CS line which isn't nice.

What to do about it?

The esp32 has hardware support for inverting both input and output GPIOs in hardware, via the GPIO_FUNCx_(OUT|IN)_INV_SEL bit.
Hence, I think it would be possible to add GPIO inversion at zero cost by extending the Pin trait from esp-hal. What are your thoughts on this? Would you accept a PR that implements this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions