Closed jogiji closed 4 years ago
Yeah, that's a good idea.
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
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.
Here’s another vote for GPIO access (unless dart:ffi gets working soon)
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.
Here’s another vote for GPIO access (unless dart:ffi gets working soon)
Yeah actually I started work on GPIO access using
dart:ffi
andlibgpiod
a while ago, because it's probably faster than platform channels. Had basic functionality going & was ready to test, then I found outdart:ffi
isn't yet supported on ARM hardfp platforms.
So, how did you solve this challenge? Write a flutter plugin for GPIO?
So, how did you solve this challenge? Write a flutter plugin for GPIO?
I didn't (yet).
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.
Just published it.
dart:ffi seems to be working with hardfp by now, according to https://github.com/dart-lang/sdk/commit/a71d60c1cf9ff350d4f216b62aa44835182d98f5
@ardera Any chance you could share your FFI based plugin for reference?
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.
Test environment
Thank you :) flutter_gpiod works well.
Can we have GPIO access of some sort with this implementation ?? Just asking