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

standard python and interrupt - update documentation #36

Open
Pythonaire opened this issue Jul 4, 2021 · 10 comments
Open

standard python and interrupt - update documentation #36

Pythonaire opened this issue Jul 4, 2021 · 10 comments
Assignees

Comments

@Pythonaire
Copy link

this library works very well (little modification) in conjunction with python3 on a raspberry, a Adafruit RFM69 breakout board and the interrupt feature (DIO0). In my case, the raspberry work as a bridge between a RFM69-network and LAN.

To use this:
io.setup(self.dio0_pin, io.IN,pull_up_down=io.PUD_DOWN)

and

io.add_event_detect(self.dio0_pin, io.RISING, callback = the_script_to_handle_the data)

maybe people are interested in this.

@jerryneedell
Copy link
Contributor

It is very good to know it has been working well for you.
There is an example for this in the repository https://github.com/adafruit/Adafruit_CircuitPython_RFM69/blob/main/examples/rfm69_rpi_interrupt.py

Did you have to make any changes to the library? If so, please share them or create a PR to add them.

@Pythonaire
Copy link
Author

Yes, it works well and stable since months. The only things, thats different: i waive the extra check of payload.ready and set a time delay of 50 ms after each send/received Action, to make shure, i get no overlapping.

@jerryneedell
Copy link
Contributor

Are those changes in your application code or in the library? If they are in the library would you please post a copy of your modified library. I'd like to see exactly what you changed.

@Pythonaire
Copy link
Author

the files are placed here: https://github.com/Pythonaire/RFMGate

@jerryneedell
Copy link
Contributor

@Pythonaire Thank you. I am a bit confused. The files you posted include rfm69_driver.py which appears to be a very old version of the library. Is that what you are using? I don't see where you made your changes. Your rfm69_test.py imports adafruit_rfm69 but what version of the library are you using?

@jerryneedell
Copy link
Contributor

Ah - I see that main.py uses the rfm69_driver.py...

@Pythonaire
Copy link
Author

yes - this driver is the older version. the changes are marginal, just suppress the permanent listening of payload_ready bit. May be i'm wrong - i'm stumbled across the note ".. note:: The D0/interrupt line is currently unused by this module and can remain unconnected."(line 153). I need the "fire and forget" technic (no "reliable datagram"), because of my use case and the interrupt feature is the solution i needed. The raspberry is a Apple homekit bridge for sensors and switches.

@jerryneedell
Copy link
Contributor

hmm -- I will look into that comment about D0 - hopefully it is just a comment that should have ben removed. I know the interrupt works for the rfm9x library but I have to tested it on the rfm69 for a long time. Thank you for pointing that out. I will test it.

Also note that "fire and forget" is still the default for sending packets, "reliable datagram" is available, but not required.

@jerryneedell
Copy link
Contributor

I just tested the interrupt example using 2 Raspberry Pis with rfm69 bonnets. It does work!

pi@gjnpirfm69:~/projects/blinka/rfm69 $ python3 rfm69_rpi_interrupt.py
Temperature: 32.0C
Frequency: 915.0mhz
Bit rate: 250.0kbit/s
Frequency deviation: 250000.0hz
IRQ detected on pin 22 payload_ready <bound method RFM69.payload_ready of <adafruit_rfm69.RFM69 object at 0xb655a990>> 
Sent hello world message!
Waiting for packets...
IRQ detected on pin 22 payload_ready <bound method RFM69.payload_ready of <adafruit_rfm69.RFM69 object at 0xb655a990>> 
Received (raw bytes): bytearray(b'Hello world!\r\n')
['0x48', '0x65', '0x6c', '0x6c', '0x6f', '0x20', '0x77', '0x6f', '0x72', '0x6c', '0x64', '0x21', '0xd', '0xa']
RSSI: -26.5
received message!

I will review the code and update the comments -- For normal use, D0 does not have to be connected, but it can be used on a Raspberry Pi as in the example.

@Pythonaire
Copy link
Author

Pythonaire commented Jul 5, 2021

i think, waiting for an interrupt is much better, than permanent cycling through the code.

@jerryneedell jerryneedell self-assigned this Jul 12, 2021
@jerryneedell jerryneedell changed the title standard python and interrupt standard python and interrupt - update documentation Jul 12, 2021
mtai added a commit to mtai/Adafruit_CircuitPython_RFM69 that referenced this issue May 30, 2023
mtai added a commit to mtai/Adafruit_CircuitPython_RFM69 that referenced this issue May 31, 2023
…no library

* Adds configurable bitrates with GFSK modulation
* Adds asyncio support so recv/send are no longer blocking
* Removes TX/RX register polling in favor of pin IRQ and countio
* Cleanup RPi Interrupt example, addresses adafruit#36
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