Code Monkey home page Code Monkey logo

Comments (10)

Odianosen25 avatar Odianosen25 commented on September 28, 2024

@jabdoa2 and @alexander3771,

Please is there anyway someone could assist me with this request? I know Asyncio, but not so confident in it.

Even if the code is just a patch together, at least it gives me a start and I could walk via it, if its buggy; so no need to spend so much time on it.

Thanks

from apigpio.

alexander3771 avatar alexander3771 commented on September 28, 2024

Hello, @Odianosen25!

I didn't make anything with apigpio since my last commit, but I worked on other asyncio-projects :)

As far as I understand, you want to connect to your gpio via serial port.
I guess, you only need to implement connection from this snippet https://gist.github.com/potens1/914b738a2ca6fed7a7b3
Inherit methods connect, _pigpio_aio_command and close here, and make sending data via serial connection
https://github.com/alexander3771/apigpio/blob/2df1aafff4a3e274c35bc6509afd06d28b08bc13/apigpio/apigpio.py#L540-L600

Hope it helped, btw I can review your code :)

from apigpio.

Odianosen25 avatar Odianosen25 commented on September 28, 2024

@alexander3771,

Oh thanks for your response.

Thanks for the examples, and I am aware of the serial over asyncio, but that's not really want I want. Not that I want to read the GPIO from serial, but I want to use the apigpio to read the serial port on the Raspi which is part of the GPIO ('/dev/ttyAMA0' to be precise). As the pigpio supports that with some SER.. commands.

I am working on a project, and I want to use the pigpio daemon via asyncio to read my GPIO using python. So that was what brought me here. I noticed you made a PR, which I have downloaded, and I want to make some modes to it, so I can read not just the pins, but also the serial port.

I also what to use the pipe option over /dev/pigerr, instead of the socket to improve security; but I will look into this later.

Thanks for the offer to review my code, and I will go via that option so I don't use up your time. I am already presently making some modes already, so once done will send it over.

Thanks and regards

from apigpio.

Odianosen25 avatar Odianosen25 commented on September 28, 2024

Hello @alexander3771,

I have made some changes to your files, in which I added the i2c changes made by @jabdoa2 and some serial by myself. You can see the files here.

Please can you kindly go via it and confirm I didn't do anything naughty?

Thanks and kind regards

from apigpio.

jabdoa2 avatar jabdoa2 commented on September 28, 2024

Looks good to me. Can you create a PR against this or my repo? That would allow us to merge it later.

from apigpio.

Odianosen25 avatar Odianosen25 commented on September 28, 2024

Ok thanks @jabdoa2, I will do just that now and create a PR also against your repo.

Regards

from apigpio.

alexander3771 avatar alexander3771 commented on September 28, 2024

It's ok for me too. But let me wrap this code in if py35:

+    async def __aenter__(self):
+        await self.connect()
+        return self
+
+    async def __aexit__(self, exc_type, exc_val, exc_tb):
+        await self.stop()

because of #10 (comment)
I can make it tomorrow

from apigpio.

Odianosen25 avatar Odianosen25 commented on September 28, 2024

Elmm @alexander3771 I honestly have no clue what you saying, but I believe you can make changes to it right?

So I will wait till tomorrow, before using the code in my project so I will be certain I have the latest.

Thanks and kind regards

from apigpio.

jabdoa2 avatar jabdoa2 commented on September 28, 2024

@Odianosen25 just use the older syntax (yield from and asyncio.coroutine) like the other functions

from apigpio.

Odianosen25 avatar Odianosen25 commented on September 28, 2024

@jabdoa2, thanks, but I have just started learning to use asyncio, and I am actually so much more used to async def and await, so not so used to the old yield stuff; that's why I said I didn't get what he meant.

If its about the conversion as the linked comment, I will actually prefer that, as I am kind of more comfortable with the new way of doing it, since that is my first way I learnt it.

Thanks once again

from apigpio.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.