Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of gpio #461

Open
J0hn-Lawrence opened this issue Mar 16, 2023 · 1 comment
Open

Usage of gpio #461

J0hn-Lawrence opened this issue Mar 16, 2023 · 1 comment

Comments

@J0hn-Lawrence
Copy link

J0hn-Lawrence commented Mar 16, 2023

Hi everyone,

I am wondering how I can use GPIO.

A comment starting on line 9 of the file "libtock-rs/apis/gpio/src/lib.rs" states the following:

Include by
[gpio.txt](https://github.com/tock/libtock-rs/files/10993761/gpio.txt)
 using: "use libtock::Gpios;"
Turn on a pin by: "let pin = Gpios::get_pin(0)?;"

When I create a new example "gpio.rs" in the examples directory and try to build it with "$ make EXAMPLE=gpio" I get the following error:

   |    use libtock::Gpios;
   |     ^^^^^^^^^^^^^^ no `Gpios` in the root

I have tried to build for nrf52, microbit_v2 and raspberry pi pico (which I think is not supported yet?), but all failed with the same message so I suppose this is not a target specific problem.
i have also tried not capitalizing any letter in the use statement and also tried the singular of gpio -> "use libtock::gpio;". That did not work out as well.
I have attached the few lines of code I wrote in the file gpio.txt.

My questions:
Is this behavior expected or am I doing something completely wrong here?
Is there any documentation regarding the GPIO usage other than the comments in the aforementioned file?

If this is the wrong place to discuss this, please feel free to tell me and the issue can be closed.

Thank you!

@bradjc
Copy link
Contributor

bradjc commented Aug 8, 2023

I wrote an example for GPIO here: #498. That should be a good starting point using the GPIO library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants