Skip to content

GPIO access #9

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

Closed
jogiji opened this issue Oct 23, 2019 · 12 comments
Closed

GPIO access #9

jogiji opened this issue Oct 23, 2019 · 12 comments
Assignees
Labels
enhancement New feature or request

Comments

@jogiji
Copy link

jogiji commented Oct 23, 2019

Can we have GPIO access of some sort with this implementation ?? Just asking

@ardera ardera added the enhancement New feature or request label Oct 29, 2019
@ardera ardera self-assigned this Oct 29, 2019
@ardera
Copy link
Owner

ardera commented Oct 29, 2019

Yeah, that's a good idea.

@ardera ardera changed the title GPIO acces GPIO access Nov 15, 2019
@akilinomendez
Copy link

Alternatively you can create a backend with flask or django and call with dio in flutter to execute gpio commands using python.

Is tested and working

@ardera
Copy link
Owner

ardera commented Nov 27, 2019

Alternatively you can create a backend with flask or django and call with dio in flutter to execute gpio commands using python.

Is tested and working

That's kinda overkill but yeah, sounds like that should be working.

I found a package that does exactly what you want: https://pub.dev/packages/rpi_gpio

Only works for Raspberry Pi though, while flutter-pi (despite its name) works on much more embedded devices.

EDIT: Seems like it's also not that easy to use, since it requires you to compile a shared library on the Pi.

@mortenboye
Copy link

mortenboye commented Jan 23, 2020

Here’s another vote for GPIO access (unless dart:ffi gets working soon)

@ardera
Copy link
Owner

ardera commented Jan 24, 2020

Here’s another vote for GPIO access (unless dart:ffi gets working soon)

Yeah actually I started work on GPIO access using dart:ffi and libgpiod a while ago, because it's probably faster than platform channels. Had basic functionality going & was ready to test, then I found out dart:ffi isn't yet supported on ARM hardfp platforms.

@mortenboye
Copy link

Here’s another vote for GPIO access (unless dart:ffi gets working soon)

Yeah actually I started work on GPIO access using dart:ffi and libgpiod a while ago, because it's probably faster than platform channels. Had basic functionality going & was ready to test, then I found out dart:ffi isn't yet supported on ARM hardfp platforms.

So, how did you solve this challenge? Write a flutter plugin for GPIO?

@ardera
Copy link
Owner

ardera commented Jan 24, 2020

So, how did you solve this challenge? Write a flutter plugin for GPIO?

I didn't (yet).

@ardera
Copy link
Owner

ardera commented Feb 26, 2020

GPIO (more precisely, libgpiod) support is now integrated into flutter-pi.
The dart interface still needs some work. Once it's done, I'll publish it on pub.dev.

@ardera
Copy link
Owner

ardera commented Mar 23, 2020

Just published it.

@ardera ardera closed this as completed Mar 23, 2020
@mortenboye
Copy link

dart:ffi seems to be working with hardfp by now, according to dart-lang/sdk@a71d60c

@ardera Any chance you could share your FFI based plugin for reference?

@ardera
Copy link
Owner

ardera commented Mar 31, 2020

dart:ffi seems to be working with hardfp by now, according to dart-lang/sdk@a71d60c

Nice! Keep in mind though that this feature is only available to flutter once the next stable version of the dart SDK (2.8) is released. I'll consider migrating the flutter_gpiod package to dart:ffi once that happens. That would mean a lot of the ugly async stuff, mutexes, etc in flutter_gpiod can go away.

@ardera Any chance you could share your FFI based plugin for reference?

Sure. The code is reaally ugly, very far from finished and doesn't look like the code of the flutter_gpiod package at all, though. I was just kinda experimenting.

flutter_gpiod_ffi.zip

@hhk7734
Copy link

hhk7734 commented Apr 1, 2020

Test environment

  • OS: Linux kernel 5.4, ubuntu 20.04 minimal
  • HW: s905x3 board

Thank you :)
flutter_gpiod works well.

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

No branches or pull requests

5 participants