Skip to content
Snippets Groups Projects
Commit 67b6d9d4 authored by Daniel Thompson's avatar Daniel Thompson Committed by Paul Sokolovsky
Browse files

zephyr: Initial implementation of machine.Pin.


The integration with Zephyr is fairly clean but as MicroPython Hardware API
requires pin ID to be a single value, but Zephyr operates GPIO in terms of
ports and pins, not just pins, a "hierarchical" ID is required, using tuple
of (port, pin). Port is a string, effectively a device name of a GPIO port,
per Zephyr conventions these are "GPIO_0", "GPIO_1", etc.; pin is integer
number of pin with the port (supposed to be in range 0-31).

Example of pin initialization:

pin = Pin(("GPIO_1", 21), Pin.OUT)

(an LED on FRDM-K64F's Port B, Pin 21).

There is support for in/out pins and pull up/pull down but currently
there is no interrupt support.

Signed-off-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: default avatarPaul Sokolovsky <paul.sokolovsky@linaro.org>
parent a3519332
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment